My plugin stops working over time.

Discussion in 'Plugin Development' started by KillerSmurf, Nov 12, 2011.

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

    KillerSmurf

    I am making a plugin, and the commands work, and all. But after a while if you try a command it won't work. If you reload it starts to work again. I think its something in here:
    SimpleCommandManager.java
    Code:
    public class SimpleCommandManager implements CommandManager {
        private Map<String, CrimsonCommand> commands = new HashMap<String, CrimsonCommand>();
        private Crimson core;
    
        public SimpleCommandManager(Crimson core) {
            this.core = core;
        }
        public void registerCommands() {
            //Admin commands
            commands.put("fakegamemode", new CommandFakeGameMode(core));
            commands.put("forceload", new CommandForceLoad(core));
            commands.put("forcesave", new CommandForceSave(core));
            commands.put("gimme", new CommandGimme(core));
            //Citizen commands
            commands.put("message", new CommandMessage(core));
            commands.put("pay", new CommandPay(core));
            commands.put("reply", new CommandReply(core));
            commands.put("wallet", new CommandWallet(core));
            //Plot commands
            commands.put("plot", new CommandPlot(core));
            commands.put("plotaccept", new CommandPlotAccept(core));
            commands.put("plotadminify", new CommandPlotAdminify(core));
            commands.put("plotcreate", new CommandPlotCreate(core));
            commands.put("plotdemote", new CommandPlotDemote(core));
            commands.put("plotdeposit", new CommandPlotDeposit(core));
            commands.put("plotdisband", new CommandPlotDisband(core));
            commands.put("plotdowngrade", new CommandPlotDowngrade(core));
            commands.put("plotexpand", new CommandPlotExpand(core));
            commands.put("plothelp", new CommandPlotHelp(core));
            commands.put("plotinfo", new CommandPlotInfo(core));
            commands.put("plotinvite", new CommandPlotInvite(core));
            commands.put("plotkick", new CommandPlotKick(core));
            commands.put("plotpromote", new CommandPlotPromote(core));
            commands.put("plotrename", new CommandPlotRename(core));
            commands.put("plotshrink", new CommandPlotShrink(core));
            commands.put("plotsize", new CommandPlotSize(core));
            commands.put("plotupgrade", new CommandPlotUpgrade(core));
            commands.put("plotwithdraw", new CommandPlotWithdraw(core));
            for (Entry<String, CrimsonCommand> commandEntry : commands.entrySet()) {
                core.getCommand(commandEntry.getKey()).setExecutor(commandEntry.getValue());
            }
        }
    
        public CrimsonCommand getCommand(String name) {
            return commands.get(name);
        }
    }
    
    And heres some code from the main class:

    Code:
    public void onEnable() {
            citizenManager = new SimpleCitizenManager(this);
            listenerManager = new ListenerManager(this);
            plotManager = new SimplePlotManager(this);
            commandManager = new SimpleCommandManager(this);
            npcManager = new MartinNPCManager(this);
            chatHandler = new SimpleChatHandler(this);
            resourceManager = new ResourceManager(this);
            materialManager = new MaterialManager(this);
            clanManager = new ClanManager(this);
            listenerManager.registerEvents();
            commandManager.registerCommands();
            
     
  2. Offline

    Fishrock123

    Is your server slowing down over time?
     
  3. Offline

    md_5

    @KillerSmurf How are you detecting when they use a command?
     
  4. Offline

    KillerSmurf

    I fixed it, it creates a citizen when they join. And when they leave and rejoin is when is it stops working. But i made it so it removes them when they leave. All fixed now.
     
Thread Status:
Not open for further replies.

Share This Page