org.bukkit.entity.minecart.CommandMinecart Java Examples
The following examples show how to use
org.bukkit.entity.minecart.CommandMinecart.
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: VanillaCommandWrapper.java From Kettle with GNU General Public License v3.0 | 6 votes |
private ICommandSender getListener(CommandSender sender) { if (sender instanceof Player) { return ((CraftPlayer) sender).getHandle(); } if (sender instanceof BlockCommandSender) { return ((CraftBlockCommandSender) sender).getTileEntity(); } if (sender instanceof CommandMinecart) { return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlockLogic(); } if (sender instanceof RemoteConsoleCommandSender) { return ((DedicatedServer) MinecraftServer.getServerCB()).rconConsoleSource; } if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer(); } if (sender instanceof ProxiedCommandSender) { return ((ProxiedNativeCommandSender) sender).getHandle(); } if (sender instanceof CraftFunctionCommandSender) { return ((CraftFunctionCommandSender) sender).getHandle(); } throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener"); }
Example #2
Source File: Exceptions.java From Chimera with MIT License | 6 votes |
static CommandListenerWrapper from(CommandSender sender) { if (sender instanceof Player) { return ((CraftPlayer) sender).getHandle().getCommandListener(); } else if (sender instanceof BlockCommandSender) { return ((CraftBlockCommandSender) sender).getWrapper(); } else if (sender instanceof CommandMinecart) { return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().getWrapper(); } else if (sender instanceof RemoteConsoleCommandSender) { return ((DedicatedServer) MinecraftServer.getServer()).remoteControlCommandListener.getWrapper(); } else if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer().getServerCommandListener(); } else if (sender instanceof ProxiedCommandSender) { return ((ProxiedNativeCommandSender) sender).getHandle(); } else { throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener"); } }
Example #3
Source File: VanillaCommandWrapper.java From Thermos with GNU General Public License v3.0 | 6 votes |
private net.minecraft.command.ICommandSender getListener(CommandSender sender) { if (sender instanceof Player) { return ((CraftPlayer) sender).getHandle(); } if (sender instanceof BlockCommandSender) { return ((CraftBlockCommandSender) sender).getTileEntity(); } if (sender instanceof CommandMinecart) { return ((net.minecraft.entity.EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).func_145822_e(); } if (sender instanceof RemoteConsoleCommandSender) { return net.minecraft.network.rcon.RConConsoleSource.instance; } if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer(); } return null; }
Example #4
Source File: Command.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource) { String result = source.getName() + ": " + message; if (source instanceof BlockCommandSender) { BlockCommandSender blockCommandSender = (BlockCommandSender) source; if (blockCommandSender.getBlock().getWorld().getGameRuleValue("commandBlockOutput").equalsIgnoreCase("false")) { Bukkit.getConsoleSender().sendMessage(result); return; } } else if (source instanceof CommandMinecart) { CommandMinecart commandMinecart = (CommandMinecart) source; if (commandMinecart.getWorld().getGameRuleValue("commandBlockOutput").equalsIgnoreCase("false")) { Bukkit.getConsoleSender().sendMessage(result); return; } } Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE); String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + ChatColor.GRAY + ChatColor.ITALIC + "]"; if (sendToSource && !(source instanceof ConsoleCommandSender)) { source.sendMessage(message); } for (Permissible user : users) { if (user instanceof CommandSender && user.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE)) { CommandSender target = (CommandSender) user; if (target instanceof ConsoleCommandSender) { target.sendMessage(result); } else if (target != source) { target.sendMessage(colored); } } } }