geforkt von Mirrors/Paper
Cleanup comments, formatting, etc
By: Travis Watkins <amaranth@ubuntu.com>
Dieser Commit ist enthalten in:
Ursprung
f0a4f87f80
Commit
56947c94a9
@ -228,13 +228,13 @@ public class CraftChunk implements Chunk {
|
||||
if (includeBiomeTempRain) {
|
||||
biomeTemp = new double[256];
|
||||
biomeRain = new double[256];
|
||||
float[] dat = wcm.getTemperatures((float[]) null, getX() << 4, getZ() << 4, 16, 16);
|
||||
float[] dat = wcm.getTemperatures(null, getX() << 4, getZ() << 4, 16, 16);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeTemp[i] = dat[i];
|
||||
}
|
||||
|
||||
dat = wcm.getWetness((float[]) null, getX() << 4, getZ() << 4, 16, 16);
|
||||
dat = wcm.getWetness(null, getX() << 4, getZ() << 4, 16, 16);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeRain[i] = dat[i];
|
||||
@ -264,13 +264,13 @@ public class CraftChunk implements Chunk {
|
||||
if (includeBiomeTempRain) {
|
||||
biomeTemp = new double[256];
|
||||
biomeRain = new double[256];
|
||||
float[] dat = wcm.getTemperatures((float[]) null, x << 4, z << 4, 16, 16);
|
||||
float[] dat = wcm.getTemperatures(null, x << 4, z << 4, 16, 16);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeTemp[i] = dat[i];
|
||||
}
|
||||
|
||||
dat = wcm.getWetness((float[]) null, x << 4, z << 4, 16, 16);
|
||||
dat = wcm.getWetness(null, x << 4, z << 4, 16, 16);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeRain[i] = dat[i];
|
||||
|
@ -723,7 +723,7 @@ public final class CraftServer implements Server {
|
||||
internal.worldMaps = console.worlds.get(0).worldMaps;
|
||||
|
||||
internal.tracker = new EntityTracker(internal); // CraftBukkit
|
||||
internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal));
|
||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
||||
internal.difficulty = 1;
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.worlds.add(internal);
|
||||
@ -795,7 +795,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
if (save) {
|
||||
try {
|
||||
handle.save(true, (IProgressUpdate) null);
|
||||
handle.save(true, null);
|
||||
handle.saveLevel();
|
||||
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
|
||||
getPluginManager().callEvent(event);
|
||||
@ -936,12 +936,12 @@ public final class CraftServer implements Server {
|
||||
|
||||
if (section != null) {
|
||||
for (String key : section.getKeys(false)) {
|
||||
List<String> commands = null;
|
||||
List<String> commands;
|
||||
|
||||
if (section.isList(key)) {
|
||||
commands = section.getStringList(key);
|
||||
} else {
|
||||
commands = ImmutableList.<String>of(section.getString(key));
|
||||
commands = ImmutableList.of(section.getString(key));
|
||||
}
|
||||
|
||||
result.put(key, commands.toArray(new String[commands.size()]));
|
||||
@ -1247,9 +1247,9 @@ public final class CraftServer implements Server {
|
||||
|
||||
public void onPlayerJoin(Player player) {
|
||||
if ((updater.isEnabled()) && (updater.getCurrent() != null) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) {
|
||||
if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(updater.WARN_OPERATORS))) {
|
||||
if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(AutoUpdater.WARN_OPERATORS))) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "The version of CraftBukkit that this server is running is known to be broken. Please consider updating to the latest version at dl.bukkit.org.");
|
||||
} else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(updater.WARN_OPERATORS))) {
|
||||
} else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(AutoUpdater.WARN_OPERATORS))) {
|
||||
player.sendMessage(ChatColor.DARK_PURPLE + "The version of CraftBukkit that this server is running is out of date. Please consider updating to the latest version at dl.bukkit.org.");
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class CraftSound {
|
||||
private static String[] sounds = new String[Sound.values().length];
|
||||
private static final String[] sounds = new String[Sound.values().length];
|
||||
|
||||
static {
|
||||
sounds[AMBIENCE_CAVE.ordinal()] = "ambient.cave.cave";
|
||||
|
@ -244,7 +244,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
world.chunkProviderServer.unloadQueue.remove(x, z);
|
||||
net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));
|
||||
net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));
|
||||
|
||||
if (chunk == null) {
|
||||
chunk = world.chunkProviderServer.loadChunk(x, z);
|
||||
@ -681,7 +681,7 @@ public class CraftWorld implements World {
|
||||
public void setStorm(boolean hasStorm) {
|
||||
CraftServer server = world.getServer();
|
||||
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm);
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(this, hasStorm);
|
||||
server.getPluginManager().callEvent(weather);
|
||||
if (!weather.isCancelled()) {
|
||||
world.worldData.setStorm(hasStorm);
|
||||
@ -711,7 +711,7 @@ public class CraftWorld implements World {
|
||||
if (thundering && !hasStorm()) setStorm(true);
|
||||
CraftServer server = world.getServer();
|
||||
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering);
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(this, thundering);
|
||||
server.getPluginManager().callEvent(thunder);
|
||||
if (!thunder.isCancelled()) {
|
||||
world.worldData.setThundering(thundering);
|
||||
@ -858,7 +858,7 @@ public class CraftWorld implements World {
|
||||
} else {
|
||||
entity = new EntityLargeFireball(world);
|
||||
}
|
||||
((EntityFireball) entity).setPositionRotation(x, y, z, yaw, pitch);
|
||||
entity.setPositionRotation(x, y, z, yaw, pitch);
|
||||
Vector direction = location.getDirection().multiply(10);
|
||||
((EntityFireball) entity).setDirection(direction.getX(), direction.getY(), direction.getZ());
|
||||
}
|
||||
@ -1265,9 +1265,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
ChunkProviderServer cps = world.chunkProviderServer;
|
||||
Iterator<net.minecraft.server.Chunk> iter = cps.chunks.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
net.minecraft.server.Chunk chunk = iter.next();
|
||||
for (net.minecraft.server.Chunk chunk : cps.chunks.values()) {
|
||||
// If in use, skip it
|
||||
if (isChunkInUse(chunk.x, chunk.z)) {
|
||||
continue;
|
||||
|
@ -340,7 +340,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
public int getBlockPower(BlockFace face) {
|
||||
int power = 0;
|
||||
BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE;
|
||||
BlockRedstoneWire wire = net.minecraft.server.Block.REDSTONE_WIRE;
|
||||
net.minecraft.server.World world = chunk.getHandle().world;
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power);
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power);
|
||||
|
@ -115,7 +115,6 @@ public class CraftBlockState implements BlockState {
|
||||
public boolean update(boolean force) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() != this.getType()) {
|
||||
if (force) {
|
||||
block.setTypeId(this.getTypeId());
|
||||
@ -126,7 +125,6 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
block.setData(getRawData());
|
||||
world.getHandle().notify(x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
|
||||
public class CraftBrewingStand extends CraftBlockState implements BrewingStand {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityBrewingStand brewingStand;
|
||||
|
||||
public CraftBrewingStand(Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
brewingStand = (TileEntityBrewingStand) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
brewingStand = (TileEntityBrewingStand) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public BrewerInventory getInventory() {
|
||||
|
@ -9,14 +9,12 @@ import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityMobSpawner spawner;
|
||||
|
||||
public CraftCreatureSpawner(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
spawner = (TileEntityMobSpawner) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -28,7 +28,6 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||
public boolean dispense() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.DISPENSER) {
|
||||
BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER;
|
||||
|
||||
@ -38,7 +37,6 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
|
@ -28,14 +28,12 @@ public class CraftDropper extends CraftBlockState implements Dropper {
|
||||
public void drop() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.DROPPER) {
|
||||
BlockDropper drop = (BlockDropper) net.minecraft.server.Block.DROPPER;
|
||||
|
||||
drop.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
|
@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
|
||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityFurnace furnace;
|
||||
|
||||
public CraftFurnace(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
furnace = (TileEntityFurnace) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
furnace = (TileEntityFurnace) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public FurnaceInventory getInventory() {
|
||||
|
@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CraftHopper extends CraftBlockState implements Hopper {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityHopper hopper;
|
||||
|
||||
public CraftHopper(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
hopper = (TileEntityHopper) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
hopper = (TileEntityHopper) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
|
@ -39,7 +39,6 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
public boolean play() {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
note.play(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
@ -47,12 +46,10 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean play(byte instrument, byte note) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note);
|
||||
return true;
|
||||
@ -60,12 +57,10 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean play(Instrument instrument, Note note) {
|
||||
Block block = getBlock();
|
||||
|
||||
synchronized (block) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
|
||||
return true;
|
||||
@ -73,5 +68,4 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.World;
|
||||
|
||||
class QueuedChunk {
|
||||
long coords;
|
||||
ChunkRegionLoader loader;
|
||||
World world;
|
||||
ChunkProviderServer provider;
|
||||
final long coords;
|
||||
final ChunkRegionLoader loader;
|
||||
final World world;
|
||||
final ChunkProviderServer provider;
|
||||
NBTTagCompound compound;
|
||||
|
||||
public QueuedChunk(long coords, ChunkRegionLoader loader, World world, ChunkProviderServer provider) {
|
||||
|
@ -2,25 +2,24 @@ package org.bukkit.craftbukkit.command;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.fusesource.jansi.Ansi.Attribute;
|
||||
import jline.console.ConsoleReader;
|
||||
import jline.Terminal;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public class ColouredConsoleSender extends CraftConsoleCommandSender {
|
||||
private final ConsoleReader reader;
|
||||
private final Terminal terminal;
|
||||
private final Map<ChatColor, String> replacements = new EnumMap<ChatColor, String>(ChatColor.class);
|
||||
private final ChatColor[] colors = ChatColor.values();
|
||||
|
||||
protected ColouredConsoleSender() {
|
||||
super();
|
||||
this.reader = ((CraftServer) getServer()).getReader();
|
||||
this.terminal = reader.getTerminal();
|
||||
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());
|
||||
|
@ -22,9 +22,6 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
|
||||
public void sendMessage(String message) {
|
||||
}
|
||||
|
||||
public void sendRawMessage(String message) {
|
||||
}
|
||||
|
||||
public void sendMessage(String[] messages) {
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return ((WorldServer) entity.world).getWorld();
|
||||
return entity.world.getWorld();
|
||||
}
|
||||
|
||||
public boolean teleport(Location location) {
|
||||
@ -265,7 +265,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getPassenger() {
|
||||
return isEmpty() ? null : (CraftEntity) getHandle().passenger.getBukkitEntity();
|
||||
return isEmpty() ? null : getHandle().passenger.getBukkitEntity();
|
||||
}
|
||||
|
||||
public boolean setPassenger(org.bukkit.entity.Entity passenger) {
|
||||
|
@ -15,7 +15,7 @@ public class CraftFish extends AbstractProjectile implements Fish {
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (getHandle().owner != null) {
|
||||
return (LivingEntity) getHandle().owner.getBukkitEntity();
|
||||
return getHandle().owner.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -366,7 +366,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// To = Players new Location if Teleport is Successful
|
||||
Location to = location;
|
||||
// Create & Call the Teleport Event.
|
||||
PlayerTeleportEvent event = new PlayerTeleportEvent((Player) this, from, to, cause);
|
||||
PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
// Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
|
||||
|
@ -12,7 +12,7 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (getHandle().getShooter() instanceof EntityLiving) {
|
||||
if (getHandle().getShooter() != null) {
|
||||
return (LivingEntity) getHandle().getShooter().getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class CraftEventFactory {
|
||||
|
||||
ChunkCoordinates chunkcoordinates = worldServer.getSpawn();
|
||||
|
||||
int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
|
||||
int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
|
||||
return distanceFromSpawn >= spawnSize;
|
||||
}
|
||||
|
||||
@ -89,8 +89,8 @@ public class CraftEventFactory {
|
||||
* Block place methods
|
||||
*/
|
||||
public static BlockPlaceEvent callBlockPlaceEvent(World world, EntityHuman who, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
CraftWorld craftWorld = world.getWorld();
|
||||
CraftServer craftServer = world.getServer();
|
||||
|
||||
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
|
||||
|
||||
@ -236,7 +236,7 @@ public class CraftEventFactory {
|
||||
*/
|
||||
public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) {
|
||||
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? (AnimalTamer) tamer.getBukkitEntity() : null);
|
||||
org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null);
|
||||
CraftServer craftServer = (CraftServer) bukkitEntity.getServer();
|
||||
|
||||
entity.persistent = true;
|
||||
@ -267,7 +267,7 @@ public class CraftEventFactory {
|
||||
|
||||
ItemDespawnEvent event = new ItemDespawnEvent(entity, entity.getLocation());
|
||||
|
||||
((CraftServer) entity.getServer()).getPluginManager().callEvent(event);
|
||||
entity.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List<org.bukkit.inventory.ItemStack> drops, String deathMessage) {
|
||||
CraftPlayer entity = (CraftPlayer) victim.getBukkitEntity();
|
||||
CraftPlayer entity = victim.getBukkitEntity();
|
||||
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
|
||||
org.bukkit.World world = entity.getWorld();
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@ -433,7 +433,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static FoodLevelChangeEvent callFoodLevelChangeEvent(EntityHuman entity, int level) {
|
||||
FoodLevelChangeEvent event = new FoodLevelChangeEvent((Player) entity.getBukkitEntity(), level);
|
||||
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entity.getBukkitEntity(), level);
|
||||
entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
@ -498,8 +498,8 @@ public class CraftEventFactory {
|
||||
player.playerConnection.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId));
|
||||
}
|
||||
|
||||
CraftServer server = ((WorldServer) player.world).getServer();
|
||||
CraftPlayer craftPlayer = (CraftPlayer) player.getBukkitEntity();
|
||||
CraftServer server = player.world.getServer();
|
||||
CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||
player.activeContainer.transferTo(container, craftPlayer);
|
||||
|
||||
InventoryOpenEvent event = new InventoryOpenEvent(container.getBukkitView());
|
||||
|
@ -72,7 +72,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||
continue;
|
||||
}
|
||||
byte[] secBlkID = new byte[4096]; // Allocate blk ID bytes
|
||||
byte[] secExtBlkID = (byte[]) null; // Delay getting extended ID nibbles
|
||||
byte[] secExtBlkID = null; // Delay getting extended ID nibbles
|
||||
short[] bdata = xbtypes[sec];
|
||||
// Loop through data, 2 blocks at a time
|
||||
for (int i = 0, j = 0; i < bdata.length; i += 2, j++) {
|
||||
@ -124,7 +124,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||
// Loop through sections
|
||||
for (int sec = 0; sec < scnt; sec++) {
|
||||
ChunkSection cs = null; // Add sections when needed
|
||||
byte[] csbytes = (byte[]) null;
|
||||
byte[] csbytes = null;
|
||||
|
||||
for (int cy = 0; cy < 16; cy++) {
|
||||
int cyoff = cy | (sec << 4);
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.help.HelpTopic;
|
||||
|
||||
public class CommandAliasHelpTopic extends HelpTopic {
|
||||
|
||||
private String aliasFor;
|
||||
private HelpMap helpMap;
|
||||
private final String aliasFor;
|
||||
private final HelpMap helpMap;
|
||||
|
||||
public CommandAliasHelpTopic(String alias, String aliasFor, HelpMap helpMap) {
|
||||
this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor;
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.help.HelpTopic;
|
||||
* This is a help topic implementation for general topics registered in the help.yml file.
|
||||
*/
|
||||
public class CustomHelpTopic extends HelpTopic {
|
||||
|
||||
private final String permissionNode;
|
||||
|
||||
public CustomHelpTopic(String name, String shortText, String fullText, String permissionNode) {
|
||||
|
@ -4,10 +4,10 @@ package org.bukkit.craftbukkit.help;
|
||||
* A HelpTopicAmendment represents the contents of a topic amendment from the help.yml
|
||||
*/
|
||||
public class HelpTopicAmendment {
|
||||
private String topicName;
|
||||
private String shortText;
|
||||
private String fullText;
|
||||
private String permission;
|
||||
private final String topicName;
|
||||
private final String shortText;
|
||||
private final String fullText;
|
||||
private final String permission;
|
||||
|
||||
public HelpTopicAmendment(String topicName, String shortText, String fullText, String permission) {
|
||||
this.fullText = fullText;
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.help.HelpTopic;
|
||||
*/
|
||||
public class MultipleCommandAliasHelpTopic extends HelpTopic {
|
||||
|
||||
private MultipleCommandAlias alias;
|
||||
private final MultipleCommandAlias alias;
|
||||
|
||||
public MultipleCommandAliasHelpTopic(MultipleCommandAlias alias) {
|
||||
this.alias = alias;
|
||||
|
@ -145,7 +145,7 @@ public class SimpleHelpMap implements HelpMap {
|
||||
}
|
||||
|
||||
// Add alias sub-index
|
||||
Collection<HelpTopic> filteredTopics = Collections2.<HelpTopic>filter(helpTopics.values(), Predicates.instanceOf(CommandAliasHelpTopic.class));
|
||||
Collection<HelpTopic> filteredTopics = Collections2.filter(helpTopics.values(), Predicates.instanceOf(CommandAliasHelpTopic.class));
|
||||
if (!filteredTopics.isEmpty()) {
|
||||
addTopic(new IndexHelpTopic("Aliases", "Lists command aliases", null, filteredTopics));
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class CraftInventory implements Inventory {
|
||||
protected IInventory inventory;
|
||||
protected final IInventory inventory;
|
||||
|
||||
public CraftInventory(IInventory inventory) {
|
||||
this.inventory = inventory;
|
||||
|
@ -127,7 +127,7 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage
|
||||
}
|
||||
|
||||
public boolean hasStoredEnchant(Enchantment ench) {
|
||||
return hasStoredEnchants() ? enchantments.containsKey(ench) : false;
|
||||
return hasStoredEnchants() && enchantments.containsKey(ench);
|
||||
}
|
||||
|
||||
public int getStoredEnchantLevel(Enchantment ench) {
|
||||
@ -155,7 +155,7 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage
|
||||
}
|
||||
|
||||
public boolean removeStoredEnchant(Enchantment ench) {
|
||||
return hasStoredEnchants() ? enchantments.remove(ench) != null : false;
|
||||
return hasStoredEnchants() && enchantments.remove(ench) != null;
|
||||
}
|
||||
|
||||
public boolean hasStoredEnchants() {
|
||||
|
@ -303,8 +303,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
||||
}
|
||||
|
||||
NBTTagList tagList = new NBTTagList(key.NBT);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
tagList.add(new NBTTagString("", list.get(i)));
|
||||
for (String value : list) {
|
||||
tagList.add(new NBTTagString("", value));
|
||||
}
|
||||
|
||||
return tagList;
|
||||
@ -370,7 +370,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
||||
}
|
||||
|
||||
public boolean hasEnchant(Enchantment ench) {
|
||||
return hasEnchants() ? enchantments.containsKey(ench) : false;
|
||||
return hasEnchants() && enchantments.containsKey(ench);
|
||||
}
|
||||
|
||||
public int getEnchantLevel(Enchantment ench) {
|
||||
@ -398,7 +398,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
||||
}
|
||||
|
||||
public boolean removeEnchant(Enchantment ench) {
|
||||
return hasEnchants() ? enchantments.remove(ench) != null : false;
|
||||
return hasEnchants() && enchantments.remove(ench) != null;
|
||||
}
|
||||
|
||||
public boolean hasEnchants() {
|
||||
|
@ -10,8 +10,8 @@ import net.minecraft.server.IRecipe;
|
||||
import net.minecraft.server.RecipesFurnace;
|
||||
|
||||
public class RecipeIterator implements Iterator<Recipe> {
|
||||
private Iterator<IRecipe> recipes;
|
||||
private Iterator<Integer> smelting;
|
||||
private final Iterator<IRecipe> recipes;
|
||||
private final Iterator<Integer> smelting;
|
||||
private Iterator<?> removeFrom = null;
|
||||
|
||||
public RecipeIterator() {
|
||||
@ -35,8 +35,8 @@ public class RecipeIterator implements Iterator<Recipe> {
|
||||
removeFrom = smelting;
|
||||
int id = smelting.next();
|
||||
CraftItemStack stack = CraftItemStack.asCraftMirror(RecipesFurnace.getInstance().getResult(id));
|
||||
CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1));
|
||||
return recipe;
|
||||
|
||||
return new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class CraftMapRenderer extends MapRenderer {
|
||||
}
|
||||
|
||||
WorldMapDecoration decoration = (WorldMapDecoration) worldMap.g.get(key);
|
||||
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), (byte) (decoration.type));
|
||||
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), decoration.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
public class BlockMetadataStore extends MetadataStoreBase<Block> implements MetadataStore<Block> {
|
||||
|
||||
private World owningWorld;
|
||||
private final World owningWorld;
|
||||
|
||||
/**
|
||||
* Initializes a BlockMetadataStore.
|
||||
|
@ -77,9 +77,8 @@ public class BukkitDLUpdaterService {
|
||||
connection.setRequestProperty("User-Agent", getUserAgent());
|
||||
reader = new InputStreamReader(connection.getInputStream());
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, dateDeserializer).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
|
||||
ArtifactDetails.ChannelDetails fromJson = gson.fromJson(reader, ArtifactDetails.ChannelDetails.class);
|
||||
|
||||
return fromJson;
|
||||
return gson.fromJson(reader, ArtifactDetails.ChannelDetails.class);
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren