Solved Malfunctioning code

Discussion in 'Plugin Development' started by Urag, Aug 15, 2016.

Thread Status:
Not open for further replies.
  1. I use this code to block not useful commands and players can't login. What's wrong?

    Code:
        List<String> whitelist = Arrays.asList(new String[] {
                "/ereply", "/er", "/l", "/login", "/msg", "/m", "/emsg", "/tell", "/etell", "/t", "/whisper", "/ewhisper", "/w", "/informacje", "/regulamin", "/spawn", "/r", "/reply", "/register", "/reg", "/logout", "/changepassword", "/changepass"
                });
      
        @Override
        public void onEnable(){
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        }
      
        @EventHandler
        public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent e){
         if(!whitelist.contains(e.getMessage().toLowerCase())){
             if(!e.getPlayer().isOp()){
                 e.setCancelled(true);
                 e.getPlayer().sendMessage("§f§lUnknown command.");
             }
          }
        }
    Also that happens:
    - I'm opped, I leave server
    - I join server and i can't login
     
    Last edited: Aug 15, 2016
  2. @Urag Is your server offline mode? That would be the issue
     
  3. @bwfcwalshy I switched to online mode and happens the same.
     
  4. Online

    timtower Administrator Administrator Moderator

    @Urag Try to see where it blocks.
     
  5. @timtower How to check it? Seems that servers takes OP until not logged.
     
  6. Online

    timtower Administrator Administrator Moderator

    @Urag Remove the login plugin, try again, and run online mode.
    Offline mode is not supported by Bukkit.
     
  7. Online

    timtower Administrator Administrator Moderator

    @Urag Then you don't use it and start using online mode, then you don't need authme anymore.
     
  8. I know the issue, it's a very simple logic issue but not helping due to offline mode. Kinda surprised this hasn't been locked already honestly. Either way, good luck, you should support Mojang though and use online mode.
     
Thread Status:
Not open for further replies.

Share This Page