Solved i broke my plugin and cant revert back

Discussion in 'Plugin Development' started by kamakarzy, May 10, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    kamakarzy

    i was trying to add the abbility to configure colors in chat i think i managed it (doesnt look very tidy)
    but now when ever i type /hugs player or /kiss player it just tells me how to use the command and is not working

    Code:java
    1. package com.gmail.nomad856.kamakarzy;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.EntityEffect;
    8. import org.bukkit.Location;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.entity.Wolf;
    13. import org.bukkit.plugin.PluginDescriptionFile;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15. import org.bukkit.scheduler.BukkitRunnable;
    16.  
    17. public class Main extends JavaPlugin {
    18. public final Logger logger = Logger.getLogger("Minecraft");
    19. public static Main plugin;
    20.  
    21. @Override
    22. public void onEnable() {
    23. PluginDescriptionFile pdfFile = this.getDescription();
    24. this.logger.info(pdfFile.getName() + "Version" + pdfFile.getVersion()
    25. + "Has Been Enabled");
    26. getConfig().options().copyDefaults(true);
    27. saveConfig();
    28. }
    29.  
    30. @Override
    31. public void onDisable() {
    32. PluginDescriptionFile pdfFile = this.getDescription();
    33. this.logger.info(pdfFile.getName() + "Has Been Disabled");
    34. }
    35.  
    36. public void hearts(Player p) {
    37. Wolf o = p.getWorld().spawn(p.getLocation(), Wolf.class);
    38. o.playEffect(EntityEffect.WOLF_HEARTS);
    39. o.remove();
    40. }
    41.  
    42. public void Villager(Player p) {
    43. org.bukkit.entity.Villager v = p.getWorld().spawn(p.getLocation(),
    44. org.bukkit.entity.Villager.class);
    45. v.setBaby();
    46. }
    47.  
    48. @Override
    49. public boolean onCommand(CommandSender sender, Command cmd, String label,
    50. String[] args) {
    51. if (cmd.getName().equals("hugs")) {
    52. if (sender instanceof Player) {
    53. if (args.length >= 0) {
    54. Player target = Bukkit.getPlayer(args[0]);
    55. if (target != null) {
    56. final Player player = (Player) sender;
    57. Location playerLoc = player.getLocation();
    58. Location targetLoc = target.getLocation();
    59.  
    60. if (playerLoc.getWorld().getUID()
    61. .equals(targetLoc.getWorld().getUID())) {
    62. if (playerLoc.distanceSquared(targetLoc) < 4)
    63. if (player
    64. .hasPermission(new Permisssions().hug)) {
    65. {
    66. BukkitRunnable run = new BukkitRunnable() {
    67.  
    68. private int count = 0;
    69.  
    70. @Override
    71. public void run() {
    72. if (count >= 4) {
    73. this.cancel();
    74. return;
    75. }
    76. hearts(player);
    77. count++;
    78.  
    79. }
    80.  
    81. };
    82. run.runTaskTimer(this, 0L, 20L);
    83.  
    84. target.sendMessage(getConfig()
    85. .getString("Reciever_Message")
    86. .replace("%P", target.getName())
    87. .replace("%S", sender.getName())
    88. .replaceAll("&0",
    89. ChatColor.BLACK + "")
    90. .replaceAll(
    91. "&1",
    92. ChatColor.DARK_BLUE
    93. + "")
    94. .replaceAll(
    95. "&2",
    96. ChatColor.DARK_GREEN
    97. + "")
    98. .replaceAll(
    99. "&3",
    100. ChatColor.DARK_AQUA
    101. + "")
    102. .replaceAll("&4",
    103. ChatColor.DARK_RED + "")
    104. .replaceAll(
    105. "&5",
    106. ChatColor.DARK_PURPLE
    107. + "")
    108. .replaceAll("&6",
    109. ChatColor.GOLD + "")
    110. .replaceAll("&7",
    111. ChatColor.GRAY + "")
    112. .replaceAll(
    113. "&8",
    114. ChatColor.DARK_GRAY
    115. + "")
    116. .replaceAll("&9",
    117. ChatColor.BLUE + "")
    118. .replaceAll("&a",
    119. ChatColor.GREEN + "")
    120. .replaceAll("&b",
    121. ChatColor.AQUA + "")
    122. .replaceAll("&c",
    123. ChatColor.RED + "")
    124. .replaceAll(
    125. "&d",
    126. ChatColor.LIGHT_PURPLE
    127. + "")
    128. .replaceAll("&e",
    129. ChatColor.YELLOW + "")
    130. .replaceAll("&f",
    131. ChatColor.WHITE + ""));
    132. player.sendMessage(getConfig()
    133. .getString("Sender_Message")
    134. .replace("%P", target.getName())
    135. .replace("%S", sender.getName())
    136. .replaceAll("&0",
    137. ChatColor.BLACK + "")
    138. .replaceAll(
    139. "&1",
    140. ChatColor.DARK_BLUE
    141. + "")
    142. .replaceAll(
    143. "&2",
    144. ChatColor.DARK_GREEN
    145. + "")
    146. .replaceAll(
    147. "&3",
    148. ChatColor.DARK_AQUA
    149. + "")
    150. .replaceAll("&4",
    151. ChatColor.DARK_RED + "")
    152. .replaceAll(
    153. "&5",
    154. ChatColor.DARK_PURPLE
    155. + "")
    156. .replaceAll("&6",
    157. ChatColor.GOLD + "")
    158. .replaceAll("&7",
    159. ChatColor.GRAY + "")
    160. .replaceAll(
    161. "&8",
    162. ChatColor.DARK_GRAY
    163. + "")
    164. .replaceAll("&9",
    165. ChatColor.BLUE + "")
    166. .replaceAll("&a",
    167. ChatColor.GREEN + "")
    168. .replaceAll("&b",
    169. ChatColor.AQUA + "")
    170. .replaceAll("&c",
    171. ChatColor.RED + "")
    172. .replaceAll(
    173. "&d",
    174. ChatColor.LIGHT_PURPLE
    175. + "")
    176. .replaceAll("&e",
    177. ChatColor.YELLOW + "")
    178. .replaceAll("&f",
    179. ChatColor.WHITE + ""));
    180. }
    181. } else {
    182. player.sendMessage(ChatColor.RED
    183. + "YOU DO NOT HAVE PERMISSION TO HUG");
    184. }
    185. else {
    186. sender.sendMessage(target.getDisplayName()
    187. + ChatColor.RED + " is too far away.");
    188. }
    189. } else {
    190. sender.sendMessage(target.getDisplayName()
    191. + ChatColor.RED
    192. + " is not in the same world as you.");
    193. }
    194. } else {
    195. sender.sendMessage(ChatColor.RED
    196. + "Can't find player: " + args[0]);
    197. }
    198. } else {
    199. return false; // print usage
    200. }
    201. } else {
    202. sender.sendMessage("This command can only be used by a player.");
    203. }
    204. } else if (cmd.getName().equals("kiss")) {
    205. if (sender instanceof Player) {
    206. if (args.length >= 0) {
    207. Player target = Bukkit.getPlayer(args[0]);
    208.  
    209. if (target != null) {
    210. final Player player = (Player) sender;
    211. Location playerLoc = player.getLocation();
    212. Location targetLoc = target.getLocation();
    213.  
    214. if (playerLoc.getWorld().getUID()
    215. .equals(targetLoc.getWorld().getUID())) {
    216. if (playerLoc.distanceSquared(targetLoc) < 4)
    217. if (player
    218. .hasPermission(new Permisssions().kiss)) {
    219. {
    220. BukkitRunnable run = new BukkitRunnable() {
    221.  
    222. private int count = 0;
    223.  
    224. @Override
    225. public void run() {
    226. if (count >= 4) {
    227. this.cancel();
    228. return;
    229. }
    230. hearts(player);
    231. count++;
    232.  
    233. }
    234.  
    235. };
    236. run.runTaskTimer(this, 0L, 20L);
    237.  
    238. if (getConfig().get("SPAWN_BABY")
    239. .equals(true)) {
    240. Villager(player);
    241. }
    242. target.sendMessage(getConfig()
    243. .getString(
    244. "Kiss_Message_Reciever")
    245. .replace("%P", target.getName())
    246. .replace("%S", sender.getName()));
    247. player.sendMessage(getConfig()
    248. .getString(
    249. "Kiss_Message_Sender")
    250. .replace("%P", target.getName())
    251. .replace("%S", sender.getName()));
    252. }
    253. } else {
    254. player.sendMessage(ChatColor.RED
    255. + "YOU DO NOT HAVE PERMISSION TO HUG");
    256. }
    257. else {
    258. sender.sendMessage(target.getDisplayName()
    259. + ChatColor.RED + " is too far away.");
    260. }
    261. } else {
    262. sender.sendMessage(target.getDisplayName()
    263. + ChatColor.RED
    264. + " is not in the same world as you.");
    265. }
    266. } else {
    267. sender.sendMessage(ChatColor.RED
    268. + "Can't find player: " + args[0]);
    269. }
    270. } else {
    271. return false;
    272. }
    273. } else {
    274. sender.sendMessage("This command can only be used by a player.");
    275. }
    276. }
    277.  
    278. return true;
    279. }
    280. }
     
  2. Offline

    Briggybros

    return true;?
     
  3. Offline

    kamakarzy

    Briggybros it does return true apart from when
    args.length = 0
     
  4. Offline

    Briggybros

    Possibly like this?
    Code:
    package uk.co.toomuchminecraft.litepets;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.EntityEffect;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Wolf;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;
     
    public class Main extends JavaPlugin {
        public final Logger logger = Logger.getLogger("Minecraft");
        public static Main plugin;
     
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + "Version" + pdfFile.getVersion()
                    + "Has Been Enabled");
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
     
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + "Has Been Disabled");
        }
     
        public void hearts(Player p) {
            Wolf o = p.getWorld().spawn(p.getLocation(), Wolf.class);
            o.playEffect(EntityEffect.WOLF_HEARTS);
            o.remove();
        }
     
        public void Villager(Player p) {
            org.bukkit.entity.Villager v = p.getWorld().spawn(p.getLocation(),
                    org.bukkit.entity.Villager.class);
            v.setBaby();
        }
     
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label,
                String[] args) {
            if (cmd.getName().equals("hugs")) {
                if (sender instanceof Player) {
                    if (args.length >= 0) {
                        Player target = Bukkit.getPlayer(args[0]);
                        if (target != null) {
                            final Player player = (Player) sender;
                            Location playerLoc = player.getLocation();
                            Location targetLoc = target.getLocation();
     
                            if (playerLoc.getWorld().getUID()
                                    .equals(targetLoc.getWorld().getUID())) {
                                if (playerLoc.distanceSquared(targetLoc) < 4)
                                    if (player
                                            .hasPermission(new Permisssions().hug)) {
                                        {
                                            BukkitRunnable run = new BukkitRunnable() {
     
                                                private int count = 0;
     
                                                @Override
                                                public void run() {
                                                    if (count >= 4) {
                                                        this.cancel();
                                                        return;
                                                    }
                                                    hearts(player);
                                                    count++;
     
                                                }
     
                                            };
                                            run.runTaskTimer(this, 0L, 20L);
     
                                            target.sendMessage(getConfig()
                                                    .getString("Reciever_Message")
                                                    .replace("%P", target.getName())
                                                    .replace("%S", sender.getName())
                                                    .replaceAll("&0",
                                                            ChatColor.BLACK + "")
                                                    .replaceAll(
                                                            "&1",
                                                            ChatColor.DARK_BLUE
                                                                    + "")
                                                    .replaceAll(
                                                            "&2",
                                                            ChatColor.DARK_GREEN
                                                                    + "")
                                                    .replaceAll(
                                                            "&3",
                                                            ChatColor.DARK_AQUA
                                                                    + "")
                                                    .replaceAll("&4",
                                                            ChatColor.DARK_RED + "")
                                                    .replaceAll(
                                                            "&5",
                                                            ChatColor.DARK_PURPLE
                                                                    + "")
                                                    .replaceAll("&6",
                                                            ChatColor.GOLD + "")
                                                    .replaceAll("&7",
                                                            ChatColor.GRAY + "")
                                                    .replaceAll(
                                                            "&8",
                                                            ChatColor.DARK_GRAY
                                                                    + "")
                                                    .replaceAll("&9",
                                                            ChatColor.BLUE + "")
                                                    .replaceAll("&a",
                                                            ChatColor.GREEN + "")
                                                    .replaceAll("&b",
                                                            ChatColor.AQUA + "")
                                                    .replaceAll("&c",
                                                            ChatColor.RED + "")
                                                    .replaceAll(
                                                            "&d",
                                                            ChatColor.LIGHT_PURPLE
                                                                    + "")
                                                    .replaceAll("&e",
                                                            ChatColor.YELLOW + "")
                                                    .replaceAll("&f",
                                                            ChatColor.WHITE + ""));
                                            player.sendMessage(getConfig()
                                                    .getString("Sender_Message")
                                                    .replace("%P", target.getName())
                                                    .replace("%S", sender.getName())
                                                    .replaceAll("&0",
                                                            ChatColor.BLACK + "")
                                                    .replaceAll(
                                                            "&1",
                                                            ChatColor.DARK_BLUE
                                                                    + "")
                                                    .replaceAll(
                                                            "&2",
                                                            ChatColor.DARK_GREEN
                                                                    + "")
                                                    .replaceAll(
                                                            "&3",
                                                            ChatColor.DARK_AQUA
                                                                    + "")
                                                    .replaceAll("&4",
                                                            ChatColor.DARK_RED + "")
                                                    .replaceAll(
                                                            "&5",
                                                            ChatColor.DARK_PURPLE
                                                                    + "")
                                                    .replaceAll("&6",
                                                            ChatColor.GOLD + "")
                                                    .replaceAll("&7",
                                                            ChatColor.GRAY + "")
                                                    .replaceAll(
                                                            "&8",
                                                            ChatColor.DARK_GRAY
                                                                    + "")
                                                    .replaceAll("&9",
                                                            ChatColor.BLUE + "")
                                                    .replaceAll("&a",
                                                            ChatColor.GREEN + "")
                                                    .replaceAll("&b",
                                                            ChatColor.AQUA + "")
                                                    .replaceAll("&c",
                                                            ChatColor.RED + "")
                                                    .replaceAll(
                                                            "&d",
                                                            ChatColor.LIGHT_PURPLE
                                                                    + "")
                                                    .replaceAll("&e",
                                                            ChatColor.YELLOW + "")
                                                    .replaceAll("&f",
                                                            ChatColor.WHITE + ""));
                                            return true;
                                        }
                                    } else {
                                        player.sendMessage(ChatColor.RED
                                                + "YOU DO NOT HAVE PERMISSION TO HUG");
                                        return true;
                                    }
                                else {
                                    sender.sendMessage(target.getDisplayName()
                                            + ChatColor.RED + " is too far away.");
                                    return true;
                                }
                            } else {
                                sender.sendMessage(target.getDisplayName()
                                        + ChatColor.RED
                                        + " is not in the same world as you.");
                                return true;
                            }
                        } else {
                            sender.sendMessage(ChatColor.RED
                                    + "Can't find player: " + args[0]);
                            return true;
                        }
                    } else {
                        return false; // print usage
                    }
                } else {
                    sender.sendMessage("This command can only be used by a player.");
                    return true;
                }
            } else if (cmd.getName().equals("kiss")) {
                if (sender instanceof Player) {
                    if (args.length >= 0) {
                        Player target = Bukkit.getPlayer(args[0]);
     
                        if (target != null) {
                            final Player player = (Player) sender;
                            Location playerLoc = player.getLocation();
                            Location targetLoc = target.getLocation();
     
                            if (playerLoc.getWorld().getUID()
                                    .equals(targetLoc.getWorld().getUID())) {
                                if (playerLoc.distanceSquared(targetLoc) < 4)
                                    if (player
                                            .hasPermission(new Permisssions().kiss)) {
                                        {
                                            BukkitRunnable run = new BukkitRunnable() {
     
                                                private int count = 0;
     
                                                @Override
                                                public void run() {
                                                    if (count >= 4) {
                                                        this.cancel();
                                                        return;
                                                    }
                                                    hearts(player);
                                                    count++;
     
                                                }
     
                                            };
                                            run.runTaskTimer(this, 0L, 20L);
     
                                            if (getConfig().get("SPAWN_BABY")
                                                    .equals(true)) {
                                                Villager(player);
                                            }
                                            target.sendMessage(getConfig()
                                                    .getString(
                                                            "Kiss_Message_Reciever")
                                                    .replace("%P", target.getName())
                                                    .replace("%S", sender.getName()));
                                            player.sendMessage(getConfig()
                                                    .getString(
                                                            "Kiss_Message_Sender")
                                                    .replace("%P", target.getName())
                                                    .replace("%S", sender.getName()));
                                            return true;
                                        }
                                    } else {
                                        player.sendMessage(ChatColor.RED
                                                + "YOU DO NOT HAVE PERMISSION TO HUG");
                                        return true;
                                    }
                                else {
                                    sender.sendMessage(target.getDisplayName()
                                            + ChatColor.RED + " is too far away.");
                                    return true;
                                }
                            } else {
                                sender.sendMessage(target.getDisplayName()
                                        + ChatColor.RED
                                        + " is not in the same world as you.");
                                return true;
                            }
                        } else {
                            sender.sendMessage(ChatColor.RED
                                    + "Can't find player: " + args[0]);
                            return true;
                        }
                    } else {
                        return false;
                    }
                } else {
                    sender.sendMessage("This command can only be used by a player.");
                    return true;
                }
            }
     
            return false;
        }
    }
     
  5. Offline

    kamakarzy

  6. Offline

    CubieX

    No. It returns "true" if
    Code:
    args.length >=0
    Remove the "=" and it should work.
     
  7. Offline

    kamakarzy

    CubieX nope still the same

    timtower do you think you could help there has to be a problem as its not reading my class

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  8. Offline

    Me4502

    'Not reading my class' <- so you're saying the plugin isn't even loading now?
     
  9. Offline

    kamakarzy

    i dont know what its doing it. In Console it says it has loaded
    Code:
    2013-05-10 21:30:49 [INFO] [Huggs] Loading Huggs v1.2
    2013-05-10 21:30:49 [INFO] [Vault] Enabling Vault v1.2.24-b304
    2013-05-10 21:30:49 [INFO] [Vault][Permission] PermissionsEx found: Waiting
    2013-05-10 21:30:49 [INFO] [Vault][Permission] SuperPermissions loaded as backup permission system.
    2013-05-10 21:30:49 [INFO] [Vault][Chat] PermissionsEx found: Waiting
    2013-05-10 21:30:49 [INFO] [Vault] Enabled Version 1.2.24-b304
    2013-05-10 21:30:49 [INFO] [Vault][Permission] PermissionsEx hooked.
    2013-05-10 21:30:49 [INFO] [PermissionsEx] Enabling PermissionsEx v1.19.5
    2013-05-10 21:30:49 [INFO] [PermissionsEx] Superperms support enabled.
    2013-05-10 21:30:49 [INFO] [PermissionsEx] v1.19.5 enabled
    2013-05-10 21:30:49 [INFO] [Vault][Chat] PermissionsEx_Chat hooked.
    2013-05-10 21:30:49 [INFO] [Huggs] Enabling Huggs v1.2
    2013-05-10 21:30:49 [INFO] HuggsVersion1.2Has Been Enabled
    2013-05-10 21:30:49 [INFO] Server permissions file permissions.yml is empty, ignoring it
    but i added a system print out to see if it was getting the command and its not even getting to that
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String label,
                String[] args) {
            if(cmd.getName().equals("hugs")) {
                if (sender instanceof Player) {
                    System.out.println(args.length);
                    if (args.length > 0) {
                        Player target = Bukkit.getPlayer(args[0]);
                        if (target != null) {
                            final Player player = (Player) sender;
                            Location playerLoc = player.getLocation();
                            Location targetLoc = target.getLocation();
     
                            if (playerLoc.getWorld().getUID()
                                    .equals(targetLoc.getWorld().getUID())) {
                                if (playerLoc.distanceSquared(targetLoc) < 4)
                                    if (player
     
  10. Offline

    Me4502

    System.out.println doesn't work with bukkit, please use Bukkit.getLogger().info instead.

    Do you have a valid plugin.yml in your plugins jar file, with all commands etc?
     
  11. Offline

    kamakarzy

    Me4502
    yes this is my plugin.yml

    Code:
    name: Huggs
    main: com.gmail.nomad856.kamakarzy.Main
    version: 1.2
    author: nomad856/kamakarzy
    commands:
      hugs:
        description: hug the target player
        usage: |
                /<command> [TargetPlayer]
      kiss:
        description: kiss the target player
        usage: |
                /<command> [TargetPlayer]
        

    i added this to my code and still i get no response so its like the command is not there

    Code:
      public boolean onCommand(CommandSender sender, Command cmd, String label,
                String[] args) {
            if(cmd.getName().equals("hugs")) {
                Bukkit.getLogger().info("here");
                if (sender instanceof Player) {
                    Bukkit.getLogger().info("here is" + args.length);
                    if (args.length > 0) {
                        Player target = Bukkit.getPlayer(args[0]);
                        if (target != null) {
     
  12. Offline

    Me4502

    Do you get output with Bukkit.getLogger().info?
     
  13. Offline

    kamakarzy

    Me4502 no still no output
     
  14. Offline

    drtshock

    ChatColor.translateAlternateColorCodes('&', stringObject);
    getServer().getLogger();
     
  15. Offline

    kamakarzy

    sorry i dont quite understand how i am suppost to use them?
     
  16. Offline

    drtshock

    You replace all of the &4 codes in the string to ChatColor.DARK_RED for example. Instead you could just get the string object and do the translate alternate color codes and it does it all for you :)

    Also doing getServer().getLogger() gets the logger for our plugin, or even getLogger(). The method you have to get the logger will make it show up like anything Minecraft would log itself. Getting the logger properly will append your plugin's name to the front of each message.

    Also don't add enable and disable messages. Bukkit does that for you.

    I know it's not what you were asking for, just thought I'd give you a few pointers to help out :)
     
  17. Offline

    kamakarzy

    drtshock thats fine im still kinda new to bukkit i wouldnt mind but i havnt touched the plugin.yml all i have doene is added colour codes and it breaks my entire plugin

    drtshock any chance of an example of
    ChatColor.translateAlternateColorCodes('&', stringObject);
    please as i cant seem to use it right

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  18. Offline

    drtshock

    Here it is in a simple votifier listener I made a long time ago.
    Code:java
    1. package com.drtshock.factionslistener;
    2.  
    3. import com.vexsoftware.votifier.model.VotifierEvent;
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Material;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.inventory.ItemStack;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12.  
    13. /**
    14.  *
    15.  * @author drtshock
    16.  */
    17. public class FactionsListener extends JavaPlugin implements Listener {
    18.  
    19. public void onEnable() {
    20. saveDefaultConfig();
    21. getServer().getPluginManager().registerEvents(this, this);
    22. }
    23.  
    24. @EventHandler
    25. public void voteMade(VotifierEvent event) {
    26. String name = event.getVote().getUsername();
    27. Player player = Bukkit.getPlayerExact(name);
    28. String message = ChatColor.translateAlternateColorCodes('&', getConfig().getString("message"));
    29. String dothis = message.replaceAll("%player", player.getName());
    30. Bukkit.broadcastMessage(dothis);
    31. if (player != null) {
    32. player.getInventory().addItem(new ItemStack(getConfig().getInt("item-id"), getConfig().getInt("amount")));
    33. }
    34. }
    35. }
    36.  
     
  19. Offline

    kamakarzy

    drtshock right i understand now i was still using it in replaceAll thanks i understand the use of it now also i managed to fix my plugin my spacing between commands in plugin.yml was off by 1
     
    drtshock likes this.
Thread Status:
Not open for further replies.

Share This Page