Java Code Examples for cn.nukkit.Player#clearTitle()
The following examples show how to use
cn.nukkit.Player#clearTitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TitleCommand.java From Jupiter with GNU General Public License v3.0 | 4 votes |
@Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } if (args.length < 2) { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } Player player = Server.getInstance().getPlayerExact(args[0]); if (player == null) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%commands.generic.player.notFound")); return true; } if (args.length == 2) { switch (args[1].toLowerCase()) { case "clear": player.clearTitle(); sender.sendMessage(new TranslationContainer("nukkit.command.title.clear", player.getName())); break; case "reset": player.resetTitleSettings(); sender.sendMessage(new TranslationContainer("nukkit.command.title.reset", player.getName())); break; default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 3){ switch (args[1].toLowerCase()) { case "title": player.sendTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.title", new String[]{TextFormat.clean(args[2]), player.getName()})); break; case "subtitle": player.setSubtitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.subtitle", new String[]{TextFormat.clean(args[2]), player.getName()})); break; case "actionbar": player.sendActionBarTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.actionbar", new String[]{TextFormat.clean(args[2]), player.getName()})); break; default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 5) { if (args[1].toLowerCase().equals("times")) { try { player.setTitleAnimationTimes(Integer.valueOf(args[2]), //fadeIn Integer.valueOf(args[3]), //stay Integer.valueOf(args[4])); //fadeOut sender.sendMessage(new TranslationContainer("nukkit.command.title.times.success", new String[]{ args[2], args[3], args[4], player.getName()})); } catch (NumberFormatException exception) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%nukkit.command.title.times.fail")); } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } return true; }
Example 2
Source File: TitleCommand.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } if (args.length < 2) { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } Player player = Server.getInstance().getPlayerExact(args[0]); if (player == null) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%commands.generic.player.notFound")); return true; } if (args.length == 2) { switch (args[1].toLowerCase()) { case "clear": player.clearTitle(); sender.sendMessage(new TranslationContainer("nukkit.command.title.clear", player.getName())); break; case "reset": player.resetTitleSettings(); sender.sendMessage(new TranslationContainer("nukkit.command.title.reset", player.getName())); break; default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 3) { switch (args[1].toLowerCase()) { case "title": player.sendTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.title", TextFormat.clean(args[2]), player.getName())); break; case "subtitle": player.setSubtitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.subtitle", TextFormat.clean(args[2]), player.getName())); break; /*case "actionbar": player.sendActionBarTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.actionbar", new String[]{TextFormat.clean(args[2]), player.getName()})); break;*/ default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 5) { if (args[1].toLowerCase().equals("times")) { try { /*player.setTitleAnimationTimes(Integer.valueOf(args[2]), //fadeIn Integer.valueOf(args[3]), //stay Integer.valueOf(args[4])); //fadeOut*/ sender.sendMessage(new TranslationContainer("nukkit.command.title.times.success", args[2], args[3], args[4], player.getName())); } catch (NumberFormatException exception) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%nukkit.command.title.times.fail")); } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } return true; }
Example 3
Source File: TitleCommand.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } if (args.length < 2) { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } Player player = Server.getInstance().getPlayerExact(args[0]); if (player == null) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%commands.generic.player.notFound")); return true; } if (args.length == 2) { switch (args[1].toLowerCase()) { case "clear": player.clearTitle(); sender.sendMessage(new TranslationContainer("nukkit.command.title.clear", player.getName())); break; case "reset": player.resetTitleSettings(); sender.sendMessage(new TranslationContainer("nukkit.command.title.reset", player.getName())); break; default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 3) { switch (args[1].toLowerCase()) { case "title": player.sendTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.title", new String[]{TextFormat.clean(args[2]), player.getName()})); break; /*case "subtitle": player.setSubtitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.subtitle", new String[]{TextFormat.clean(args[2]), player.getName()})); break; case "actionbar": player.sendActionBarTitle(args[2]); sender.sendMessage(new TranslationContainer("nukkit.command.title.actionbar", new String[]{TextFormat.clean(args[2]), player.getName()})); break;*/ default: sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else if (args.length == 5) { if (args[1].toLowerCase().equals("times")) { try { /*player.setTitleAnimationTimes(Integer.valueOf(args[2]), //fadeIn Integer.valueOf(args[3]), //stay Integer.valueOf(args[4])); //fadeOut*/ sender.sendMessage(new TranslationContainer("nukkit.command.title.times.success", new String[]{ args[2], args[3], args[4], player.getName()})); } catch (NumberFormatException exception) { sender.sendMessage(new TranslationContainer(TextFormat.RED + "%nukkit.command.title.times.fail")); } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } } else { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; } return true; }