Solved Malfunctioning code

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

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

    Urag

    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. Offline

    bwfcwalshy Retired Staff

    @Urag Is your server offline mode? That would be the issue
     
  3. Offline

    Urag

    @bwfcwalshy I switched to online mode and happens the same.
     
  4. Offline

    timtower Moderator Moderator

    @Urag Try to see where it blocks.
     
  5. Offline

    Urag

    @timtower How to check it? Seems that servers takes OP until not logged.
     
  6. Offline

    timtower Moderator Moderator

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

    Urag

  8. Offline

    timtower Moderator Moderator

    @Urag Then you don't use it and start using online mode, then you don't need authme anymore.
     
  9. Offline

    bwfcwalshy Retired Staff

    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