Last active
April 1, 2019 22:09
-
-
Save keepoff07/23b80cc5cd695f73282b to your computer and use it in GitHub Desktop.
ymlを必要としないコマンドの登録
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Constructor<?> cs = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class); | |
cs.setAccessible(true); | |
PluginCommand cmd = (PluginCommand)cs.newInstance("setblock", this); | |
cmd.setDescription("This is command description."); | |
cmd.setUsage("/<command> <x> <y> <z> <TileName> [dataValue] [dataTag]"); | |
cmd.setPermission("minecraft.command.setblock"); | |
cmd.setPermissionMessage("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."); | |
cmd.setExecutor(new CommandExecutor() { | |
@Override | |
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) { | |
// TODO 自動生成されたメソッド・スタブ | |
return false; | |
} | |
}); | |
cmd.setTabCompleter(new TabCompleter() { | |
@Override | |
public List<String> onTabComplete(CommandSender arg0, Command arg1, String arg2, String[] arg3) { | |
// TODO 自動生成されたメソッド・スタブ | |
return null; | |
} | |
}); | |
//this "minecraft" is command prefix. | |
((CraftServer)getServer()).getCommandMap().register("minecraft", cmd); | |
} catch (Throwable e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment