Scoreboard Error

Discussion in 'Spigot Plugin Development' started by Angeles, Jun 29, 2016.

  1. Code (Text):


    import net.geewan.plugins.pcommon.*;
    import java.util.*;
    import org.bukkit.entity.*;
    import org.bukkit.plugin.*;
    import org.bukkit.event.entity.*;
    import org.bukkit.event.block.*;
    import org.bukkit.scheduler.*;
    import org.bukkit.inventory.*;
    import org.bukkit.inventory.meta.*;
    import org.bukkit.event.*;
    import org.bukkit.event.inventory.*;
    import org.bukkit.*;
    import org.bukkit.event.player.*;

    public class EnderpearlListener implements Listener
    {
        private pCommon common;
        private HashMap<Player, Long> enderpearlCooldownMap;
        private int enderpearlCooldownTime;
       
        public EnderpearlListener(final pCommon parampCommon) {
            this.enderpearlCooldownMap = new HashMap<Player, Long>();
            this.common = parampCommon;
        }
       
        public void init() {
            Bukkit.getServer().getPluginManager().registerEvents((Listener)this, (Plugin)this.common);
            this.enderpearlCooldownTime = this.common.getConfig().getInt("SCOREBOARD.SETTINGS.COOLDOWNS.ENDERPEARL");
        }
       
        public void putCooldown(final Player paramPlayer, final long paramMilliseconds) {
            final long millis = System.currentTimeMillis() + paramMilliseconds * 1000L;
            this.enderpearlCooldownMap.put(paramPlayer, millis);
        }
       
        public void removeCooldown(final Player paramPlayer) {
            this.enderpearlCooldownMap.remove(paramPlayer);
        }
       
        public boolean hasCooldown(final Player paramPlayer) {
            if (!this.enderpearlCooldownMap.containsKey(paramPlayer)) {
                return false;
            }
            final long millis = this.enderpearlCooldownMap.get(paramPlayer);
            return millis > System.currentTimeMillis();
        }
       
        public long getMillisecondsLeft(final Player paramPlayer) {
            if (!this.hasCooldown(paramPlayer)) {
                return -1L;
            }
            return this.enderpearlCooldownMap.get(paramPlayer) - System.currentTimeMillis();
        }
       
        @EventHandler
        public void onPlayerQuit(final PlayerQuitEvent paramPlayerQuitEvent) {
            final Player player = paramPlayerQuitEvent.getPlayer();
            this.removeCooldown(player);
        }
       
        @EventHandler
        public void onPlayerKick(final PlayerKickEvent paramPlayerKickEvent) {
            final Player player = paramPlayerKickEvent.getPlayer();
            this.removeCooldown(player);
        }
       
        @EventHandler
        public void onPlayerDeath(final PlayerDeathEvent paramPlayerDeathEvent) {
            final Player player = paramPlayerDeathEvent.getEntity().getPlayer();
            this.removeCooldown(player);
        }
       
        @EventHandler(priority = EventPriority.MONITOR)
        public void onPlayerInteract(final PlayerInteractEvent paramPlayerInteractEvent) {
            final Action action = paramPlayerInteractEvent.getAction();
            if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
                final Material material = paramPlayerInteractEvent.getMaterial();
                final Player player = paramPlayerInteractEvent.getPlayer();
                if (material == Material.ENDER_PEARL && player.getGameMode() != GameMode.CREATIVE) {
                    if (this.hasCooldown(player)) {
                        paramPlayerInteractEvent.setUseItemInHand(Event.Result.DENY);
                        player.sendMessage(this.common.getString("MESSAGES.COOLDOWNS.ENDERPEARL.MESSAGE.COOLDOWN_REMAINING").replace("%enderpearl_cooldown%", this.common.setLongFormat(this.getMillisecondsLeft(player))));
                    }
                    else {
                        new BukkitRunnable() {
                            public void run() {
                                final ItemStack itemStack = player.getItemInHand();
                                if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL && player.getGameMode() != GameMode.CREATIVE) {
                                    if (EnderpearlListener.this.hasCooldown(player)) {
                                        final ItemMeta itemMeta = itemStack.getItemMeta();
                                        itemMeta.setDisplayName(EnderpearlListener.this.common.getString("MESSAGES.COOLDOWNS.ENDERPEARL.ITEM.DISPLAY_NAME.COOLDOWN_REMAINING").replace("%enderpearl_cooldown%", EnderpearlListener.this.common.setLongFormat(EnderpearlListener.this.getMillisecondsLeft(player))));
                                        itemStack.setItemMeta(itemMeta);
                                    }
                                    else if (itemStack.getItemMeta().hasDisplayName()) {
                                        this.cancel();
                                        player.sendMessage(EnderpearlListener.this.common.getString("MESSAGES.COOLDOWNS.ENDERPEARL.MESSAGE.COOLDOWN_ENDED"));
                                        final ItemMeta itemMeta = itemStack.getItemMeta();
                                        itemMeta.setDisplayName(EnderpearlListener.this.common.getString("MESSAGES.COOLDOWNS.ENDERPEARL.ITEM.DISPLAY_NAME.COOLDOWN_ENDED"));
                                        itemStack.setItemMeta(itemMeta);
                                    }
                                }
                            }
                        }.runTaskTimer((Plugin)this.common, 1L, 1L);
                        this.putCooldown(player, this.enderpearlCooldownTime);
                    }
                }
            }
        }
       
        @EventHandler
        public void onInventoryClickEvent(final InventoryClickEvent paramInventoryClickEvent) {
            final ItemStack itemStack = paramInventoryClickEvent.getCurrentItem();
            if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL) {
                final ItemMeta itemMeta = paramInventoryClickEvent.getCurrentItem().getItemMeta();
                itemMeta.setDisplayName((String)null);
                paramInventoryClickEvent.getCurrentItem().setItemMeta(itemMeta);
            }
        }
       
        @EventHandler
        public void onPlayerItemHeldEvent(final PlayerItemHeldEvent paramPlayerItemHeldEvent) {
            final ItemStack itemStack = paramPlayerItemHeldEvent.getPlayer().getInventory().getItem(paramPlayerItemHeldEvent.getPreviousSlot());
            if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL && itemStack.getItemMeta() != null) {
                final ItemMeta itemMeta = itemStack.getItemMeta();
                itemMeta.setDisplayName((String)null);
                itemStack.setItemMeta(itemMeta);
            }
        }
       
        @EventHandler
        public void onGeewanJoin(final PlayerJoinEvent paramPlayerJoinEvent) {
            final Player player = paramPlayerJoinEvent.getPlayer();
            if (player.getName().contains("Geewan")) {
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&eWelcome, &fGeewan&e. This server is running your plugin &6" + this.common.getDescription().getFullName() + "&e."));
            }
        }
       
        @EventHandler
        public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent paramPlayerCommandPreprocessEvent) {
            final Player player = paramPlayerCommandPreprocessEvent.getPlayer();
            if (paramPlayerCommandPreprocessEvent.getMessage().equalsIgnoreCase("/pcommon")) {
                paramPlayerCommandPreprocessEvent.setCancelled(true);
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&eThis server is running the plugin &6pCommon &eby &fGeewan&e."));
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&eFor business inquires contact me on skype &6iarslanmc&e."));
            }
        }
    }
     
    There is an error on line 87

    Code (Text):
    1:37:17 ERROR]: Could not pass event PlayerInteractEvent to Core v1.0-RELEASE
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:509) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:494) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:242) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:212) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:636) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:50) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.PacketPlayInBlockPlace.handle(PacketPlayInBlockPlace.java:86) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    Caused by: java.lang.NoClassDefFoundError: net/geewan/plugins/pcommon/listeners/EnderpearlListener$1
            at net.geewan.plugins.pcommon.listeners.EnderpearlListener.onPlayerInteract(EnderpearlListener.java:87) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:298) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
            ... 15 more
    >
     
  2. What's on line 87?
     
  3. Show us line 87
    Edit sniped.....
     
  4. Ugh so many .* imports... Also, is this yours or more stolen code?
     
  5. I cant find any Scoreboard :O
     
  6. Like i said every error he has he makes a thread about it. I Guess it's not his code either because he would know this is not a scoreboard.
     
  7. I see him every day with at least one thread here :D
     
  8. hahaha dude are you kidding me? he does about 3 threads everyday and all of them have the same thread name! jesus christ :'(
     
  9. Choco

    Moderator

    Dude.. this has "decompiled" written all over it ._. It also has absolutely NOTHING to do with scoreboards
     
    • Agree Agree x 2
    • Winner Winner x 1
  10. Y'know, I can never figure out why all your projects are called different things, some are io.'s, some are com's, some are net's.. Hell, even the "geewan" changes every project.. Most-likely decompiled.
     
    • Funny Funny x 1
    • Winner Winner x 1
  11. "Most likely" meh.
    100% decompiled. The decompiler he uses probably has been running more hours than his IDE.
     
    • Funny Funny x 5
  12. BUSTED! I wanted so much to say that! LOL
     
  13. Sick burn
     
    • Agree Agree x 3
  14. Good news for us dude! this thread cannot be deleted!
     
  15. Code (Text):
    public void onPlayerDeath(final PlayerDeathEvent paramPlayerDeathEvent) {
            final Player player = paramPlayerDeathEvent.getEntity().getPlayer();
    BAHAHABA IM WEAK
     
  16. [​IMG]
    A gif is sometimes better than words.
     
    • Agree Agree x 2
    • Winner Winner x 1
  17. Busted.gif
    same as picture!​
     
  18. Nobody help this kid, he's already been exposed stealing plugins and code, please don't feed the ultimate spoon feeder, he decompiles a bunch of code and uses it as "his own" it's really annoying and I honestly just wish md_5 would ban this kid already, there's been more than enough proof provided for him to be breaking multiple rules. (As said in other threads)

    Example: https://www.spigotmc.org/threads/erorr-help.157737/

    Reported this thread with other info on him stealing plugins, if nothing happens I will contact spigot support and contact them with the code of all his plugins to expose package names, classpath names, and more proving it's not him along with these 2 threads, he's quite obviously pulling this code from a decompiler. one of the staff should really look into him and I hope this report will make them look into it.

    Might actually go through his profile a bit and find every single stolen plugin thread I can and make a little text document with everything on it
     
    #18 FiXed, Jun 29, 2016
    Last edited: Jun 29, 2016
    • Agree Agree x 2
  19. I haven't seen this before :O
     
  20. seen what before? He's causing harm to many spigot community members along with wasting their time since he doesn't know how to code he will just end up getting spoonfed which is wasting everyone's time who's actually trying to help.