Java 类org.bukkit.craftbukkit.CraftServer 实例源码

项目:Uranium    文件:SimpleHelpMap.java   
@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());
}
项目:Uranium    文件:VanillaCommandWrapper.java   
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;
}
项目:ThermosRebased    文件:CraftFirework.java   
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);
    }
}
项目:ThermosRebased    文件:SimpleHelpMap.java   
@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());
}
项目:ThermosRebased    文件:VanillaCommandWrapper.java   
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;
}
项目:KCauldron    文件:SimpleHelpMap.java   
@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());
}
项目:CauldronGit    文件:VanillaCommandWrapper.java   
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;
}
项目:CraftBukkit    文件:VanillaCommandWrapper.java   
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;
}
项目:Uranium    文件:CraftLivingEntity.java   
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);
    }
}
项目:Uranium    文件:CraftEventFactory.java   
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;
}
项目:Uranium    文件:CraftEventFactory.java   
/**
 * 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;
}
项目:Uranium    文件:CraftEventFactory.java   
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;
}
项目:Uranium    文件:ColouredConsoleSender.java   
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());
}
项目:Uranium    文件:CraftCustomEntity.java   
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();
}
项目:ThermosRebased    文件:CraftLivingEntity.java   
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);
    }
}
项目:ThermosRebased    文件:CraftEventFactory.java   
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;
}
项目:ThermosRebased    文件:CraftEventFactory.java   
/**
 * 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;
}
项目:ThermosRebased    文件:CraftEventFactory.java   
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;
}
项目:ThermosRebased    文件:ColouredConsoleSender.java   
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());
}
项目:ThermosRebased    文件:CraftCustomEntity.java   
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();
}
项目:CraftBukkit    文件:CraftEventFactory.java   
/**
 * 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;
}
项目:Cauldron-Old    文件:CraftEventFactory.java   
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;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
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;
}
项目:CauldronGit    文件:CraftLivingEntity.java   
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);
    }
}
项目:CauldronGit    文件:CraftCustomEntity.java   
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();
}
项目:Cauldron-Old    文件:CraftEventFactory.java   
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;
}
项目:Cauldron-Reloaded    文件:CraftEventFactory.java   
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;
}
项目:Craftbukkit    文件:CraftEventFactory.java   
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;
}
项目:Uranium    文件:CraftBlaze.java   
public CraftBlaze(CraftServer server, EntityBlaze entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftMinecartChest.java   
public CraftMinecartChest(CraftServer server, net.minecraft.entity.item.EntityMinecartChest entity) {
    super(server, entity);
    inventory = new CraftInventory(entity);
}
项目:Uranium    文件:CraftEnderSignal.java   
public CraftEnderSignal(CraftServer server, EntityEnderEye entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftSnowman.java   
public CraftSnowman(CraftServer server, net.minecraft.entity.monster.EntitySnowman entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftAnimals.java   
public CraftAnimals(CraftServer server, EntityAnimal entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftChicken.java   
public CraftChicken(CraftServer server, EntityChicken entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftSmallFireball.java   
public CraftSmallFireball(CraftServer server, net.minecraft.entity.projectile.EntitySmallFireball entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftSlime.java   
public CraftSlime(CraftServer server, net.minecraft.entity.monster.EntitySlime entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftHorse.java   
public CraftHorse(CraftServer server, EntityHorse entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftIronGolem.java   
public CraftIronGolem(CraftServer server, net.minecraft.entity.monster.EntityIronGolem entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftMinecartRideable.java   
public CraftMinecartRideable(CraftServer server, net.minecraft.entity.item.EntityMinecart entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftMinecartHopper.java   
CraftMinecartHopper(CraftServer server, net.minecraft.entity.item.EntityMinecartHopper entity) {
    super(server, entity);
    inventory = new CraftInventory(entity);
}