@SuppressWarnings("unchecked") public SimpleHelpMap(CraftServer server) { this.helpTopics = new TreeMap<String, HelpTopic>(HelpTopicComparator.topicNameComparatorInstance()); // Using a TreeMap for its explicit sorting on key this.topicFactoryMap = new HashMap<Class, HelpTopicFactory<Command>>(); this.server = server; this.yaml = new HelpYamlReader(server); Predicate indexFilter = Predicates.not(Predicates.instanceOf(CommandAliasHelpTopic.class)); if (!yaml.commandTopicsInMasterIndex()) { indexFilter = Predicates.and(indexFilter, Predicates.not(new IsCommandTopicPredicate())); } this.defaultTopic = new IndexHelpTopic("Index", null, null, Collections2.filter(helpTopics.values(), indexFilter), "Use /help [n] to get page n of help."); registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory()); }
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; }
public CraftFirework(CraftServer server, EntityFireworkRocket entity) { super(server, entity); ItemStack item = getHandle().getDataWatcher().getWatchableObjectItemStack(FIREWORK_ITEM_INDEX); if (item == null) { item = new ItemStack(Items.fireworks); getHandle().getDataWatcher().updateObject(FIREWORK_ITEM_INDEX, item); } this.item = CraftItemStack.asCraftMirror(item); // Ensure the item is a firework... if (this.item.getType() != Material.FIREWORK) { this.item.setType(Material.FIREWORK); } }
private ICommandListener 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()).getCommandBlock(); } if (sender instanceof RemoteConsoleCommandSender) { return RemoteControlCommandListener.instance; } if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer(); } return null; }
public CraftLivingEntity(final CraftServer server, final net.minecraft.entity.EntityLivingBase entity) { super(server, entity); // Cauldron start this.entityClass = entity.getClass(); this.entityName = EntityRegistry.getCustomEntityTypeName(entityClass); if (entityName == null) entityName = entity.getCommandSenderName(); // Cauldron end if (entity instanceof net.minecraft.entity.EntityLiving) { equipment = new CraftEntityEquipment(this); } }
private static boolean canBuild(CraftWorld world, Player player, int x, int z) { net.minecraft.world.WorldServer worldServer = world.getHandle(); int spawnSize = Bukkit.getServer().getSpawnRadius(); if (world.getHandle().provider.dimensionId != 0) return true; if (spawnSize <= 0) return true; if (((CraftServer) Bukkit.getServer()).getHandle().func_152603_m().func_152690_d()) return true; if (player.isOp()) return true; net.minecraft.util.ChunkCoordinates chunkcoordinates = worldServer.getSpawnPoint(); int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.posX), Math.abs(z - chunkcoordinates.posZ)); return distanceFromSpawn > spawnSize; }
/** * EntityTameEvent */ public static EntityTameEvent callEntityTameEvent(net.minecraft.entity.EntityLiving entity, net.minecraft.entity.player.EntityPlayer tamer) { org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null); CraftServer craftServer = (CraftServer) bukkitEntity.getServer(); entity.persistenceRequired = true; EntityTameEvent event = new EntityTameEvent((LivingEntity) bukkitEntity, bukkitTamer); craftServer.getPluginManager().callEvent(event); return event; }
public static net.minecraft.inventory.Container callInventoryOpenEvent(net.minecraft.entity.player.EntityPlayerMP player, net.minecraft.inventory.Container container, boolean closeInv) { if (player.openContainer != player.inventoryContainer && closeInv) { // fire INVENTORY_CLOSE if one already open // Cauldron end player.playerNetServerHandler.processCloseWindow(new net.minecraft.network.play.client.C0DPacketCloseWindow(player.openContainer.windowId)); } CraftServer server = player.worldObj.getServer(); CraftPlayer craftPlayer = player.getBukkitEntity(); // Cauldron start - vanilla compatibility try { player.openContainer.transferTo(container, craftPlayer); } catch (AbstractMethodError e) { // do nothing } // Cauldron end InventoryOpenEvent event = new InventoryOpenEvent(container.getBukkitView()); if (container.getBukkitView() != null) server.getPluginManager().callEvent(event); // Cauldron - allow vanilla mods to bypass if (event.isCancelled()) { container.transferTo(player.openContainer, craftPlayer); // Cauldron start - handle close for modded containers if (!closeInv) { // fire INVENTORY_CLOSE if one already open player.openContainer = container; // make sure the right container is processed player.closeScreen(); player.openContainer = player.inventoryContainer; } // Cauldron end return null; } return container; }
protected ColouredConsoleSender() { super(); this.terminal = ((CraftServer) getServer()).getReader().getTerminal(); replacements.put(ChatColor.BLACK, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).boldOff().toString()); replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).boldOff().toString()); replacements.put(ChatColor.DARK_GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).boldOff().toString()); replacements.put(ChatColor.DARK_AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).boldOff().toString()); replacements.put(ChatColor.DARK_RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).boldOff().toString()); replacements.put(ChatColor.DARK_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).boldOff().toString()); replacements.put(ChatColor.GOLD, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).boldOff().toString()); replacements.put(ChatColor.GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).boldOff().toString()); replacements.put(ChatColor.DARK_GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).bold().toString()); replacements.put(ChatColor.BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).bold().toString()); replacements.put(ChatColor.GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).bold().toString()); replacements.put(ChatColor.AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).bold().toString()); replacements.put(ChatColor.RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).bold().toString()); replacements.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).bold().toString()); replacements.put(ChatColor.YELLOW, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).bold().toString()); replacements.put(ChatColor.WHITE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).bold().toString()); replacements.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW).toString()); replacements.put(ChatColor.BOLD, Ansi.ansi().a(Attribute.UNDERLINE_DOUBLE).toString()); replacements.put(ChatColor.STRIKETHROUGH, Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString()); replacements.put(ChatColor.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE).toString()); replacements.put(ChatColor.ITALIC, Ansi.ansi().a(Attribute.ITALIC).toString()); replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).toString()); }
public CraftCustomEntity(CraftServer server, net.minecraft.entity.Entity entity) { super(server, entity); this.entityClass = entity.getClass(); this.entityName = EntityRegistry.getCustomEntityTypeName(entityClass); if (entityName == null) entityName = entity.getCommandSenderName(); }
/** * ItemSpawnEvent */ public static ItemSpawnEvent callItemSpawnEvent(EntityItem entityitem) { org.bukkit.entity.Item entity = (org.bukkit.entity.Item) entityitem.getBukkitEntity(); CraftServer craftServer = (CraftServer) entity.getServer(); ItemSpawnEvent event = new ItemSpawnEvent(entity, entity.getLocation()); craftServer.getPluginManager().callEvent(event); return event; }
private static boolean canBuild(CraftWorld world, Player player, int x, int z) { WorldServer worldServer = world.getHandle(); int spawnSize = Bukkit.getServer().getSpawnRadius(); if (world.getHandle().dimension != 0) return true; if (spawnSize <= 0) return true; if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true; if (player.isOp()) return true; ChunkCoordinates chunkcoordinates = worldServer.getSpawn(); int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z)); return distanceFromSpawn > spawnSize; }
private static boolean canBuild(CraftWorld world, Player player, int x, int z) { WorldServer worldServer = world.getHandle(); int spawnSize = Bukkit.getServer().getSpawnRadius(); if (world.getHandle().dimension != 0) return true; if (spawnSize <= 0) return true; if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true; if (player.isOp()) return true; BlockPosition chunkcoordinates = worldServer.getSpawn(); int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.getX()), Math.abs(z - chunkcoordinates.getY())); return distanceFromSpawn > spawnSize; }
public CraftBlaze(CraftServer server, EntityBlaze entity) { super(server, entity); }
public CraftMinecartChest(CraftServer server, net.minecraft.entity.item.EntityMinecartChest entity) { super(server, entity); inventory = new CraftInventory(entity); }
public CraftEnderSignal(CraftServer server, EntityEnderEye entity) { super(server, entity); }
public CraftSnowman(CraftServer server, net.minecraft.entity.monster.EntitySnowman entity) { super(server, entity); }
public CraftAnimals(CraftServer server, EntityAnimal entity) { super(server, entity); }
public CraftChicken(CraftServer server, EntityChicken entity) { super(server, entity); }
public CraftSmallFireball(CraftServer server, net.minecraft.entity.projectile.EntitySmallFireball entity) { super(server, entity); }
public CraftSlime(CraftServer server, net.minecraft.entity.monster.EntitySlime entity) { super(server, entity); }
public CraftHorse(CraftServer server, EntityHorse entity) { super(server, entity); }
public CraftIronGolem(CraftServer server, net.minecraft.entity.monster.EntityIronGolem entity) { super(server, entity); }
public CraftMinecartRideable(CraftServer server, net.minecraft.entity.item.EntityMinecart entity) { super(server, entity); }
CraftMinecartHopper(CraftServer server, net.minecraft.entity.item.EntityMinecartHopper entity) { super(server, entity); inventory = new CraftInventory(entity); }