From e3df3d5cda4fcf6d0daacab5ff4da240cc5c9791 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 28 Apr 2019 11:38:01 +1000 Subject: [PATCH] Add Override annotations where appropriate --- .../org/bukkit/craftbukkit/CraftChunk.java | 13 ++ .../craftbukkit/CraftChunkSnapshot.java | 10 ++ .../bukkit/craftbukkit/CraftCrashReport.java | 1 + .../craftbukkit/CraftOfflinePlayer.java | 14 +++ .../org/bukkit/craftbukkit/CraftServer.java | 1 + .../org/bukkit/craftbukkit/CraftWorld.java | 114 ++++++++++++++++++ .../bukkit/craftbukkit/block/CraftBlock.java | 39 ++++++ .../craftbukkit/block/CraftBlockState.java | 22 ++++ .../command/ConsoleCommandCompleter.java | 1 + .../command/CraftBlockCommandSender.java | 6 + .../command/CraftConsoleCommandSender.java | 11 ++ .../command/ServerCommandSender.java | 12 ++ .../entity/AbstractProjectile.java | 2 + .../entity/CraftAbstractHorse.java | 7 ++ .../craftbukkit/entity/CraftAgeable.java | 9 ++ .../craftbukkit/entity/CraftAmbient.java | 1 + .../entity/CraftAreaEffectCloud.java | 2 + .../bukkit/craftbukkit/entity/CraftArrow.java | 7 ++ .../bukkit/craftbukkit/entity/CraftBat.java | 1 + .../bukkit/craftbukkit/entity/CraftBlaze.java | 1 + .../bukkit/craftbukkit/entity/CraftBoat.java | 9 ++ .../craftbukkit/entity/CraftCaveSpider.java | 1 + .../craftbukkit/entity/CraftChicken.java | 1 + .../craftbukkit/entity/CraftComplexPart.java | 2 + .../bukkit/craftbukkit/entity/CraftCow.java | 1 + .../craftbukkit/entity/CraftCreeper.java | 3 + .../bukkit/craftbukkit/entity/CraftEgg.java | 1 + .../craftbukkit/entity/CraftEnderCrystal.java | 1 + .../craftbukkit/entity/CraftEnderDragon.java | 2 + .../entity/CraftEnderDragonPart.java | 7 ++ .../craftbukkit/entity/CraftEnderPearl.java | 1 + .../craftbukkit/entity/CraftEnderman.java | 3 + .../craftbukkit/entity/CraftEntity.java | 37 ++++++ .../entity/CraftExperienceOrb.java | 3 + .../craftbukkit/entity/CraftFallingBlock.java | 5 + .../craftbukkit/entity/CraftFireball.java | 9 ++ .../craftbukkit/entity/CraftFishHook.java | 5 + .../bukkit/craftbukkit/entity/CraftGhast.java | 1 + .../bukkit/craftbukkit/entity/CraftGiant.java | 1 + .../craftbukkit/entity/CraftHanging.java | 5 + .../craftbukkit/entity/CraftHumanEntity.java | 34 ++++++ .../craftbukkit/entity/CraftIronGolem.java | 2 + .../bukkit/craftbukkit/entity/CraftItem.java | 5 + .../craftbukkit/entity/CraftItemFrame.java | 6 + .../entity/CraftLargeFireball.java | 1 + .../bukkit/craftbukkit/entity/CraftLeash.java | 1 + .../entity/CraftLightningStrike.java | 2 + .../craftbukkit/entity/CraftLivingEntity.java | 42 +++++++ .../craftbukkit/entity/CraftMagmaCube.java | 2 + .../craftbukkit/entity/CraftMinecart.java | 14 +++ .../entity/CraftMinecartChest.java | 2 + .../entity/CraftMinecartFurnace.java | 1 + .../entity/CraftMinecartHopper.java | 2 + .../entity/CraftMinecartMobSpawner.java | 1 + .../entity/CraftMinecartRideable.java | 1 + .../craftbukkit/entity/CraftMinecartTNT.java | 1 + .../craftbukkit/entity/CraftOcelot.java | 2 + .../craftbukkit/entity/CraftPainting.java | 5 + .../bukkit/craftbukkit/entity/CraftPig.java | 4 + .../craftbukkit/entity/CraftPigZombie.java | 5 + .../craftbukkit/entity/CraftPlayer.java | 2 + .../craftbukkit/entity/CraftProjectile.java | 2 + .../bukkit/craftbukkit/entity/CraftSheep.java | 5 + .../craftbukkit/entity/CraftSilverfish.java | 1 + .../craftbukkit/entity/CraftSkeleton.java | 1 + .../bukkit/craftbukkit/entity/CraftSlime.java | 3 + .../entity/CraftSmallFireball.java | 1 + .../craftbukkit/entity/CraftSnowball.java | 1 + .../craftbukkit/entity/CraftSnowman.java | 1 + .../craftbukkit/entity/CraftSpider.java | 1 + .../bukkit/craftbukkit/entity/CraftSquid.java | 1 + .../craftbukkit/entity/CraftTNTPrimed.java | 8 ++ .../entity/CraftTameableAnimal.java | 4 + .../entity/CraftThrownExpBottle.java | 1 + .../craftbukkit/entity/CraftThrownPotion.java | 2 + .../craftbukkit/entity/CraftVillager.java | 3 + .../bukkit/craftbukkit/entity/CraftWitch.java | 1 + .../craftbukkit/entity/CraftWither.java | 1 + .../craftbukkit/entity/CraftWitherSkull.java | 1 + .../bukkit/craftbukkit/entity/CraftWolf.java | 4 + .../craftbukkit/entity/CraftZombie.java | 4 + .../craftbukkit/help/CustomHelpTopic.java | 1 + .../help/MultipleCommandAliasHelpTopic.java | 1 + .../MultipleCommandAliasHelpTopicFactory.java | 1 + .../craftbukkit/help/SimpleHelpMap.java | 7 ++ .../inventory/CraftEntityEquipment.java | 20 +++ .../craftbukkit/inventory/CraftInventory.java | 28 +++++ .../inventory/CraftInventoryBeacon.java | 2 + .../inventory/CraftInventoryBrewer.java | 2 + .../inventory/CraftInventoryCrafting.java | 5 + .../inventory/CraftInventoryCustom.java | 15 +++ .../inventory/CraftInventoryDoubleChest.java | 2 + .../inventory/CraftInventoryFurnace.java | 6 + .../inventory/CraftInventoryHorse.java | 2 + .../inventory/CraftInventoryPlayer.java | 19 +++ .../inventory/CraftItemFactory.java | 7 ++ .../craftbukkit/inventory/CraftMetaBook.java | 15 +++ .../inventory/CraftMetaEnchantedBook.java | 7 ++ .../inventory/CraftMetaFirework.java | 10 ++ .../craftbukkit/inventory/CraftMetaItem.java | 18 +++ .../inventory/CraftMetaKnowledgeBook.java | 1 + .../inventory/CraftMetaLeatherArmor.java | 2 + .../craftbukkit/inventory/CraftMetaMap.java | 3 + .../inventory/CraftMetaPotion.java | 7 ++ .../craftbukkit/inventory/CraftMetaSkull.java | 3 + .../CraftMetaTropicalFishBucket.java | 1 + .../inventory/CraftShapedRecipe.java | 1 + .../inventory/CraftShapelessRecipe.java | 1 + .../inventory/InventoryIterator.java | 9 ++ .../craftbukkit/inventory/RecipeIterator.java | 3 + .../craftbukkit/map/CraftMapCanvas.java | 8 ++ .../bukkit/craftbukkit/map/CraftMapView.java | 12 ++ .../craftbukkit/potion/CraftPotionBrewer.java | 1 + .../craftbukkit/scheduler/CraftAsyncTask.java | 4 + .../craftbukkit/scheduler/CraftFuture.java | 5 + .../craftbukkit/scheduler/CraftScheduler.java | 3 + .../scoreboard/CraftObjective.java | 9 ++ .../craftbukkit/scoreboard/CraftScore.java | 6 + .../scoreboard/CraftScoreboard.java | 16 +++ .../scoreboard/CraftScoreboardManager.java | 2 + .../craftbukkit/scoreboard/CraftTeam.java | 21 ++++ .../craftbukkit/util/DatFileFilter.java | 1 + .../bukkit/craftbukkit/util/LazyHashSet.java | 13 ++ .../util/TerminalConsoleWriterThread.java | 1 + .../bukkit/craftbukkit/util/UnsafeList.java | 16 +++ .../org/bukkit/craftbukkit/util/Waitable.java | 1 + .../craftbukkit/util/WeakCollection.java | 16 +++ .../ItemMetaImplementationOverrideTest.java | 2 + .../inventory/ItemStackBookTest.java | 20 +++ .../ItemStackEnchantStorageTest.java | 8 ++ .../ItemStackFireworkChargeTest.java | 10 ++ .../inventory/ItemStackFireworkTest.java | 16 +++ .../inventory/ItemStackLeatherTest.java | 6 + .../ItemStackLoreEnchantmentTest.java | 30 +++++ .../inventory/ItemStackMapTest.java | 10 ++ .../inventory/ItemStackPotionsTest.java | 12 ++ .../inventory/ItemStackSkullTest.java | 6 + .../craftbukkit/inventory/ItemStackTest.java | 4 + .../java/org/bukkit/support/DummyServer.java | 8 ++ .../java/org/bukkit/support/Matchers.java | 2 + 140 files changed, 1021 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index c9380a3f14..404f51e140 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -44,6 +44,7 @@ public class CraftChunk implements Chunk { z = getHandle().getPos().z; } + @Override public World getWorld() { return worldServer.getWorld(); } @@ -68,10 +69,12 @@ public class CraftChunk implements Chunk { weakChunk.clear(); } + @Override public int getX() { return x; } + @Override public int getZ() { return z; } @@ -81,12 +84,14 @@ public class CraftChunk implements Chunk { return "CraftChunk{" + "x=" + getX() + "z=" + getZ() + '}'; } + @Override public Block getBlock(int x, int y, int z) { validateChunkCoordinates(x, y, z); return new CraftBlock(worldServer, new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z)); } + @Override public Entity[] getEntities() { int count = 0, index = 0; net.minecraft.server.Chunk chunk = getHandle(); @@ -111,6 +116,7 @@ public class CraftChunk implements Chunk { return entities; } + @Override public BlockState[] getTileEntities() { int index = 0; net.minecraft.server.Chunk chunk = getHandle(); @@ -129,18 +135,22 @@ public class CraftChunk implements Chunk { return entities; } + @Override public boolean isLoaded() { return getWorld().isChunkLoaded(this); } + @Override public boolean load() { return getWorld().loadChunk(getX(), getZ(), true); } + @Override public boolean load(boolean generate) { return getWorld().loadChunk(getX(), getZ(), generate); } + @Override public boolean unload() { return getWorld().unloadChunk(getX(), getZ()); } @@ -151,6 +161,7 @@ public class CraftChunk implements Chunk { return SeededRandom.a(getX(), getZ(), getWorld().getSeed(), 987234911L).nextInt(10) == 0; } + @Override public boolean unload(boolean save) { return getWorld().unloadChunk(getX(), getZ(), save); } @@ -165,10 +176,12 @@ public class CraftChunk implements Chunk { getWorld().setChunkForceLoaded(getX(), getZ(), forced); } + @Override public ChunkSnapshot getChunkSnapshot() { return getChunkSnapshot(true, false, false); } + @Override public ChunkSnapshot getChunkSnapshot(boolean includeMaxBlockY, boolean includeBiome, boolean includeBiomeTempRain) { net.minecraft.server.Chunk chunk = getHandle(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index 2815a76e7a..7f8434df0d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -42,14 +42,17 @@ public class CraftChunkSnapshot implements ChunkSnapshot { this.biomeTemp = biomeTemp; } + @Override public int getX() { return x; } + @Override public int getZ() { return z; } + @Override public String getWorldName() { return worldname; } @@ -75,6 +78,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z)); } + @Override public final int getBlockSkyLight(int x, int y, int z) { CraftChunk.validateChunkCoordinates(x, y, z); @@ -82,6 +86,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { return (skylight[y >> 4][off] >> ((x & 1) << 2)) & 0xF; } + @Override public final int getBlockEmittedLight(int x, int y, int z) { CraftChunk.validateChunkCoordinates(x, y, z); @@ -89,28 +94,33 @@ public class CraftChunkSnapshot implements ChunkSnapshot { return (emitlight[y >> 4][off] >> ((x & 1) << 2)) & 0xF; } + @Override public final int getHighestBlockYAt(int x, int z) { CraftChunk.validateChunkCoordinates(x, 0, z); return hmap.a(x, z); } + @Override public final Biome getBiome(int x, int z) { CraftChunk.validateChunkCoordinates(x, 0, z); return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]); } + @Override public final double getRawBiomeTemperature(int x, int z) { CraftChunk.validateChunkCoordinates(x, 0, z); return biomeTemp[z << 4 | x]; } + @Override public final long getCaptureFullTime() { return captureFulltime; } + @Override public final boolean isSectionEmpty(int sy) { return empty[sy]; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java index 2e89af053d..21c21e102b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java @@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginDescriptionFile; public class CraftCrashReport implements CrashReportCallable { + @Override public Object call() throws Exception { StringWriter value = new StringWriter(); try { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index 24b06a0b7e..6a448c02ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -38,10 +38,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return profile; } + @Override public boolean isOnline() { return getPlayer() != null; } + @Override public String getName() { Player player = getPlayer(); if (player != null) { @@ -64,6 +66,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return null; } + @Override public UUID getUniqueId() { return profile.getId(); } @@ -72,10 +75,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return server; } + @Override public boolean isOp() { return server.getHandle().isOp(profile); } + @Override public void setOp(boolean value) { if (value == isOp()) { return; @@ -88,6 +93,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } } + @Override public boolean isBanned() { if (getName() == null) { return false; @@ -108,10 +114,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } } + @Override public boolean isWhitelisted() { return server.getHandle().getWhitelist().isWhitelisted(profile); } + @Override public void setWhitelisted(boolean value) { if (value) { server.getHandle().getWhitelist().add(new WhiteListEntry(profile)); @@ -120,6 +128,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } } + @Override public Map serialize() { Map result = new LinkedHashMap(); @@ -142,6 +151,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return getClass().getSimpleName() + "[UUID=" + profile.getId() + "]"; } + @Override public Player getPlayer() { return server.getPlayer(getUniqueId()); } @@ -188,6 +198,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return new File(storage.getPlayerDir(), getUniqueId() + ".dat"); } + @Override public long getFirstPlayed() { Player player = getPlayer(); if (player != null) return player.getFirstPlayed(); @@ -206,6 +217,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } } + @Override public long getLastPlayed() { Player player = getPlayer(); if (player != null) return player.getLastPlayed(); @@ -224,10 +236,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } } + @Override public boolean hasPlayedBefore() { return getData() != null; } + @Override public Location getBedSpawnLocation() { NBTTagCompound data = getData(); if (data == null) return null; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 594ee255c7..88a24de2d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1847,6 +1847,7 @@ public final class CraftServer implements Server { } } + @Override public LootTable getLootTable(NamespacedKey key) { Validate.notNull(key, "NamespacedKey cannot be null"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 8550f9b710..d74c8a26a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -273,10 +273,12 @@ public class CraftWorld implements World { environment = env; } + @Override public Block getBlockAt(int x, int y, int z) { return CraftBlock.at(world, new BlockPosition(x, y, z)); } + @Override public int getHighestBlockYAt(int x, int z) { if (!isChunkLoaded(x >> 4, z >> 4)) { getChunkAt(x >> 4, z >> 4); // Transient load for this tick @@ -285,6 +287,7 @@ public class CraftWorld implements World { return world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(x, 0, z)).getY(); } + @Override public Location getSpawnLocation() { BlockPosition spawn = world.getSpawn(); return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ()); @@ -297,6 +300,7 @@ public class CraftWorld implements World { return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()) : false; } + @Override public boolean setSpawnLocation(int x, int y, int z) { try { Location previousLocation = getSpawnLocation(); @@ -312,14 +316,17 @@ public class CraftWorld implements World { } } + @Override public Chunk getChunkAt(int x, int z) { return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk; } + @Override public Chunk getChunkAt(Block block) { return getChunkAt(block.getX() >> 4, block.getZ() >> 4); } + @Override public boolean isChunkLoaded(int x, int z) { net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false); return chunk != null && chunk.loaded; @@ -334,28 +341,34 @@ public class CraftWorld implements World { } } + @Override public Chunk[] getLoadedChunks() { Long2ObjectLinkedOpenHashMap chunks = world.getChunkProvider().playerChunkMap.visibleChunks; return chunks.values().stream().map(PlayerChunk::getChunk).filter(Objects::nonNull).filter((chunk) -> chunk.loaded).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new); } + @Override public void loadChunk(int x, int z) { loadChunk(x, z, true); } + @Override public boolean unloadChunk(Chunk chunk) { return unloadChunk(chunk.getX(), chunk.getZ()); } + @Override public boolean unloadChunk(int x, int z) { return unloadChunk(x, z, true); } + @Override public boolean unloadChunk(int x, int z, boolean save) { return unloadChunk0(x, z, save); } + @Override public boolean unloadChunkRequest(int x, int z) { net.minecraft.server.IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, false); if (chunk != null) { @@ -378,6 +391,7 @@ public class CraftWorld implements World { return !isChunkLoaded(x, z); } + @Override public boolean regenerateChunk(int x, int z) { throw new UnsupportedOperationException("Not supported in this Minecraft version! Unless you can fix it, this is not a bug :)"); /* @@ -402,6 +416,7 @@ public class CraftWorld implements World { */ } + @Override public boolean refreshChunk(int x, int z) { if (!isChunkLoaded(x, z)) { return false; @@ -422,10 +437,12 @@ public class CraftWorld implements World { return true; } + @Override public boolean isChunkInUse(int x, int z) { return isChunkLoaded(x, z); } + @Override public boolean loadChunk(int x, int z, boolean generate) { IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); @@ -443,10 +460,12 @@ public class CraftWorld implements World { return false; } + @Override public boolean isChunkLoaded(Chunk chunk) { return isChunkLoaded(chunk.getX(), chunk.getZ()); } + @Override public void loadChunk(Chunk chunk) { loadChunk(chunk.getX(), chunk.getZ()); ((CraftChunk) getChunkAt(chunk.getX(), chunk.getZ())).getHandle().bukkitChunk = chunk; @@ -477,6 +496,7 @@ public class CraftWorld implements World { return world; } + @Override public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) { Validate.notNull(item, "Cannot drop a Null item."); EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), CraftItemStack.asNMSCopy(item)); @@ -487,6 +507,7 @@ public class CraftWorld implements World { return new CraftItem(world.getServer(), entity); } + @Override public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { double xs = (world.random.nextFloat() * 0.5F) + 0.25D; double ys = (world.random.nextFloat() * 0.5F) + 0.25D; @@ -498,10 +519,12 @@ public class CraftWorld implements World { return dropItem(loc, item); } + @Override public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) { return spawnArrow(loc, velocity, speed, spread, Arrow.class); } + @Override public T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class clazz) { Validate.notNull(loc, "Can not spawn arrow with a null location"); Validate.notNull(velocity, "Can not spawn arrow with a null velocity"); @@ -525,22 +548,26 @@ public class CraftWorld implements World { return (T) arrow.getBukkitEntity(); } + @Override public Entity spawnEntity(Location loc, EntityType entityType) { return spawn(loc, entityType.getEntityClass()); } + @Override public LightningStrike strikeLightning(Location loc) { EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), false); world.strikeLightning(lightning); return new CraftLightningStrike(server, lightning); } + @Override public LightningStrike strikeLightningEffect(Location loc) { EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true); world.strikeLightning(lightning); return new CraftLightningStrike(server, lightning); } + @Override public boolean generateTree(Location loc, TreeType type) { BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -603,6 +630,7 @@ public class CraftWorld implements World { return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, new WorldGenFeatureEmptyConfiguration()); } + @Override public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { world.captureTreeGeneration = true; world.captureBlockStates = true; @@ -626,6 +654,7 @@ public class CraftWorld implements World { } } + @Override public String getName() { return world.worldData.getName(); } @@ -635,6 +664,7 @@ public class CraftWorld implements World { return world.worldData.getSeed(); } + @Override public UUID getUID() { return world.getDataManager().getUUID(); } @@ -644,22 +674,26 @@ public class CraftWorld implements World { return "CraftWorld{name=" + getName() + '}'; } + @Override public long getTime() { long time = getFullTime() % 24000; if (time < 0) time += 24000; return time; } + @Override public void setTime(long time) { long margin = (time - getFullTime()) % 24000; if (margin < 0) margin += 24000; setFullTime(getFullTime() + margin); } + @Override public long getFullTime() { return world.getDayTime(); } + @Override public void setFullTime(long time) { world.setDayTime(time); @@ -672,26 +706,32 @@ public class CraftWorld implements World { } } + @Override public boolean createExplosion(double x, double y, double z, float power) { return createExplosion(x, y, z, power, false, true); } + @Override public boolean createExplosion(double x, double y, double z, float power, boolean setFire) { return createExplosion(x, y, z, power, setFire, true); } + @Override public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) { return !world.createExplosion(null, x, y, z, power, setFire, breakBlocks ? Explosion.Effect.BREAK : Explosion.Effect.NONE).wasCanceled; } + @Override public boolean createExplosion(Location loc, float power) { return createExplosion(loc, power, false); } + @Override public boolean createExplosion(Location loc, float power, boolean setFire) { return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire); } + @Override public Environment getEnvironment() { return environment; } @@ -713,38 +753,47 @@ public class CraftWorld implements World { } } + @Override public Block getBlockAt(Location location) { return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()); } + @Override public int getHighestBlockYAt(Location location) { return getHighestBlockYAt(location.getBlockX(), location.getBlockZ()); } + @Override public Chunk getChunkAt(Location location) { return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4); } + @Override public ChunkGenerator getGenerator() { return generator; } + @Override public List getPopulators() { return populators; } + @Override public Block getHighestBlockAt(int x, int z) { return getBlockAt(x, getHighestBlockYAt(x, z), z); } + @Override public Block getHighestBlockAt(Location location) { return getHighestBlockAt(location.getBlockX(), location.getBlockZ()); } + @Override public Biome getBiome(int x, int z) { return CraftBlock.biomeBaseToBiome(this.world.getBiome(new BlockPosition(x, 0, z))); } + @Override public void setBiome(int x, int z, Biome bio) { BiomeBase bb = CraftBlock.biomeToBiomeBase(bio); if (this.world.isLoaded(new BlockPosition(x, 0, z))) { @@ -759,14 +808,17 @@ public class CraftWorld implements World { } } + @Override public double getTemperature(int x, int z) { return this.world.getBiome(new BlockPosition(x, 0, z)).getTemperature(); } + @Override public double getHumidity(int x, int z) { return this.world.getBiome(new BlockPosition(x, 0, z)).getHumidity(); } + @Override public List getEntities() { List list = new ArrayList(); @@ -785,6 +837,7 @@ public class CraftWorld implements World { return list; } + @Override public List getLivingEntities() { List list = new ArrayList(); @@ -803,12 +856,14 @@ public class CraftWorld implements World { return list; } + @Override @SuppressWarnings("unchecked") @Deprecated public Collection getEntitiesByClass(Class... classes) { return (Collection)getEntitiesByClasses(classes); } + @Override @SuppressWarnings("unchecked") public Collection getEntitiesByClass(Class clazz) { Collection list = new ArrayList(); @@ -832,6 +887,7 @@ public class CraftWorld implements World { return list; } + @Override public Collection getEntitiesByClasses(Class... classes) { Collection list = new ArrayList(); @@ -1015,6 +1071,7 @@ public class CraftWorld implements World { return blockHit; } + @Override public List getPlayers() { List list = new ArrayList(world.getPlayers().size()); @@ -1029,6 +1086,7 @@ public class CraftWorld implements World { return list; } + @Override public void save() { this.server.checkSaveState(); try { @@ -1043,18 +1101,22 @@ public class CraftWorld implements World { } } + @Override public boolean isAutoSave() { return !world.savingDisabled; } + @Override public void setAutoSave(boolean value) { world.savingDisabled = !value; } + @Override public void setDifficulty(Difficulty difficulty) { this.getHandle().worldData.setDifficulty(EnumDifficulty.getById(difficulty.getValue())); } + @Override public Difficulty getDifficulty() { return Difficulty.getByValue(this.getHandle().getDifficulty().ordinal()); } @@ -1063,48 +1125,59 @@ public class CraftWorld implements World { return blockMetadata; } + @Override public boolean hasStorm() { return world.worldData.hasStorm(); } + @Override public void setStorm(boolean hasStorm) { world.worldData.setStorm(hasStorm); setWeatherDuration(0); // Reset weather duration (legacy behaviour) } + @Override public int getWeatherDuration() { return world.worldData.getWeatherDuration(); } + @Override public void setWeatherDuration(int duration) { world.worldData.setWeatherDuration(duration); } + @Override public boolean isThundering() { return world.worldData.isThundering(); } + @Override public void setThundering(boolean thundering) { world.worldData.setThundering(thundering); setThunderDuration(0); // Reset weather duration (legacy behaviour) } + @Override public int getThunderDuration() { return world.worldData.getThunderDuration(); } + @Override public void setThunderDuration(int duration) { world.worldData.setThunderDuration(duration); } + @Override public long getSeed() { return world.worldData.getSeed(); } + @Override public boolean getPVP() { return world.pvpMode; } + @Override public void setPVP(boolean pvp) { world.pvpMode = pvp; } @@ -1113,14 +1186,17 @@ public class CraftWorld implements World { playEffect(player.getLocation(), effect, data, 0); } + @Override public void playEffect(Location location, Effect effect, int data) { playEffect(location, effect, data, 64); } + @Override public void playEffect(Location loc, Effect effect, T data) { playEffect(loc, effect, data, 64); } + @Override public void playEffect(Location loc, Effect effect, T data, int radius) { if (data != null) { Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!"); @@ -1132,6 +1208,7 @@ public class CraftWorld implements World { playEffect(loc, effect, datavalue, radius); } + @Override public void playEffect(Location location, Effect effect, int data, int radius) { Validate.notNull(location, "Location cannot be null"); Validate.notNull(effect, "Effect cannot be null"); @@ -1152,6 +1229,7 @@ public class CraftWorld implements World { } } + @Override public T spawn(Location location, Class clazz) throws IllegalArgumentException { return spawn(location, clazz, null, SpawnReason.CUSTOM); } @@ -1167,6 +1245,7 @@ public class CraftWorld implements World { return spawnFallingBlock(location, data.getItemType(), data.getData()); } + @Override public FallingBlock spawnFallingBlock(Location location, org.bukkit.Material material, byte data) throws IllegalArgumentException { Validate.notNull(location, "Location cannot be null"); Validate.notNull(material, "Material cannot be null"); @@ -1558,34 +1637,42 @@ public class CraftWorld implements World { return addEntity(entity, reason, function); } + @Override public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) { return CraftChunk.getEmptyChunkSnapshot(x, z, this, includeBiome, includeBiomeTempRain); } + @Override public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) { world.setSpawnFlags(allowMonsters, allowAnimals); } + @Override public boolean getAllowAnimals() { return world.getChunkProvider().allowAnimals; } + @Override public boolean getAllowMonsters() { return world.getChunkProvider().allowMonsters; } + @Override public int getMaxHeight() { return world.getHeight(); } + @Override public int getSeaLevel() { return world.getSeaLevel(); } + @Override public boolean getKeepSpawnInMemory() { return world.keepSpawnInMemory; } + @Override public void setKeepSpawnInMemory(boolean keepLoaded) { world.keepSpawnInMemory = keepLoaded; // Grab the worlds spawn chunk @@ -1625,10 +1712,12 @@ public class CraftWorld implements World { return this.getUID() == other.getUID(); } + @Override public File getWorldFolder() { return ((WorldNBTStorage) world.getDataManager()).getDirectory(); } + @Override public void sendPluginMessage(Plugin source, String channel, byte[] message) { StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message); @@ -1637,6 +1726,7 @@ public class CraftWorld implements World { } } + @Override public Set getListeningPluginChannels() { Set result = new HashSet(); @@ -1647,46 +1737,57 @@ public class CraftWorld implements World { return result; } + @Override public org.bukkit.WorldType getWorldType() { return org.bukkit.WorldType.getByName(world.getWorldData().getType().name()); } + @Override public boolean canGenerateStructures() { return world.getWorldData().shouldGenerateMapFeatures(); } + @Override public long getTicksPerAnimalSpawns() { return world.ticksPerAnimalSpawns; } + @Override public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) { world.ticksPerAnimalSpawns = ticksPerAnimalSpawns; } + @Override public long getTicksPerMonsterSpawns() { return world.ticksPerMonsterSpawns; } + @Override public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) { world.ticksPerMonsterSpawns = ticksPerMonsterSpawns; } + @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { server.getWorldMetadata().setMetadata(this, metadataKey, newMetadataValue); } + @Override public List getMetadata(String metadataKey) { return server.getWorldMetadata().getMetadata(this, metadataKey); } + @Override public boolean hasMetadata(String metadataKey) { return server.getWorldMetadata().hasMetadata(this, metadataKey); } + @Override public void removeMetadata(String metadataKey, Plugin owningPlugin) { server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin); } + @Override public int getMonsterSpawnLimit() { if (monsterSpawn < 0) { return server.getMonsterSpawnLimit(); @@ -1695,10 +1796,12 @@ public class CraftWorld implements World { return monsterSpawn; } + @Override public void setMonsterSpawnLimit(int limit) { monsterSpawn = limit; } + @Override public int getAnimalSpawnLimit() { if (animalSpawn < 0) { return server.getAnimalSpawnLimit(); @@ -1707,10 +1810,12 @@ public class CraftWorld implements World { return animalSpawn; } + @Override public void setAnimalSpawnLimit(int limit) { animalSpawn = limit; } + @Override public int getWaterAnimalSpawnLimit() { if (waterAnimalSpawn < 0) { return server.getWaterAnimalSpawnLimit(); @@ -1719,10 +1824,12 @@ public class CraftWorld implements World { return waterAnimalSpawn; } + @Override public void setWaterAnimalSpawnLimit(int limit) { waterAnimalSpawn = limit; } + @Override public int getAmbientSpawnLimit() { if (ambientSpawn < 0) { return server.getAmbientSpawnLimit(); @@ -1731,14 +1838,17 @@ public class CraftWorld implements World { return ambientSpawn; } + @Override public void setAmbientSpawnLimit(int limit) { ambientSpawn = limit; } + @Override public void playSound(Location loc, Sound sound, float volume, float pitch) { playSound(loc, sound, org.bukkit.SoundCategory.MASTER, volume, pitch); } + @Override public void playSound(Location loc, String sound, float volume, float pitch) { playSound(loc, sound, org.bukkit.SoundCategory.MASTER, volume, pitch); } @@ -1766,6 +1876,7 @@ public class CraftWorld implements World { world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension, packet); } + @Override public String getGameRuleValue(String rule) { // In method contract for some reason if (rule == null) { @@ -1776,6 +1887,7 @@ public class CraftWorld implements World { return value != null ? value.getValue() : ""; } + @Override public boolean setGameRuleValue(String rule, String value) { // No null values allowed if (rule == null || value == null) return false; @@ -1786,10 +1898,12 @@ public class CraftWorld implements World { return true; } + @Override public String[] getGameRules() { return GameRules.getGameRules().keySet().toArray(new String[GameRules.getGameRules().size()]); } + @Override public boolean isGameRule(String rule) { Validate.isTrue(rule != null && !rule.isEmpty(), "Rule cannot be null nor empty"); return GameRules.getGameRules().containsKey(rule); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 8eabf86027..1c0b09c197 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -73,6 +73,7 @@ public class CraftBlock implements Block { return position; } + @Override public World getWorld() { return world.getMinecraftWorld().getWorld(); } @@ -81,10 +82,12 @@ public class CraftBlock implements Block { return (CraftWorld) getWorld(); } + @Override public Location getLocation() { return new Location(getWorld(), position.getX(), position.getY(), position.getZ()); } + @Override public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); @@ -102,18 +105,22 @@ public class CraftBlock implements Block { return new BlockVector(getX(), getY(), getZ()); } + @Override public int getX() { return position.getX(); } + @Override public int getY() { return position.getY(); } + @Override public int getZ() { return position.getZ(); } + @Override public Chunk getChunk() { return getWorld().getChunkAt(this); } @@ -138,6 +145,7 @@ public class CraftBlock implements Block { return world.getType(position); } + @Override public byte getData() { IBlockData blockData = world.getType(position); return CraftMagicNumbers.toLegacyData(blockData); @@ -148,6 +156,7 @@ public class CraftBlock implements Block { return CraftBlockData.fromData(getData0()); } + @Override public void setType(final Material type) { setType(type, true); } @@ -197,18 +206,22 @@ public class CraftBlock implements Block { } } + @Override public Material getType() { return CraftMagicNumbers.getMaterial(world.getType(position).getBlock()); } + @Override public byte getLightLevel() { return (byte) world.getMinecraftWorld().getLightLevel(position); } + @Override public byte getLightFromSky() { return (byte) world.getBrightness(EnumSkyBlock.SKY, position); } + @Override public byte getLightFromBlocks() { return (byte) world.getBrightness(EnumSkyBlock.BLOCK, position); } @@ -222,18 +235,22 @@ public class CraftBlock implements Block { return getRelative(face, distance); } + @Override public Block getRelative(final int modX, final int modY, final int modZ) { return getWorld().getBlockAt(getX() + modX, getY() + modY, getZ() + modZ); } + @Override public Block getRelative(BlockFace face) { return getRelative(face, 1); } + @Override public Block getRelative(BlockFace face, int distance) { return getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance); } + @Override public BlockFace getFace(final Block block) { BlockFace[] values = BlockFace.values(); @@ -293,6 +310,7 @@ public class CraftBlock implements Block { } } + @Override public BlockState getState() { Material material = getType(); @@ -456,10 +474,12 @@ public class CraftBlock implements Block { } } + @Override public Biome getBiome() { return getWorld().getBiome(getX(), getZ()); } + @Override public void setBiome(Biome bio) { getWorld().setBiome(getX(), getZ(), bio); } @@ -480,18 +500,22 @@ public class CraftBlock implements Block { return IRegistry.BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH))); } + @Override public double getTemperature() { return world.getBiome(position).getAdjustedTemperature(position); } + @Override public double getHumidity() { return getWorld().getHumidity(getX(), getZ()); } + @Override public boolean isBlockPowered() { return world.getMinecraftWorld().getBlockPower(position) > 0; } + @Override public boolean isBlockIndirectlyPowered() { return world.getMinecraftWorld().isBlockIndirectlyPowered(position); } @@ -510,10 +534,12 @@ public class CraftBlock implements Block { return this.position.hashCode() ^ this.getWorld().hashCode(); } + @Override public boolean isBlockFacePowered(BlockFace face) { return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face)); } + @Override public boolean isBlockFaceIndirectlyPowered(BlockFace face) { int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face)); @@ -525,6 +551,7 @@ public class CraftBlock implements Block { return power > 0; } + @Override public int getBlockPower(BlockFace face) { int power = 0; BlockRedstoneWire wire = (BlockRedstoneWire) Blocks.REDSTONE_WIRE; @@ -541,26 +568,32 @@ public class CraftBlock implements Block { return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0; } + @Override public int getBlockPower() { return getBlockPower(BlockFace.SELF); } + @Override public boolean isEmpty() { return getNMS().isAir(); } + @Override public boolean isLiquid() { return (getType() == Material.WATER) || (getType() == Material.LAVA); } + @Override public PistonMoveReaction getPistonMoveReaction() { return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal()); } + @Override public boolean breakNaturally() { return breakNaturally(new ItemStack(Material.AIR)); } + @Override public boolean breakNaturally(ItemStack item) { // Order matters here, need to drop before setting to air so skulls can get their data net.minecraft.server.Block block = this.getNMSBlock(); @@ -574,27 +607,33 @@ public class CraftBlock implements Block { return setTypeAndData(Blocks.AIR.getBlockData(), true) && result; } + @Override public Collection getDrops() { return getDrops(new ItemStack(Material.AIR)); } + @Override public Collection getDrops(ItemStack item) { return net.minecraft.server.Block.getDrops(getNMS(), (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), null, CraftItemStack.asNMSCopy(item)) .stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList()); } + @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue); } + @Override public List getMetadata(String metadataKey) { return getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey); } + @Override public boolean hasMetadata(String metadataKey) { return getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey); } + @Override public void removeMetadata(String metadataKey, Plugin owningPlugin) { getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 8f14254901..0cb5582b19 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -56,23 +56,28 @@ public class CraftBlockState implements BlockState { return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag); } + @Override public World getWorld() { requirePlaced(); return world; } + @Override public int getX() { return position.getX(); } + @Override public int getY() { return position.getY(); } + @Override public int getZ() { return position.getZ(); } + @Override public Chunk getChunk() { requirePlaced(); return chunk; @@ -101,6 +106,7 @@ public class CraftBlockState implements BlockState { this.data = ((CraftBlockData) data).getState(); } + @Override public void setData(final MaterialData data) { Material mat = CraftMagicNumbers.getMaterial(this.data).getItemType(); @@ -116,10 +122,12 @@ public class CraftBlockState implements BlockState { } } + @Override public MaterialData getData() { return CraftMagicNumbers.getMaterial(data); } + @Override public void setType(final Material type) { Preconditions.checkArgument(type != null, "Material cannot be null"); Preconditions.checkArgument(type.isBlock(), "Material must be a block!"); @@ -129,6 +137,7 @@ public class CraftBlockState implements BlockState { } } + @Override public Material getType() { return CraftMagicNumbers.getMaterial(data.getBlock()); } @@ -141,23 +150,28 @@ public class CraftBlockState implements BlockState { return flag; } + @Override public byte getLightLevel() { return getBlock().getLightLevel(); } + @Override public CraftBlock getBlock() { requirePlaced(); return CraftBlock.at(world.getHandle(), position); } + @Override public boolean update() { return update(false); } + @Override public boolean update(boolean force) { return update(force, true); } + @Override public boolean update(boolean force, boolean applyPhysics) { if (!isPlaced()) { return true; @@ -187,14 +201,17 @@ public class CraftBlockState implements BlockState { return true; } + @Override public byte getRawData() { return CraftMagicNumbers.toLegacyData(data); } + @Override public Location getLocation() { return new Location(world, getX(), getY(), getZ()); } + @Override public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(world); @@ -208,6 +225,7 @@ public class CraftBlockState implements BlockState { return loc; } + @Override public void setRawData(byte data) { this.data = CraftMagicNumbers.getBlock(getType(), data); } @@ -242,21 +260,25 @@ public class CraftBlockState implements BlockState { return hash; } + @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { requirePlaced(); chunk.getCraftWorld().getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue); } + @Override public List getMetadata(String metadataKey) { requirePlaced(); return chunk.getCraftWorld().getBlockMetadata().getMetadata(getBlock(), metadataKey); } + @Override public boolean hasMetadata(String metadataKey) { requirePlaced(); return chunk.getCraftWorld().getBlockMetadata().hasMetadata(getBlock(), metadataKey); } + @Override public void removeMetadata(String metadataKey, Plugin owningPlugin) { requirePlaced(); chunk.getCraftWorld().getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin); diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java index 48d4dc7e2c..befcc19f9b 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -16,6 +16,7 @@ public class ConsoleCommandCompleter implements Completer { this.server = server; } + @Override public int complete(final String buffer, final int cursor, final List candidates) { Waitable> waitable = new Waitable>() { @Override diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java index cb2f8aa008..5beb2ad621 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java @@ -21,30 +21,36 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc this.tile = tile; } + @Override public Block getBlock() { return CraftBlock.at(tile.getWorld(), tile.getPosition()); } + @Override public void sendMessage(String message) { for (IChatBaseComponent component : CraftChatMessage.fromString(message)) { block.base.sendMessage(component); } } + @Override public void sendMessage(String[] messages) { for (String message : messages) { sendMessage(message); } } + @Override public String getName() { return block.getName(); } + @Override public boolean isOp() { return true; } + @Override public void setOp(boolean value) { throw new UnsupportedOperationException("Cannot change operator status of a block"); } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java index 9abcf92db3..bfd21a0728 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java @@ -18,48 +18,59 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co super(); } + @Override public void sendMessage(String message) { sendRawMessage(message); } + @Override public void sendRawMessage(String message) { System.out.println(ChatColor.stripColor(message)); } + @Override public void sendMessage(String[] messages) { for (String message : messages) { sendMessage(message); } } + @Override public String getName() { return "CONSOLE"; } + @Override public boolean isOp() { return true; } + @Override public void setOp(boolean value) { throw new UnsupportedOperationException("Cannot change operator status of server console"); } + @Override public boolean beginConversation(Conversation conversation) { return conversationTracker.beginConversation(conversation); } + @Override public void abandonConversation(Conversation conversation) { conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller())); } + @Override public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) { conversationTracker.abandonConversation(conversation, details); } + @Override public void acceptConversationInput(String input) { conversationTracker.acceptConversationInput(input); } + @Override public boolean isConversing() { return conversationTracker.isConversing(); } diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java index 3dc333f327..993b57b8dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java @@ -16,46 +16,57 @@ public abstract class ServerCommandSender implements CommandSender { public ServerCommandSender() { } + @Override public boolean isPermissionSet(String name) { return perm.isPermissionSet(name); } + @Override public boolean isPermissionSet(Permission perm) { return this.perm.isPermissionSet(perm); } + @Override public boolean hasPermission(String name) { return perm.hasPermission(name); } + @Override public boolean hasPermission(Permission perm) { return this.perm.hasPermission(perm); } + @Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { return perm.addAttachment(plugin, name, value); } + @Override public PermissionAttachment addAttachment(Plugin plugin) { return perm.addAttachment(plugin); } + @Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { return perm.addAttachment(plugin, name, value, ticks); } + @Override public PermissionAttachment addAttachment(Plugin plugin, int ticks) { return perm.addAttachment(plugin, ticks); } + @Override public void removeAttachment(PermissionAttachment attachment) { perm.removeAttachment(attachment); } + @Override public void recalculatePermissions() { perm.recalculatePermissions(); } + @Override public Set getEffectivePermissions() { return perm.getEffectivePermissions(); } @@ -64,6 +75,7 @@ public abstract class ServerCommandSender implements CommandSender { return false; } + @Override public Server getServer() { return Bukkit.getServer(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java index 7c1625519b..47b3fe5554 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java @@ -12,10 +12,12 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti doesBounce = false; } + @Override public boolean doesBounce() { return doesBounce; } + @Override public void setBounce(boolean doesBounce) { this.doesBounce = doesBounce; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java index 14d0416802..09016e3547 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -22,33 +22,40 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac return (EntityHorseAbstract) entity; } + @Override public void setVariant(Horse.Variant variant) { throw new UnsupportedOperationException("Not supported."); } + @Override public int getDomestication() { return getHandle().getTemper(); } + @Override public void setDomestication(int value) { Validate.isTrue(value >= 0, "Domestication cannot be less than zero"); Validate.isTrue(value <= getMaxDomestication(), "Domestication cannot be greater than the max domestication"); getHandle().setTemper(value); } + @Override public int getMaxDomestication() { return getHandle().getMaxDomestication(); } + @Override public void setMaxDomestication(int value) { Validate.isTrue(value > 0, "Max domestication cannot be zero or less"); getHandle().maxDomestication = value; } + @Override public double getJumpStrength() { return getHandle().getJumpStrength(); } + @Override public void setJumpStrength(double strength) { Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero"); getHandle().getAttributeInstance(EntityHorse.attributeJumpStrength).setValue(strength); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java index 2e270712e4..f9ac60e24a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java @@ -9,43 +9,52 @@ public class CraftAgeable extends CraftCreature implements Ageable { super(server, entity); } + @Override public int getAge() { return getHandle().getAge(); } + @Override public void setAge(int age) { getHandle().setAgeRaw(age); } + @Override public void setAgeLock(boolean lock) { getHandle().ageLocked = lock; } + @Override public boolean getAgeLock() { return getHandle().ageLocked; } + @Override public void setBaby() { if (isAdult()) { setAge(-24000); } } + @Override public void setAdult() { if (!isAdult()) { setAge(0); } } + @Override public boolean isAdult() { return getAge() >= 0; } + @Override public boolean canBreed() { return getAge() == 0; } + @Override public void setBreed(boolean breed) { if (breed) { setAge(0); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java index 734f54891a..a482c2aab7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java @@ -20,6 +20,7 @@ public class CraftAmbient extends CraftMob implements Ambient { return "CraftAmbient"; } + @Override public EntityType getType() { return EntityType.UNKNOWN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java index 21b6c8c19c..a52eae8cda 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java @@ -214,11 +214,13 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud return CraftPotionUtil.toBukkit(getHandle().getType()); } + @Override public ProjectileSource getSource() { EntityLiving source = getHandle().getSource(); return (source == null) ? null : (LivingEntity) source.getBukkitEntity(); } + @Override public void setSource(ProjectileSource shooter) { if (shooter instanceof CraftLivingEntity) { getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 19ddd86d38..a81805dd52 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -17,11 +17,13 @@ public class CraftArrow extends AbstractProjectile implements Arrow { super(server, entity); } + @Override public void setKnockbackStrength(int knockbackStrength) { Validate.isTrue(knockbackStrength >= 0, "Knockback cannot be negative"); getHandle().setKnockbackStrength(knockbackStrength); } + @Override public int getKnockbackStrength() { return getHandle().knockbackStrength; } @@ -37,18 +39,22 @@ public class CraftArrow extends AbstractProjectile implements Arrow { getHandle().setDamage(damage); } + @Override public boolean isCritical() { return getHandle().isCritical(); } + @Override public void setCritical(boolean critical) { getHandle().setCritical(critical); } + @Override public ProjectileSource getShooter() { return getHandle().projectileSource; } + @Override public void setShooter(ProjectileSource shooter) { if (shooter instanceof Entity) { getHandle().setShooter(((CraftEntity) shooter).getHandle()); @@ -102,6 +108,7 @@ public class CraftArrow extends AbstractProjectile implements Arrow { return "CraftArrow"; } + @Override public EntityType getType() { return EntityType.UNKNOWN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java index 76ada1c379..e7061d9d78 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java @@ -20,6 +20,7 @@ public class CraftBat extends CraftAmbient implements Bat { return "CraftBat"; } + @Override public EntityType getType() { return EntityType.BAT; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java index b1efeb7454..089419edec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java @@ -20,6 +20,7 @@ public class CraftBlaze extends CraftMonster implements Blaze { return "CraftBlaze"; } + @Override public EntityType getType() { return EntityType.BLAZE; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java index 3613f5b3e0..271950903e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -22,38 +22,46 @@ public class CraftBoat extends CraftVehicle implements Boat { getHandle().setType(getBoatType(species)); } + @Override public double getMaxSpeed() { return getHandle().maxSpeed; } + @Override public void setMaxSpeed(double speed) { if (speed >= 0D) { getHandle().maxSpeed = speed; } } + @Override public double getOccupiedDeceleration() { return getHandle().occupiedDeceleration; } + @Override public void setOccupiedDeceleration(double speed) { if (speed >= 0D) { getHandle().occupiedDeceleration = speed; } } + @Override public double getUnoccupiedDeceleration() { return getHandle().unoccupiedDeceleration; } + @Override public void setUnoccupiedDeceleration(double speed) { getHandle().unoccupiedDeceleration = speed; } + @Override public boolean getWorkOnLand() { return getHandle().landBoats; } + @Override public void setWorkOnLand(boolean workOnLand) { getHandle().landBoats = workOnLand; } @@ -68,6 +76,7 @@ public class CraftBoat extends CraftVehicle implements Boat { return "CraftBoat"; } + @Override public EntityType getType() { return EntityType.BOAT; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java index a1fe8dd527..fceb2b2fb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java @@ -20,6 +20,7 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider { return "CraftCaveSpider"; } + @Override public EntityType getType() { return EntityType.CAVE_SPIDER; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index 440c3f185f..47fcf1b1a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java @@ -21,6 +21,7 @@ public class CraftChicken extends CraftAnimals implements Chicken { return "CraftChicken"; } + @Override public EntityType getType() { return EntityType.CHICKEN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java index 0c26048223..c1829a0d04 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java @@ -13,6 +13,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { super(server, entity); } + @Override public ComplexLivingEntity getParent() { return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity(); } @@ -42,6 +43,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { return "CraftComplexPart"; } + @Override public EntityType getType() { return EntityType.UNKNOWN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java index 3675ea887c..31bfa02e81 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java @@ -21,6 +21,7 @@ public class CraftCow extends CraftAnimals implements Cow { return "CraftCow"; } + @Override public EntityType getType() { return EntityType.COW; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java index 2f2abb7077..796ee9e40d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -13,10 +13,12 @@ public class CraftCreeper extends CraftMonster implements Creeper { super(server, entity); } + @Override public boolean isPowered() { return getHandle().isPowered(); } + @Override public void setPowered(boolean powered) { CraftServer server = this.server; Creeper entity = (Creeper) this.getHandle().getBukkitEntity(); @@ -72,6 +74,7 @@ public class CraftCreeper extends CraftMonster implements Creeper { return "CraftCreeper"; } + @Override public EntityType getType() { return EntityType.CREEPER; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java index 60c5188ec4..1d0f430381 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java @@ -20,6 +20,7 @@ public class CraftEgg extends CraftProjectile implements Egg { return "CraftEgg"; } + @Override public EntityType getType() { return EntityType.EGG; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java index ffb863e601..46d8e36ac1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java @@ -49,6 +49,7 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal { return "CraftEnderCrystal"; } + @Override public EntityType getType() { return EntityType.ENDER_CRYSTAL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index 5cae78db6d..ee95e4e338 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -25,6 +25,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD } } + @Override public Set getParts() { Builder builder = ImmutableSet.builder(); @@ -45,6 +46,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD return "CraftEnderDragon"; } + @Override public EntityType getType() { return EntityType.ENDER_DRAGON; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java index c3338710bc..ea4eb6bc0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java @@ -26,30 +26,37 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago return "CraftEnderDragonPart"; } + @Override public void damage(double amount) { getParent().damage(amount); } + @Override public void damage(double amount, Entity source) { getParent().damage(amount, source); } + @Override public double getHealth() { return getParent().getHealth(); } + @Override public void setHealth(double health) { getParent().setHealth(health); } + @Override public double getMaxHealth() { return getParent().getMaxHealth(); } + @Override public void setMaxHealth(double health) { getParent().setMaxHealth(health); } + @Override public void resetMaxHealth() { getParent().resetMaxHealth(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java index f42f9ab7ef..32221ead38 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java @@ -20,6 +20,7 @@ public class CraftEnderPearl extends CraftProjectile implements EnderPearl { return "CraftEnderPearl"; } + @Override public EntityType getType() { return EntityType.ENDER_PEARL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index da8a70d6ad..970efabd37 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -16,6 +16,7 @@ public class CraftEnderman extends CraftMonster implements Enderman { super(server, entity); } + @Override public MaterialData getCarriedMaterial() { IBlockData blockData = getHandle().getCarried(); return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData); @@ -27,6 +28,7 @@ public class CraftEnderman extends CraftMonster implements Enderman { return (blockData == null) ? null : CraftBlockData.fromData(blockData); } + @Override public void setCarriedMaterial(MaterialData data) { getHandle().setCarried(CraftMagicNumbers.getBlock(data)); } @@ -46,6 +48,7 @@ public class CraftEnderman extends CraftMonster implements Enderman { return "CraftEnderman"; } + @Override public EntityType getType() { return EntityType.ENDERMAN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 982a7ad0da..cc6cce4157 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -370,10 +370,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass())); } + @Override public Location getLocation() { return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.getBukkitYaw(), entity.pitch); } + @Override public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); @@ -387,10 +389,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return loc; } + @Override public Vector getVelocity() { return CraftVector.toBukkit(entity.getMot()); } + @Override public void setVelocity(Vector velocity) { Preconditions.checkArgument(velocity != null, "velocity"); velocity.checkFinite(); @@ -414,6 +418,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return new BoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ); } + @Override public boolean isOnGround() { if (entity instanceof EntityArrow) { return ((EntityArrow) entity).inGround; @@ -421,6 +426,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return entity.onGround; } + @Override public World getWorld() { return entity.world.getWorld(); } @@ -440,10 +446,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { entity.setHeadRotation(yaw); } + @Override public boolean teleport(Location location) { return teleport(location, TeleportCause.PLUGIN); } + @Override public boolean teleport(Location location, TeleportCause cause) { Preconditions.checkArgument(location != null, "location"); location.checkFinite(); @@ -469,14 +477,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } + @Override public boolean teleport(org.bukkit.entity.Entity destination) { return teleport(destination.getLocation()); } + @Override public boolean teleport(org.bukkit.entity.Entity destination, TeleportCause cause) { return teleport(destination.getLocation(), cause); } + @Override public List getNearbyEntities(double x, double y, double z) { List notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null); List bukkitEntityList = new java.util.ArrayList(notchEntityList.size()); @@ -487,34 +498,42 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return bukkitEntityList; } + @Override public int getEntityId() { return entity.getId(); } + @Override public int getFireTicks() { return entity.fireTicks; } + @Override public int getMaxFireTicks() { return entity.getMaxFireTicks(); } + @Override public void setFireTicks(int ticks) { entity.fireTicks = ticks; } + @Override public void remove() { entity.die(); } + @Override public boolean isDead() { return !entity.isAlive(); } + @Override public boolean isValid() { return entity.isAlive() && entity.valid; } + @Override public Server getServer() { return server; } @@ -537,10 +556,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { setVelocity(value); } + @Override public org.bukkit.entity.Entity getPassenger() { return isEmpty() ? null : getHandle().passengers.get(0).getBukkitEntity(); } + @Override public boolean setPassenger(org.bukkit.entity.Entity passenger) { Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself."); if (passenger instanceof CraftEntity) { @@ -576,10 +597,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } + @Override public boolean isEmpty() { return !getHandle().isVehicle(); } + @Override public boolean eject() { if (isEmpty()) { return false; @@ -589,30 +612,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } + @Override public float getFallDistance() { return getHandle().fallDistance; } + @Override public void setFallDistance(float distance) { getHandle().fallDistance = distance; } + @Override public void setLastDamageCause(EntityDamageEvent event) { lastDamageEvent = event; } + @Override public EntityDamageEvent getLastDamageCause() { return lastDamageEvent; } + @Override public UUID getUniqueId() { return getHandle().getUniqueID(); } + @Override public int getTicksLived() { return getHandle().ticksLived; } + @Override public void setTicksLived(int value) { if (value <= 0) { throw new IllegalArgumentException("Age must be at least 1 tick"); @@ -661,26 +691,32 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return hash; } + @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue); } + @Override public List getMetadata(String metadataKey) { return server.getEntityMetadata().getMetadata(this, metadataKey); } + @Override public boolean hasMetadata(String metadataKey) { return server.getEntityMetadata().hasMetadata(this, metadataKey); } + @Override public void removeMetadata(String metadataKey, Plugin owningPlugin) { server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin); } + @Override public boolean isInsideVehicle() { return getHandle().isPassenger(); } + @Override public boolean leaveVehicle() { if (!isInsideVehicle()) { return false; @@ -690,6 +726,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } + @Override public org.bukkit.entity.Entity getVehicle() { if (!isInsideVehicle()) { return null; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java index 3a09cab3d4..1b512cc45c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java @@ -10,10 +10,12 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { super(server, entity); } + @Override public int getExperience() { return getHandle().value; } + @Override public void setExperience(int value) { getHandle().value = value; } @@ -28,6 +30,7 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { return "CraftExperienceOrb"; } + @Override public EntityType getType() { return EntityType.EXPERIENCE_ORB; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java index 04b2324a57..7a6676b4ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java @@ -25,22 +25,27 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock { return "CraftFallingBlock"; } + @Override public EntityType getType() { return EntityType.FALLING_BLOCK; } + @Override public Material getMaterial() { return CraftMagicNumbers.getMaterial(getHandle().getBlock()).getItemType(); } + @Override public BlockData getBlockData() { return CraftBlockData.fromData(getHandle().getBlock()); } + @Override public boolean getDropItem() { return getHandle().dropItem; } + @Override public void setDropItem(boolean drop) { getHandle().dropItem = drop; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index c31eba723e..f392f801b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -14,26 +14,32 @@ public class CraftFireball extends AbstractProjectile implements Fireball { super(server, entity); } + @Override public float getYield() { return getHandle().bukkitYield; } + @Override public boolean isIncendiary() { return getHandle().isIncendiary; } + @Override public void setIsIncendiary(boolean isIncendiary) { getHandle().isIncendiary = isIncendiary; } + @Override public void setYield(float yield) { getHandle().bukkitYield = yield; } + @Override public ProjectileSource getShooter() { return getHandle().projectileSource; } + @Override public void setShooter(ProjectileSource shooter) { if (shooter instanceof CraftLivingEntity) { getHandle().shooter = ((CraftLivingEntity) shooter).getHandle(); @@ -43,10 +49,12 @@ public class CraftFireball extends AbstractProjectile implements Fireball { getHandle().projectileSource = shooter; } + @Override public Vector getDirection() { return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ); } + @Override public void setDirection(Vector direction) { Validate.notNull(direction, "Direction can not be null"); double x = direction.getX(); @@ -68,6 +76,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball { return "CraftFireball"; } + @Override public EntityType getType() { return EntityType.UNKNOWN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java index 75aae03b62..1ed9a4e32e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java @@ -17,6 +17,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { super(server, entity); } + @Override public ProjectileSource getShooter() { if (getHandle().owner != null) { return getHandle().owner.getBukkitEntity(); @@ -25,6 +26,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { return null; } + @Override public void setShooter(ProjectileSource shooter) { if (shooter instanceof CraftHumanEntity) { getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity; @@ -41,10 +43,12 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { return "CraftFishingHook"; } + @Override public EntityType getType() { return EntityType.FISHING_HOOK; } + @Override public double getBiteChance() { EntityFishingHook hook = getHandle(); @@ -57,6 +61,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { return this.biteChance; } + @Override public void setBiteChance(double chance) { Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1."); this.biteChance = chance; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index c661673a66..cac82ce760 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -21,6 +21,7 @@ public class CraftGhast extends CraftFlying implements Ghast { return "CraftGhast"; } + @Override public EntityType getType() { return EntityType.GHAST; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java index 8e27e7bd06..ecbead90a0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java @@ -21,6 +21,7 @@ public class CraftGiant extends CraftMonster implements Giant { return "CraftGiant"; } + @Override public EntityType getType() { return EntityType.GIANT; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java index d9a871a8cc..fc3dae305d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java @@ -13,14 +13,17 @@ public class CraftHanging extends CraftEntity implements Hanging { super(server, entity); } + @Override public BlockFace getAttachedFace() { return getFacing().getOppositeFace(); } + @Override public void setFacingDirection(BlockFace face) { setFacingDirection(face, false); } + @Override public boolean setFacingDirection(BlockFace face, boolean force) { EntityHanging hanging = getHandle(); EnumDirection dir = hanging.direction; @@ -47,6 +50,7 @@ public class CraftHanging extends CraftEntity implements Hanging { return true; } + @Override public BlockFace getFacing() { EnumDirection direction = this.getHandle().direction; if (direction == null) return BlockFace.SELF; @@ -63,6 +67,7 @@ public class CraftHanging extends CraftEntity implements Hanging { return "CraftHanging"; } + @Override public EntityType getType() { return EntityType.UNKNOWN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 90ffdc07aa..d36c924b54 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -91,34 +91,42 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { enderChest = new CraftInventory(entity.getEnderChest()); } + @Override public PlayerInventory getInventory() { return inventory; } + @Override public EntityEquipment getEquipment() { return inventory; } + @Override public Inventory getEnderChest() { return enderChest; } + @Override public MainHand getMainHand() { return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT; } + @Override public ItemStack getItemInHand() { return getInventory().getItemInHand(); } + @Override public void setItemInHand(ItemStack item) { getInventory().setItemInHand(item); } + @Override public ItemStack getItemOnCursor() { return CraftItemStack.asCraftMirror(getHandle().inventory.getCarried()); } + @Override public void setItemOnCursor(ItemStack item) { net.minecraft.server.ItemStack stack = CraftItemStack.asNMSCopy(item); getHandle().inventory.setCarried(stack); @@ -127,10 +135,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } } + @Override public boolean isSleeping() { return getHandle().isSleeping(); } + @Override public int getSleepTicks() { return getHandle().sleepTicks; } @@ -207,63 +217,78 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().getName(); } + @Override public boolean isOp() { return op; } + @Override public boolean isPermissionSet(String name) { return perm.isPermissionSet(name); } + @Override public boolean isPermissionSet(Permission perm) { return this.perm.isPermissionSet(perm); } + @Override public boolean hasPermission(String name) { return perm.hasPermission(name); } + @Override public boolean hasPermission(Permission perm) { return this.perm.hasPermission(perm); } + @Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { return perm.addAttachment(plugin, name, value); } + @Override public PermissionAttachment addAttachment(Plugin plugin) { return perm.addAttachment(plugin); } + @Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { return perm.addAttachment(plugin, name, value, ticks); } + @Override public PermissionAttachment addAttachment(Plugin plugin, int ticks) { return perm.addAttachment(plugin, ticks); } + @Override public void removeAttachment(PermissionAttachment attachment) { perm.removeAttachment(attachment); } + @Override public void recalculatePermissions() { perm.recalculatePermissions(); } + @Override public void setOp(boolean value) { this.op = value; perm.recalculatePermissions(); } + @Override public Set getEffectivePermissions() { return perm.getEffectivePermissions(); } + @Override public GameMode getGameMode() { return mode; } + @Override public void setGameMode(GameMode mode) { if (mode == null) { throw new IllegalArgumentException("Mode cannot be null"); @@ -287,10 +312,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}'; } + @Override public InventoryView getOpenInventory() { return getHandle().activeContainer.getBukkitView(); } + @Override public InventoryView openInventory(Inventory inventory) { if(!(getHandle() instanceof EntityPlayer)) return null; EntityPlayer player = (EntityPlayer) getHandle(); @@ -463,6 +490,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getHandle().activeContainer.addSlotListener(player); } + @Override public InventoryView openWorkbench(Location location, boolean force) { if (!force) { Block block = location.getBlock(); @@ -480,6 +508,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().activeContainer.getBukkitView(); } + @Override public InventoryView openEnchanting(Location location, boolean force) { if (!force) { Block block = location.getBlock(); @@ -501,6 +530,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().activeContainer.getBukkitView(); } + @Override public void openInventory(InventoryView inventory) { if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support? if (((EntityPlayer) getHandle()).playerConnection == null) return; @@ -567,10 +597,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return this.getHandle().activeContainer.getBukkitView(); } + @Override public void closeInventory() { getHandle().closeInventory(); } + @Override public boolean isBlocking() { return getHandle().isBlocking(); } @@ -580,10 +612,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().isHandRaised(); } + @Override public boolean setWindowProperty(InventoryView.Property prop, int value) { return false; } + @Override public int getExpToLevel() { return getHandle().getExpToLevel(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java index ddee207eb7..9ca8eeff5d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java @@ -20,10 +20,12 @@ public class CraftIronGolem extends CraftGolem implements IronGolem { return "CraftIronGolem"; } + @Override public boolean isPlayerCreated() { return getHandle().isPlayerCreated(); } + @Override public void setPlayerCreated(boolean playerCreated) { getHandle().setPlayerCreated(playerCreated); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 0dbca8f00c..cc593fbc99 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -20,18 +20,22 @@ public class CraftItem extends CraftEntity implements Item { this(server, entity, entity); } + @Override public ItemStack getItemStack() { return CraftItemStack.asCraftMirror(item.getItemStack()); } + @Override public void setItemStack(ItemStack stack) { item.setItemStack(CraftItemStack.asNMSCopy(stack)); } + @Override public int getPickupDelay() { return item.pickupDelay; } + @Override public void setPickupDelay(int delay) { item.pickupDelay = Math.min(delay, Short.MAX_VALUE); } @@ -49,6 +53,7 @@ public class CraftItem extends CraftEntity implements Item { return "CraftItem"; } + @Override public EntityType getType() { return EntityType.DROPPED_ITEM; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index da642ceb96..70127520a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -54,18 +54,22 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { this.entity = frame; } + @Override public void setItem(org.bukkit.inventory.ItemStack item) { setItem(item, true); } + @Override public void setItem(org.bukkit.inventory.ItemStack item, boolean playSound) { getHandle().setItem(CraftItemStack.asNMSCopy(item), true, playSound); } + @Override public org.bukkit.inventory.ItemStack getItem() { return CraftItemStack.asBukkitCopy(getHandle().getItem()); } + @Override public Rotation getRotation() { return toBukkitRotation(getHandle().getRotation()); } @@ -94,6 +98,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { } } + @Override public void setRotation(Rotation rotation) { Validate.notNull(rotation, "Rotation cannot be null"); getHandle().setRotation(toInteger(rotation)); @@ -133,6 +138,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { return "CraftItemFrame{item=" + getItem() + ", rotation=" + getRotation() + "}"; } + @Override public EntityType getType() { return EntityType.ITEM_FRAME; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java index ca0379403f..9ab8f6606d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java @@ -26,6 +26,7 @@ public class CraftLargeFireball extends CraftFireball implements LargeFireball { return "CraftLargeFireball"; } + @Override public EntityType getType() { return EntityType.FIREBALL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java index 1959a1a3ec..7114b5156e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java @@ -20,6 +20,7 @@ public class CraftLeash extends CraftHanging implements LeashHitch { return "CraftLeash"; } + @Override public EntityType getType() { return EntityType.LEASH_HITCH; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index 64e346d84c..cb1efe9694 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -10,6 +10,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike super(server, entity); } + @Override public boolean isEffect() { return ((EntityLightning) super.getHandle()).isEffect; } @@ -24,6 +25,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike return "CraftLightningStrike"; } + @Override public EntityType getType() { return EntityType.LIGHTNING; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index d01e06f1b9..2b0671a708 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -92,10 +92,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } } + @Override public double getHealth() { return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth()); } + @Override public void setHealth(double health) { health = (float) health; if ((health < 0) || (health > getMaxHealth())) { @@ -109,10 +111,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } } + @Override public double getMaxHealth() { return getHandle().getMaxHealth(); } + @Override public void setMaxHealth(double amount) { Validate.isTrue(amount > 0, "Max health must be greater than 0"); @@ -123,14 +127,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } } + @Override public void resetMaxHealth() { setMaxHealth(getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).getAttribute().getDefault()); } + @Override public double getEyeHeight() { return getHandle().getHeadHeight(); } + @Override public double getEyeHeight(boolean ignorePose) { return getEyeHeight(); } @@ -158,15 +165,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return blocks; } + @Override public List getLineOfSight(Set transparent, int maxDistance) { return getLineOfSight(transparent, maxDistance, 0); } + @Override public Block getTargetBlock(Set transparent, int maxDistance) { List blocks = getLineOfSight(transparent, maxDistance, 1); return blocks.get(0); } + @Override public List getLastTwoTargetBlocks(Set transparent, int maxDistance) { return getLineOfSight(transparent, maxDistance, 2); } @@ -194,26 +204,32 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getWorld().rayTraceBlocks(eyeLocation, direction, maxDistance, fluidCollisionMode, false); } + @Override public int getRemainingAir() { return getHandle().getAirTicks(); } + @Override public void setRemainingAir(int ticks) { getHandle().setAirTicks(ticks); } + @Override public int getMaximumAir() { return getHandle().maxAirTicks; } + @Override public void setMaximumAir(int ticks) { getHandle().maxAirTicks = ticks; } + @Override public void damage(double amount) { damage(amount, null); } + @Override public void damage(double amount, org.bukkit.entity.Entity source) { DamageSource reason = DamageSource.GENERIC; @@ -226,32 +242,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { entity.damageEntity(reason, (float) amount); } + @Override public Location getEyeLocation() { Location loc = getLocation(); loc.setY(loc.getY() + getEyeHeight()); return loc; } + @Override public int getMaximumNoDamageTicks() { return getHandle().maxNoDamageTicks; } + @Override public void setMaximumNoDamageTicks(int ticks) { getHandle().maxNoDamageTicks = ticks; } + @Override public double getLastDamage() { return getHandle().lastDamage; } + @Override public void setLastDamage(double damage) { getHandle().lastDamage = (float) damage; } + @Override public int getNoDamageTicks() { return getHandle().noDamageTicks; } + @Override public void setNoDamageTicks(int ticks) { getHandle().noDamageTicks = ticks; } @@ -270,14 +293,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return "CraftLivingEntity{" + "id=" + getEntityId() + '}'; } + @Override public Player getKiller() { return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity(); } + @Override public boolean addPotionEffect(PotionEffect effect) { return addPotionEffect(effect, false); } + @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { if (hasPotionEffect(effect.getType())) { if (!force) { @@ -289,6 +315,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return true; } + @Override public boolean addPotionEffects(Collection effects) { boolean success = true; for (PotionEffect effect : effects) { @@ -297,6 +324,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return success; } + @Override public boolean hasPotionEffect(PotionEffectType type) { return getHandle().hasEffect(MobEffectList.fromId(type.getId())); } @@ -307,10 +335,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles()); } + @Override public void removePotionEffect(PotionEffectType type) { getHandle().removeEffect(MobEffectList.fromId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN); } + @Override public Collection getActivePotionEffects() { List effects = new ArrayList(); for (MobEffect handle : getHandle().effects.values()) { @@ -319,10 +349,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return effects; } + @Override public T launchProjectile(Class projectile) { return launchProjectile(projectile, null); } + @Override @SuppressWarnings("unchecked") public T launchProjectile(Class projectile, Vector velocity) { net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); @@ -405,32 +437,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return (T) launch.getBukkitEntity(); } + @Override public EntityType getType() { return EntityType.UNKNOWN; } + @Override public boolean hasLineOfSight(Entity other) { return getHandle().hasLineOfSight(((CraftEntity) other).getHandle()); } + @Override public boolean getRemoveWhenFarAway() { return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent; } + @Override public void setRemoveWhenFarAway(boolean remove) { if (getHandle() instanceof EntityInsentient) { ((EntityInsentient) getHandle()).persistent = !remove; } } + @Override public EntityEquipment getEquipment() { return equipment; } + @Override public void setCanPickupItems(boolean pickup) { getHandle().canPickUpLoot = pickup; } + @Override public boolean getCanPickupItems() { return getHandle().canPickUpLoot; } @@ -444,6 +483,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return super.teleport(location, cause); } + @Override public boolean isLeashed() { if (!(getHandle() instanceof EntityInsentient)) { return false; @@ -451,6 +491,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return ((EntityInsentient) getHandle()).getLeashHolder() != null; } + @Override public Entity getLeashHolder() throws IllegalStateException { if (!isLeashed()) { throw new IllegalStateException("Entity not leashed"); @@ -466,6 +507,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return true; } + @Override public boolean setLeashHolder(Entity holder) { if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) { return false; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java index 92d36cec4b..5e005c9e41 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java @@ -11,6 +11,7 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube { super(server, entity); } + @Override public EntityMagmaCube getHandle() { return (EntityMagmaCube) entity; } @@ -20,6 +21,7 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube { return "CraftMagmaCube"; } + @Override public EntityType getType() { return EntityType.MAGMA_CUBE; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 101f7c1f64..2d82ea40a4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -16,44 +16,54 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { super(server, entity); } + @Override public void setDamage(double damage) { getHandle().setDamage((float) damage); } + @Override public double getDamage() { return getHandle().getDamage(); } + @Override public double getMaxSpeed() { return getHandle().maxSpeed; } + @Override public void setMaxSpeed(double speed) { if (speed >= 0D) { getHandle().maxSpeed = speed; } } + @Override public boolean isSlowWhenEmpty() { return getHandle().slowWhenEmpty; } + @Override public void setSlowWhenEmpty(boolean slow) { getHandle().slowWhenEmpty = slow; } + @Override public Vector getFlyingVelocityMod() { return getHandle().getFlyingVelocityMod(); } + @Override public void setFlyingVelocityMod(Vector flying) { getHandle().setFlyingVelocityMod(flying); } + @Override public Vector getDerailedVelocityMod() { return getHandle().getDerailedVelocityMod(); } + @Override public void setDerailedVelocityMod(Vector derailed) { getHandle().setDerailedVelocityMod(derailed); } @@ -63,6 +73,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { return (EntityMinecartAbstract) entity; } + @Override public void setDisplayBlock(MaterialData material) { if(material != null) { IBlockData block = CraftMagicNumbers.getBlock(material); @@ -86,6 +97,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { } } + @Override public MaterialData getDisplayBlock() { IBlockData blockData = getHandle().getDisplayBlock(); return CraftMagicNumbers.getMaterial(blockData); @@ -97,10 +109,12 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { return CraftBlockData.fromData(blockData); } + @Override public void setDisplayBlockOffset(int offset) { getHandle().setDisplayBlockOffset(offset); } + @Override public int getDisplayBlockOffset() { return getHandle().getDisplayBlockOffset(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java index 9225082bdb..e05624e643 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java @@ -16,6 +16,7 @@ public class CraftMinecartChest extends CraftMinecartContainer implements Storag inventory = new CraftInventory(entity); } + @Override public Inventory getInventory() { return inventory; } @@ -25,6 +26,7 @@ public class CraftMinecartChest extends CraftMinecartContainer implements Storag return "CraftMinecartChest{" + "inventory=" + inventory + '}'; } + @Override public EntityType getType() { return EntityType.MINECART_CHEST; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java index bdb995b257..b024359c9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java @@ -16,6 +16,7 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca return "CraftMinecartFurnace"; } + @Override public EntityType getType() { return EntityType.MINECART_FURNACE; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java index 44b3418b1d..334bd5bb3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -20,10 +20,12 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements return "CraftMinecartHopper{" + "inventory=" + inventory + '}'; } + @Override public EntityType getType() { return EntityType.MINECART_HOPPER; } + @Override public Inventory getInventory() { return inventory; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java index 6b7e363b48..b6c86c01f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java @@ -15,6 +15,7 @@ final class CraftMinecartMobSpawner extends CraftMinecart implements SpawnerMine return "CraftMinecartMobSpawner"; } + @Override public EntityType getType() { return EntityType.MINECART_MOB_SPAWNER; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartRideable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartRideable.java index 4394ed1ba8..1c2b32fc49 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartRideable.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartRideable.java @@ -15,6 +15,7 @@ public class CraftMinecartRideable extends CraftMinecart implements RideableMine return "CraftMinecartRideable"; } + @Override public EntityType getType() { return EntityType.MINECART; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java index 641f9c8f3b..02c5589bc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java @@ -15,6 +15,7 @@ final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart return "CraftMinecartTNT"; } + @Override public EntityType getType() { return EntityType.MINECART_TNT; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java index 00de05bb3c..cbd2b6f547 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java @@ -15,10 +15,12 @@ public class CraftOcelot extends CraftAnimals implements Ocelot { return (EntityOcelot) entity; } + @Override public Type getCatType() { return Type.WILD_OCELOT; } + @Override public void setCatType(Type type) { throw new UnsupportedOperationException("Cats are now a different entity!"); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java index 628015a9af..805261cb70 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java @@ -18,15 +18,18 @@ public class CraftPainting extends CraftHanging implements Painting { super(server, entity); } + @Override public Art getArt() { Paintings art = getHandle().art; return CraftArt.NotchToBukkit(art); } + @Override public boolean setArt(Art art) { return setArt(art, false); } + @Override public boolean setArt(Art art, boolean force) { EntityPainting painting = this.getHandle(); Paintings oldArt = painting.art; @@ -42,6 +45,7 @@ public class CraftPainting extends CraftHanging implements Painting { return true; } + @Override public boolean setFacingDirection(BlockFace face, boolean force) { if (super.setFacingDirection(face, force)) { update(); @@ -73,6 +77,7 @@ public class CraftPainting extends CraftHanging implements Painting { return "CraftPainting{art=" + getArt() + "}"; } + @Override public EntityType getType() { return EntityType.PAINTING; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java index 415ddde18d..85fee3f21e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java @@ -10,14 +10,17 @@ public class CraftPig extends CraftAnimals implements Pig { super(server, entity); } + @Override public boolean hasSaddle() { return getHandle().hasSaddle(); } + @Override public void setSaddle(boolean saddled) { getHandle().setSaddle(saddled); } + @Override public EntityPig getHandle() { return (EntityPig) entity; } @@ -27,6 +30,7 @@ public class CraftPig extends CraftAnimals implements Pig { return "CraftPig"; } + @Override public EntityType getType() { return EntityType.PIG; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java index 952bb1b6d4..10c12ef5a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java @@ -11,18 +11,22 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { super(server, entity); } + @Override public int getAnger() { return getHandle().angerLevel; } + @Override public void setAnger(int level) { getHandle().angerLevel = level; } + @Override public void setAngry(boolean angry) { setAnger(angry ? 400 : 0); } + @Override public boolean isAngry() { return getAnger() > 0; } @@ -37,6 +41,7 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { return "CraftPigZombie"; } + @Override public EntityType getType() { return EntityType.PIG_ZOMBIE; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 5a1b6c3dc3..4732bb82c1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -157,10 +157,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { perm.recalculatePermissions(); } + @Override public boolean isOnline() { return server.getPlayer(getUniqueId()) != null; } + @Override public InetSocketAddress getAddress() { if (getHandle().playerConnection == null) return null; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java index c671f098cf..649684fc86 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java @@ -11,10 +11,12 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj super(server, entity); } + @Override public ProjectileSource getShooter() { return getHandle().projectileSource; } + @Override public void setShooter(ProjectileSource shooter) { if (shooter instanceof CraftLivingEntity) { getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java index 107881a364..fef86120de 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -12,18 +12,22 @@ public class CraftSheep extends CraftAnimals implements Sheep { super(server, entity); } + @Override public DyeColor getColor() { return DyeColor.getByWoolData((byte) getHandle().getColor().getColorIndex()); } + @Override public void setColor(DyeColor color) { getHandle().setColor(EnumColor.fromColorIndex(color.getWoolData())); } + @Override public boolean isSheared() { return getHandle().isSheared(); } + @Override public void setSheared(boolean flag) { getHandle().setSheared(flag); } @@ -38,6 +42,7 @@ public class CraftSheep extends CraftAnimals implements Sheep { return "CraftSheep"; } + @Override public EntityType getType() { return EntityType.SHEEP; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java index fe18098190..0fe4b0e8c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java @@ -20,6 +20,7 @@ public class CraftSilverfish extends CraftMonster implements Silverfish { return "CraftSilverfish"; } + @Override public EntityType getType() { return EntityType.SILVERFISH; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java index 9fef81cc22..b4ae898401 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java @@ -21,6 +21,7 @@ public class CraftSkeleton extends CraftMonster implements Skeleton { return "CraftSkeleton"; } + @Override public EntityType getType() { return EntityType.SKELETON; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index 00fbef360b..ce6ed6e890 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -11,10 +11,12 @@ public class CraftSlime extends CraftMob implements Slime { super(server, entity); } + @Override public int getSize() { return getHandle().getSize(); } + @Override public void setSize(int size) { getHandle().setSize(size, true); } @@ -29,6 +31,7 @@ public class CraftSlime extends CraftMob implements Slime { return "CraftSlime"; } + @Override public EntityType getType() { return EntityType.SLIME; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java index 720097004c..02fac8b4a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java @@ -20,6 +20,7 @@ public class CraftSmallFireball extends CraftFireball implements SmallFireball { return "CraftSmallFireball"; } + @Override public EntityType getType() { return EntityType.SMALL_FIREBALL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java index 44de7496c2..222977d79f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java @@ -20,6 +20,7 @@ public class CraftSnowball extends CraftProjectile implements Snowball { return "CraftSnowball"; } + @Override public EntityType getType() { return EntityType.SNOWBALL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index 0349f0a574..27460c59e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java @@ -30,6 +30,7 @@ public class CraftSnowman extends CraftGolem implements Snowman { return "CraftSnowman"; } + @Override public EntityType getType() { return EntityType.SNOWMAN; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java index 8412397483..a3f452aca4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java @@ -21,6 +21,7 @@ public class CraftSpider extends CraftMonster implements Spider { return "CraftSpider"; } + @Override public EntityType getType() { return EntityType.SPIDER; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java index cb81d91fd9..6cb09623e9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java @@ -21,6 +21,7 @@ public class CraftSquid extends CraftWaterMob implements Squid { return "CraftSquid"; } + @Override public EntityType getType() { return EntityType.SQUID; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java index 5de55b1347..4ef91a37d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java @@ -13,26 +13,32 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { super(server, entity); } + @Override public float getYield() { return getHandle().yield; } + @Override public boolean isIncendiary() { return getHandle().isIncendiary; } + @Override public void setIsIncendiary(boolean isIncendiary) { getHandle().isIncendiary = isIncendiary; } + @Override public void setYield(float yield) { getHandle().yield = yield; } + @Override public int getFuseTicks() { return getHandle().getFuseTicks(); } + @Override public void setFuseTicks(int fuseTicks) { getHandle().setFuseTicks(fuseTicks); } @@ -47,10 +53,12 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { return "CraftTNTPrimed"; } + @Override public EntityType getType() { return EntityType.PRIMED_TNT; } + @Override public Entity getSource() { EntityLiving source = getHandle().getSource(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java index 2498fba315..5dfa40dda1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -29,6 +29,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat getHandle().setOwnerUUID(uuid); } + @Override public AnimalTamer getOwner() { if (getOwnerUUID() == null) { return null; @@ -42,10 +43,12 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat return owner; } + @Override public boolean isTamed() { return getHandle().isTamed(); } + @Override public void setOwner(AnimalTamer tamer) { if (tamer != null) { setTamed(true); @@ -57,6 +60,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat } } + @Override public void setTamed(boolean tame) { getHandle().setTamed(tame); if (!tame) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java index fb3416e658..338bc530c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java @@ -20,6 +20,7 @@ public class CraftThrownExpBottle extends CraftProjectile implements ThrownExpBo return "EntityThrownExpBottle"; } + @Override public EntityType getType() { return EntityType.THROWN_EXP_BOTTLE; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index 2fb58a15e5..2400f33093 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java @@ -20,6 +20,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion { super(server, entity); } + @Override public Collection getEffects() { ImmutableList.Builder builder = ImmutableList.builder(); for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) { @@ -28,6 +29,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion { return builder.build(); } + @Override public ItemStack getItem() { return CraftItemStack.asBukkitCopy(getHandle().getItem()); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 16eba14f73..8989fec812 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -25,14 +25,17 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { return "CraftVillager"; } + @Override public EntityType getType() { return EntityType.VILLAGER; } + @Override public Profession getProfession() { return Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(getHandle().getVillagerData().getProfession()).getKey().toUpperCase(Locale.ROOT)); } + @Override public void setProfession(Profession profession) { Validate.notNull(profession); getHandle().setVillagerData(getHandle().getVillagerData().withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT))))); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java index fb14179c34..244e4dc8ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java @@ -20,6 +20,7 @@ public class CraftWitch extends CraftRaider implements Witch { return "CraftWitch"; } + @Override public EntityType getType() { return EntityType.WITCH; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java index 3df0fcb9b6..38b555cc7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java @@ -29,6 +29,7 @@ public class CraftWither extends CraftMonster implements Wither { return "CraftWither"; } + @Override public EntityType getType() { return EntityType.WITHER; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java index 563177e9a2..93616809de 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java @@ -30,6 +30,7 @@ public class CraftWitherSkull extends CraftFireball implements WitherSkull { return "CraftWitherSkull"; } + @Override public EntityType getType() { return EntityType.WITHER_SKULL; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index 55ce37c7f6..80244fba3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -12,10 +12,12 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf { super(server, wolf); } + @Override public boolean isAngry() { return getHandle().isAngry(); } + @Override public void setAngry(boolean angry) { getHandle().setAngry(angry); } @@ -30,10 +32,12 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf { return EntityType.WOLF; } + @Override public DyeColor getCollarColor() { return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getColorIndex()); } + @Override public void setCollarColor(DyeColor color) { getHandle().setCollarColor(EnumColor.fromColorIndex(color.getWoolData())); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index c28ccd0d98..0429cf020e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -24,18 +24,22 @@ public class CraftZombie extends CraftMonster implements Zombie { return "CraftZombie"; } + @Override public EntityType getType() { return EntityType.ZOMBIE; } + @Override public boolean isBaby() { return getHandle().isBaby(); } + @Override public void setBaby(boolean flag) { getHandle().setBaby(flag); } + @Override public boolean isVillager() { return getHandle() instanceof EntityZombieVillager; } diff --git a/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java index 6dee2296f7..78b91bb2bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java @@ -17,6 +17,7 @@ public class CustomHelpTopic extends HelpTopic { this.fullText = shortText + "\n" + fullText; } + @Override public boolean canSee(CommandSender sender) { if (sender instanceof ConsoleCommandSender) { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java index 6f4b22b99a..6133235c17 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java @@ -34,6 +34,7 @@ public class MultipleCommandAliasHelpTopic extends HelpTopic { fullText = ChatColor.GOLD + "Alias for: " + ChatColor.WHITE + getShortText(); } + @Override public boolean canSee(CommandSender sender) { if (amendedPermission == null) { if (sender instanceof ConsoleCommandSender) { diff --git a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopicFactory.java b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopicFactory.java index 36ddc97683..de3ed3c96f 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopicFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopicFactory.java @@ -9,6 +9,7 @@ import org.bukkit.help.HelpTopicFactory; */ public class MultipleCommandAliasHelpTopicFactory implements HelpTopicFactory { + @Override public HelpTopic createTopic(MultipleCommandAlias multipleCommandAlias) { return new MultipleCommandAliasHelpTopic(multipleCommandAlias); } diff --git a/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java b/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java index be79875ad7..cbf9d190af 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java +++ b/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java @@ -54,6 +54,7 @@ public class SimpleHelpMap implements HelpMap { registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory()); } + @Override public synchronized HelpTopic getHelpTopic(String topicName) { if (topicName.equals("")) { return defaultTopic; @@ -66,10 +67,12 @@ public class SimpleHelpMap implements HelpMap { return null; } + @Override public Collection getHelpTopics() { return helpTopics.values(); } + @Override public synchronized void addTopic(HelpTopic topic) { // Existing topics take priority if (!helpTopics.containsKey(topic.getName())) { @@ -77,10 +80,12 @@ public class SimpleHelpMap implements HelpMap { } } + @Override public synchronized void clear() { helpTopics.clear(); } + @Override public List getIgnoredPlugins() { return yaml.getIgnoredPlugins(); } @@ -216,6 +221,7 @@ public class SimpleHelpMap implements HelpMap { return false; } + @Override public void registerHelpTopicFactory(Class commandClass, HelpTopicFactory factory) { if (!Command.class.isAssignableFrom(commandClass) && !CommandExecutor.class.isAssignableFrom(commandClass)) { throw new IllegalArgumentException("commandClass must implement either Command or CommandExecutor!"); @@ -225,6 +231,7 @@ public class SimpleHelpMap implements HelpMap { private class IsCommandTopicPredicate implements Predicate { + @Override public boolean apply(HelpTopic topic) { return topic.getName().charAt(0) == '/'; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java index 424dc64522..03cad0b30e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java @@ -45,38 +45,47 @@ public class CraftEntityEquipment implements EntityEquipment { setItemInMainHand(stack); } + @Override public ItemStack getHelmet() { return getEquipment(EnumItemSlot.HEAD); } + @Override public void setHelmet(ItemStack helmet) { setEquipment(EnumItemSlot.HEAD, helmet); } + @Override public ItemStack getChestplate() { return getEquipment(EnumItemSlot.CHEST); } + @Override public void setChestplate(ItemStack chestplate) { setEquipment(EnumItemSlot.CHEST, chestplate); } + @Override public ItemStack getLeggings() { return getEquipment(EnumItemSlot.LEGS); } + @Override public void setLeggings(ItemStack leggings) { setEquipment(EnumItemSlot.LEGS, leggings); } + @Override public ItemStack getBoots() { return getEquipment(EnumItemSlot.FEET); } + @Override public void setBoots(ItemStack boots) { setEquipment(EnumItemSlot.FEET, boots); } + @Override public ItemStack[] getArmorContents() { ItemStack[] armor = new ItemStack[]{ getEquipment(EnumItemSlot.FEET), @@ -87,6 +96,7 @@ public class CraftEntityEquipment implements EntityEquipment { return armor; } + @Override public void setArmorContents(ItemStack[] items) { setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null); setEquipment(EnumItemSlot.LEGS, items.length >= 2 ? items[1] : null); @@ -102,12 +112,14 @@ public class CraftEntityEquipment implements EntityEquipment { entity.getHandle().setSlot(slot, CraftItemStack.asNMSCopy(stack)); } + @Override public void clear() { for (EnumItemSlot slot : EnumItemSlot.values()) { setEquipment(slot, null); } } + @Override public Entity getHolder() { return entity; } @@ -142,34 +154,42 @@ public class CraftEntityEquipment implements EntityEquipment { setDropChance(EnumItemSlot.OFFHAND, chance); } + @Override public float getHelmetDropChance() { return getDropChance(EnumItemSlot.HEAD); } + @Override public void setHelmetDropChance(float chance) { setDropChance(EnumItemSlot.HEAD, chance); } + @Override public float getChestplateDropChance() { return getDropChance(EnumItemSlot.CHEST); } + @Override public void setChestplateDropChance(float chance) { setDropChance(EnumItemSlot.CHEST, chance); } + @Override public float getLeggingsDropChance() { return getDropChance(EnumItemSlot.LEGS); } + @Override public void setLeggingsDropChance(float chance) { setDropChance(EnumItemSlot.LEGS, chance); } + @Override public float getBootsDropChance() { return getDropChance(EnumItemSlot.FEET); } + @Override public void setBootsDropChance(float chance) { setDropChance(EnumItemSlot.FEET, chance); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 3a2b57ae71..9fbedcede8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -40,10 +40,12 @@ public class CraftInventory implements Inventory { return inventory; } + @Override public int getSize() { return getInventory().getSize(); } + @Override public ItemStack getItem(int index) { net.minecraft.server.ItemStack item = getInventory().getItem(index); return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item); @@ -71,12 +73,14 @@ public class CraftInventory implements Inventory { setContents(items); } + @Override public ItemStack[] getContents() { List mcItems = getInventory().getContents(); return asCraftMirror(mcItems); } + @Override public void setContents(ItemStack[] items) { if (getSize() < items.length) { throw new IllegalArgumentException("Invalid inventory size; expected " + getSize() + " or less"); @@ -91,10 +95,12 @@ public class CraftInventory implements Inventory { } } + @Override public void setItem(int index, ItemStack item) { getInventory().setItem(index, CraftItemStack.asNMSCopy(item)); } + @Override public boolean contains(Material material) { Validate.notNull(material, "Material cannot be null"); material = CraftLegacy.fromLegacy(material); @@ -106,6 +112,7 @@ public class CraftInventory implements Inventory { return false; } + @Override public boolean contains(ItemStack item) { if (item == null) { return false; @@ -118,6 +125,7 @@ public class CraftInventory implements Inventory { return false; } + @Override public boolean contains(Material material, int amount) { Validate.notNull(material, "Material cannot be null"); material = CraftLegacy.fromLegacy(material); @@ -134,6 +142,7 @@ public class CraftInventory implements Inventory { return false; } + @Override public boolean contains(ItemStack item, int amount) { if (item == null) { return false; @@ -149,6 +158,7 @@ public class CraftInventory implements Inventory { return false; } + @Override public boolean containsAtLeast(ItemStack item, int amount) { if (item == null) { return false; @@ -164,6 +174,7 @@ public class CraftInventory implements Inventory { return false; } + @Override public HashMap all(Material material) { Validate.notNull(material, "Material cannot be null"); material = CraftLegacy.fromLegacy(material); @@ -179,6 +190,7 @@ public class CraftInventory implements Inventory { return slots; } + @Override public HashMap all(ItemStack item) { HashMap slots = new HashMap(); if (item != null) { @@ -192,6 +204,7 @@ public class CraftInventory implements Inventory { return slots; } + @Override public int first(Material material) { Validate.notNull(material, "Material cannot be null"); material = CraftLegacy.fromLegacy(material); @@ -205,6 +218,7 @@ public class CraftInventory implements Inventory { return -1; } + @Override public int first(ItemStack item) { return first(item, true); } @@ -224,6 +238,7 @@ public class CraftInventory implements Inventory { return -1; } + @Override public int firstEmpty() { ItemStack[] inventory = getStorageContents(); for (int i = 0; i < inventory.length; i++) { @@ -262,6 +277,7 @@ public class CraftInventory implements Inventory { return -1; } + @Override public HashMap addItem(ItemStack... items) { Validate.noNullElements(items, "Item cannot be null"); HashMap leftover = new HashMap(); @@ -327,6 +343,7 @@ public class CraftInventory implements Inventory { return leftover; } + @Override public HashMap removeItem(ItemStack... items) { Validate.notNull(items, "Items cannot be null"); HashMap leftover = new HashMap(); @@ -374,6 +391,7 @@ public class CraftInventory implements Inventory { return getInventory().getMaxStackSize(); } + @Override public void remove(Material material) { Validate.notNull(material, "Material cannot be null"); material = CraftLegacy.fromLegacy(material); @@ -385,6 +403,7 @@ public class CraftInventory implements Inventory { } } + @Override public void remove(ItemStack item) { ItemStack[] items = getStorageContents(); for (int i = 0; i < items.length; i++) { @@ -394,20 +413,24 @@ public class CraftInventory implements Inventory { } } + @Override public void clear(int index) { setItem(index, null); } + @Override public void clear() { for (int i = 0; i < getSize(); i++) { clear(i); } } + @Override public ListIterator iterator() { return new InventoryIterator(this); } + @Override public ListIterator iterator(int index) { if (index < 0) { index += getSize() + 1; // ie, with -1, previous() will return the last element @@ -415,10 +438,12 @@ public class CraftInventory implements Inventory { return new InventoryIterator(this, index); } + @Override public List getViewers() { return this.inventory.getViewers(); } + @Override public InventoryType getType() { // Thanks to Droppers extending Dispensers, Blast Furnaces & Smokers extending Furnace, order is important. if (inventory instanceof InventoryCrafting) { @@ -470,14 +495,17 @@ public class CraftInventory implements Inventory { } } + @Override public InventoryHolder getHolder() { return inventory.getOwner(); } + @Override public int getMaxStackSize() { return inventory.getMaxStackSize(); } + @Override public void setMaxStackSize(int size) { inventory.setMaxStackSize(size); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java index fa15ff5222..163c572ca4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBeacon.java @@ -9,10 +9,12 @@ public class CraftInventoryBeacon extends CraftInventory implements BeaconInvent super(beacon); } + @Override public void setItem(ItemStack item) { setItem(0, item); } + @Override public ItemStack getItem() { return getItem(0); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBrewer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBrewer.java index 368355ac17..5fa8330410 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBrewer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryBrewer.java @@ -10,10 +10,12 @@ public class CraftInventoryBrewer extends CraftInventory implements BrewerInvent super(inventory); } + @Override public ItemStack getIngredient() { return getItem(3); } + @Override public void setIngredient(ItemStack ingredient) { setItem(3, ingredient); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java index c2513aa8e4..25eff35e0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java @@ -81,18 +81,21 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn } } + @Override public ItemStack[] getMatrix() { List matrix = getMatrixInventory().getContents(); return asCraftMirror(matrix); } + @Override public ItemStack getResult() { net.minecraft.server.ItemStack item = getResultInventory().getItem(0); if (!item.isEmpty()) return CraftItemStack.asCraftMirror(item); return null; } + @Override public void setMatrix(ItemStack[] contents) { if (getMatrixInventory().getSize() > contents.length) { throw new IllegalArgumentException("Invalid inventory size; expected " + getMatrixInventory().getSize() + " or less"); @@ -107,11 +110,13 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn } } + @Override public void setResult(ItemStack item) { List contents = getResultInventory().getContents(); contents.set(0, CraftItemStack.asNMSCopy(item)); } + @Override public Recipe getRecipe() { IRecipe recipe = getInventory().getCurrentRecipe(); return recipe == null ? null : recipe.toBukkitRecipe(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java index 0f4975b40a..c7f9424549 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -62,14 +62,17 @@ public class CraftInventoryCustom extends CraftInventory { this.type = InventoryType.CHEST; } + @Override public int getSize() { return items.size(); } + @Override public ItemStack getItem(int i) { return items.get(i); } + @Override public ItemStack splitStack(int i, int j) { ItemStack stack = this.getItem(i); ItemStack result; @@ -85,6 +88,7 @@ public class CraftInventoryCustom extends CraftInventory { return result; } + @Override public ItemStack splitWithoutUpdate(int i) { ItemStack stack = this.getItem(i); ItemStack result; @@ -99,6 +103,7 @@ public class CraftInventoryCustom extends CraftInventory { return result; } + @Override public void setItem(int i, ItemStack itemstack) { items.set(i, itemstack); if (itemstack != ItemStack.a && this.getMaxStackSize() > 0 && itemstack.getCount() > this.getMaxStackSize()) { @@ -106,32 +111,40 @@ public class CraftInventoryCustom extends CraftInventory { } } + @Override public int getMaxStackSize() { return maxStack; } + @Override public void setMaxStackSize(int size) { maxStack = size; } + @Override public void update() {} + @Override public boolean a(EntityHuman entityhuman) { return true; } + @Override public List getContents() { return items; } + @Override public void onOpen(CraftHumanEntity who) { viewers.add(who); } + @Override public void onClose(CraftHumanEntity who) { viewers.remove(who); } + @Override public List getViewers() { return viewers; } @@ -140,10 +153,12 @@ public class CraftInventoryCustom extends CraftInventory { return type; } + @Override public InventoryHolder getOwner() { return owner; } + @Override public boolean b(int i, ItemStack itemstack) { return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java index 6665b771f1..8932d45085 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java @@ -31,10 +31,12 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC } } + @Override public Inventory getLeftSide() { return left; } + @Override public Inventory getRightSide() { return right; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java index 8fd083f053..0430125455 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java @@ -10,26 +10,32 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve super(inventory); } + @Override public ItemStack getResult() { return getItem(2); } + @Override public ItemStack getFuel() { return getItem(1); } + @Override public ItemStack getSmelting() { return getItem(0); } + @Override public void setFuel(ItemStack stack) { setItem(1,stack); } + @Override public void setResult(ItemStack stack) { setItem(2,stack); } + @Override public void setSmelting(ItemStack stack) { setItem(0,stack); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java index 173818e682..63991bf4be 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java @@ -10,10 +10,12 @@ public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements super(inventory); } + @Override public ItemStack getArmor() { return getItem(1); } + @Override public void setArmor(ItemStack stack) { setItem(1, stack); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index d5b90069c0..5873b76236 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -102,48 +102,59 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.defaultContainer.windowId, index, CraftItemStack.asNMSCopy(item))); } + @Override public int getHeldItemSlot() { return getInventory().itemInHandIndex; } + @Override public void setHeldItemSlot(int slot) { Validate.isTrue(slot >= 0 && slot < PlayerInventory.getHotbarSize(), "Slot is not between 0 and 8 inclusive"); this.getInventory().itemInHandIndex = slot; ((CraftPlayer) this.getHolder()).getHandle().playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(slot)); } + @Override public ItemStack getHelmet() { return getItem(getSize() - 2); } + @Override public ItemStack getChestplate() { return getItem(getSize() - 3); } + @Override public ItemStack getLeggings() { return getItem(getSize() - 4); } + @Override public ItemStack getBoots() { return getItem(getSize() - 5); } + @Override public void setHelmet(ItemStack helmet) { setItem(getSize() - 2, helmet); } + @Override public void setChestplate(ItemStack chestplate) { setItem(getSize() - 3, chestplate); } + @Override public void setLeggings(ItemStack leggings) { setItem(getSize() - 4, leggings); } + @Override public void setBoots(ItemStack boots) { setItem(getSize() - 5, boots); } + @Override public ItemStack[] getArmorContents() { return asCraftMirror(getInventory().armor); } @@ -218,34 +229,42 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } + @Override public float getHelmetDropChance() { return 1; } + @Override public void setHelmetDropChance(float chance) { throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } + @Override public float getChestplateDropChance() { return 1; } + @Override public void setChestplateDropChance(float chance) { throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } + @Override public float getLeggingsDropChance() { return 1; } + @Override public void setLeggingsDropChance(float chance) { throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } + @Override public float getBootsDropChance() { return 1; } + @Override public void setBootsDropChance(float chance) { throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java index f529367c8c..a01368f697 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -39,6 +39,7 @@ public final class CraftItemFactory implements ItemFactory { private CraftItemFactory() { } + @Override public boolean isApplicable(ItemMeta meta, ItemStack itemstack) { if (itemstack == null) { return false; @@ -46,6 +47,7 @@ public final class CraftItemFactory implements ItemFactory { return isApplicable(meta, itemstack.getType()); } + @Override public boolean isApplicable(ItemMeta meta, Material type) { type = CraftLegacy.fromLegacy(type); // This may be called from legacy item stacks, try to get the right material if (type == null || meta == null) { @@ -58,6 +60,7 @@ public final class CraftItemFactory implements ItemFactory { return ((CraftMetaItem) meta).applicableTo(type); } + @Override public ItemMeta getItemMeta(Material material) { Validate.notNull(material, "Material cannot be null"); return getItemMeta(material, null); @@ -254,6 +257,7 @@ public final class CraftItemFactory implements ItemFactory { } } + @Override public boolean equals(ItemMeta meta1, ItemMeta meta2) { if (meta1 == meta2) { return true; @@ -291,11 +295,13 @@ public final class CraftItemFactory implements ItemFactory { return instance; } + @Override public ItemMeta asMetaFor(ItemMeta meta, ItemStack stack) { Validate.notNull(stack, "Stack cannot be null"); return asMetaFor(meta, stack.getType()); } + @Override public ItemMeta asMetaFor(ItemMeta meta, Material material) { Validate.notNull(material, "Material cannot be null"); if (!(meta instanceof CraftMetaItem)) { @@ -304,6 +310,7 @@ public final class CraftItemFactory implements ItemFactory { return getItemMeta(material, (CraftMetaItem) meta); } + @Override public Color getDefaultLeatherColor() { return DEFAULT_LEATHER_COLOR; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index 5e3cc48fca..40bf2e8612 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -161,26 +161,32 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { } } + @Override public boolean hasAuthor() { return !Strings.isNullOrEmpty(author); } + @Override public boolean hasTitle() { return !Strings.isNullOrEmpty(title); } + @Override public boolean hasPages() { return !pages.isEmpty(); } + @Override public boolean hasGeneration() { return generation != null; } + @Override public String getTitle() { return this.title; } + @Override public boolean setTitle(final String title) { if (title == null) { this.title = null; @@ -193,10 +199,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { return true; } + @Override public String getAuthor() { return this.author; } + @Override public void setAuthor(final String author) { this.author = author; } @@ -211,11 +219,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { this.generation = (generation == null) ? null : generation.ordinal(); } + @Override public String getPage(final int page) { Validate.isTrue(isValidPage(page), "Invalid page number"); return CraftChatMessage.fromComponent(pages.get(page - 1)); } + @Override public void setPage(final int page, final String text) { if (!isValidPage(page)) { throw new IllegalArgumentException("Invalid page number " + page + "/" + pages.size()); @@ -225,12 +235,14 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { pages.set(page - 1, CraftChatMessage.fromString(newText, true)[0]); } + @Override public void setPages(final String... pages) { this.pages.clear(); addPage(pages); } + @Override public void addPage(final String... pages) { for (String page : pages) { if (this.pages.size() >= MAX_PAGES) { @@ -247,14 +259,17 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { } } + @Override public int getPageCount() { return pages.size(); } + @Override public List getPages() { return pages.stream().map(CraftChatMessage::fromComponent).collect(ImmutableList.toImmutableList()); } + @Override public void setPages(List pages) { this.pages.clear(); for (String page : pages) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java index e6cefff6ce..f5feea2071 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java @@ -123,10 +123,12 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage return !hasStoredEnchants(); } + @Override public boolean hasStoredEnchant(Enchantment ench) { return hasStoredEnchants() && enchantments.containsKey(ench); } + @Override public int getStoredEnchantLevel(Enchantment ench) { Integer level = hasStoredEnchants() ? enchantments.get(ench) : null; if (level == null) { @@ -135,10 +137,12 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage return level; } + @Override public Map getStoredEnchants() { return hasStoredEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.of(); } + @Override public boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreRestrictions) { if (enchantments == null) { enchantments = new HashMap(4); @@ -151,14 +155,17 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage return false; } + @Override public boolean removeStoredEnchant(Enchantment ench) { return hasStoredEnchants() && enchantments.remove(ench) != null; } + @Override public boolean hasStoredEnchants() { return !(enchantments == null || enchantments.isEmpty()); } + @Override public boolean hasConflictingStoredEnchant(Enchantment ench) { return checkConflictingEnchants(enchantments, ench); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java index ccf2ac1ed3..4c68273fc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java @@ -184,6 +184,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { safelyAddEffects(effects); } + @Override public boolean hasEffects() { return !(effects == null || effects.isEmpty()); } @@ -330,6 +331,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { return meta; } + @Override public void addEffect(FireworkEffect effect) { Validate.notNull(effect, "Effect cannot be null"); if (this.effects == null) { @@ -338,6 +340,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { this.effects.add(effect); } + @Override public void addEffects(FireworkEffect...effects) { Validate.notNull(effects, "Effects cannot be null"); if (effects.length == 0) { @@ -355,19 +358,23 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { } } + @Override public void addEffects(Iterable effects) { Validate.notNull(effects, "Effects cannot be null"); safelyAddEffects(effects); } + @Override public List getEffects() { return this.effects == null ? ImmutableList.of() : ImmutableList.copyOf(this.effects); } + @Override public int getEffectsSize() { return this.effects == null ? 0 : this.effects.size(); } + @Override public void removeEffect(int index) { if (this.effects == null) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); @@ -376,14 +383,17 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { } } + @Override public void clearEffects() { this.effects = null; } + @Override public int getPower() { return this.power; } + @Override public void setPower(int power) { Validate.isTrue(power >= 0, "Power cannot be less than zero: ", power); Validate.isTrue(power < 0x80, "Power cannot be more than 127: ", power); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index d9a3b5467b..5b8c694f9a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -191,6 +191,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } + @Override public Map serialize() { throw new AssertionError(); } @@ -747,14 +748,17 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasCustomModelData() || hasBlockData() || hasRepairCost() || !unhandledTags.isEmpty() || !persistentDataContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers()); } + @Override public String getDisplayName() { return CraftChatMessage.fromComponent(displayName, EnumChatFormat.WHITE); } + @Override public final void setDisplayName(String name) { this.displayName = CraftChatMessage.wrapOrNull(name); } + @Override public boolean hasDisplayName() { return displayName != null; } @@ -774,19 +778,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return locName != null; } + @Override public boolean hasLore() { return this.lore != null && !this.lore.isEmpty(); } + @Override public boolean hasRepairCost() { return repairCost > 0; } + @Override public boolean hasEnchant(Enchantment ench) { Validate.notNull(ench, "Enchantment cannot be null"); return hasEnchants() && enchantments.containsKey(ench); } + @Override public int getEnchantLevel(Enchantment ench) { Validate.notNull(ench, "Enchantment cannot be null"); Integer level = hasEnchants() ? enchantments.get(ench) : null; @@ -796,10 +804,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return level; } + @Override public Map getEnchants() { return hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.of(); } + @Override public boolean addEnchant(Enchantment ench, int level, boolean ignoreRestrictions) { Validate.notNull(ench, "Enchantment cannot be null"); if (enchantments == null) { @@ -813,15 +823,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return false; } + @Override public boolean removeEnchant(Enchantment ench) { Validate.notNull(ench, "Enchantment cannot be null"); return hasEnchants() && enchantments.remove(ench) != null; } + @Override public boolean hasEnchants() { return !(enchantments == null || enchantments.isEmpty()); } + @Override public boolean hasConflictingEnchant(Enchantment ench) { return checkConflictingEnchants(enchantments, ench); } @@ -863,10 +876,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return (byte) (1 << hideFlag.ordinal()); } + @Override public List getLore() { return this.lore == null ? null : new ArrayList(Lists.transform(this.lore, (line) -> CraftChatMessage.fromComponent(line, EnumChatFormat.DARK_PURPLE))); } + @Override public void setLore(List lore) { // too tired to think if .clone is better if (lore == null) { this.lore = null; @@ -911,10 +926,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates(); } + @Override public int getRepairCost() { return repairCost; } + @Override public void setRepairCost(int cost) { // TODO: Does this have limits? repairCost = cost; } @@ -1182,6 +1199,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } + @Override public final Map serialize() { ImmutableMap.Builder map = ImmutableMap.builder(); map.put(SerializableMeta.TYPE_FIELD, SerializableMeta.classMap.get(getClass())); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java index 29471e0f74..2d2d73cc07 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java @@ -59,6 +59,7 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo } } + @Override void applyToItem(NBTTagCompound itemData) { super.applyToItem(itemData); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java index c7a159c821..ecb12457a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java @@ -83,10 +83,12 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta { return (CraftMetaLeatherArmor) super.clone(); } + @Override public Color getColor() { return color; } + @Override public void setColor(Color color) { this.color = color == null ? DEFAULT_LEATHER_COLOR : color; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java index 82b0c6aea7..7489e63a15 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java @@ -167,10 +167,12 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta { return scaling != SCALING_EMPTY; } + @Override public boolean isScaling() { return scaling == SCALING_TRUE; } + @Override public void setScaling(boolean scaling) { this.scaling = scaling ? SCALING_TRUE : SCALING_FALSE; } @@ -248,6 +250,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta { } + @Override public CraftMetaMap clone() { return (CraftMetaMap) super.clone(); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java index 821243a3a7..bb921c928f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java @@ -175,10 +175,12 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { return type; } + @Override public boolean hasCustomEffects() { return customEffects != null; } + @Override public List getCustomEffects() { if (hasCustomEffects()) { return ImmutableList.copyOf(customEffects); @@ -186,6 +188,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { return ImmutableList.of(); } + @Override public boolean addCustomEffect(PotionEffect effect, boolean overwrite) { Validate.notNull(effect, "Potion effect must not be null"); @@ -210,6 +213,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { } } + @Override public boolean removeCustomEffect(PotionEffectType type) { Validate.notNull(type, "Potion effect type must not be null"); @@ -232,11 +236,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { return changed; } + @Override public boolean hasCustomEffect(PotionEffectType type) { Validate.notNull(type, "Potion effect type must not be null"); return indexOfEffect(type) != -1; } + @Override public boolean setMainEffect(PotionEffectType type) { Validate.notNull(type, "Potion effect type must not be null"); int index = indexOfEffect(type); @@ -263,6 +269,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { return -1; } + @Override public boolean clearCustomEffects() { boolean changed = hasCustomEffects(); customEffects = null; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java index c63d0e6107..abc9f6ddbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -120,10 +120,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { return (CraftMetaSkull) super.clone(); } + @Override public boolean hasOwner() { return profile != null && profile.getName() != null; } + @Override public String getOwner() { return hasOwner() ? profile.getName() : null; } @@ -143,6 +145,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { return null; } + @Override public boolean setOwner(String name) { if (name != null && name.length() > MAX_OWNER_LENGTH) { return false; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java index 1ad3bc03c5..eee51f07a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java @@ -149,6 +149,7 @@ class CraftMetaTropicalFishBucket extends CraftMetaItem implements TropicalFishB } + @Override public CraftMetaTropicalFishBucket clone() { return (CraftMetaTropicalFishBucket) super.clone(); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java index 28d0ad025d..6dbd249f54 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java @@ -42,6 +42,7 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe { return ret; } + @Override public void addToCraftingManager() { String[] shape = this.getShape(); Map ingred = this.getChoiceMap(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java index 2c8c6b813f..4aba511fe8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java @@ -36,6 +36,7 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe return ret; } + @Override public void addToCraftingManager() { List ingred = this.getChoiceList(); NonNullList data = NonNullList.a(ingred.size(), RecipeItemStack.a); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryIterator.java index 1ae4eabc8f..de558eef3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryIterator.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryIterator.java @@ -19,32 +19,39 @@ public class InventoryIterator implements ListIterator { this.nextIndex = index; } + @Override public boolean hasNext() { return nextIndex < inventory.getSize(); } + @Override public ItemStack next() { lastDirection = true; return inventory.getItem(nextIndex++); } + @Override public int nextIndex() { return nextIndex; } + @Override public boolean hasPrevious() { return nextIndex > 0; } + @Override public ItemStack previous() { lastDirection = false; return inventory.getItem(--nextIndex); } + @Override public int previousIndex() { return nextIndex - 1; } + @Override public void set(ItemStack item) { if (lastDirection == null) { throw new IllegalStateException("No current item!"); @@ -53,10 +60,12 @@ public class InventoryIterator implements ListIterator { inventory.setItem(i, item); } + @Override public void add(ItemStack item) { throw new UnsupportedOperationException("Can't change the size of an inventory!"); } + @Override public void remove() { throw new UnsupportedOperationException("Can't change the size of an inventory!"); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java index 9221600b5a..33fd782642 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java @@ -12,14 +12,17 @@ public class RecipeIterator implements Iterator { this.recipes = MinecraftServer.getServer().getCraftingManager().b().iterator(); } + @Override public boolean hasNext() { return recipes.hasNext(); } + @Override public Recipe next() { return recipes.next().toBukkitRecipe(); } + @Override public void remove() { recipes.remove(); } diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java index 7372614c76..04b3ab0b4f 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java @@ -20,18 +20,22 @@ public class CraftMapCanvas implements MapCanvas { Arrays.fill(buffer, (byte) -1); } + @Override public CraftMapView getMapView() { return mapView; } + @Override public MapCursorCollection getCursors() { return cursors; } + @Override public void setCursors(MapCursorCollection cursors) { this.cursors = cursors; } + @Override public void setPixel(int x, int y, byte color) { if (x < 0 || y < 0 || x >= 128 || y >= 128) return; @@ -41,12 +45,14 @@ public class CraftMapCanvas implements MapCanvas { } } + @Override public byte getPixel(int x, int y) { if (x < 0 || y < 0 || x >= 128 || y >= 128) return 0; return buffer[y * 128 + x]; } + @Override public byte getBasePixel(int x, int y) { if (x < 0 || y < 0 || x >= 128 || y >= 128) return 0; @@ -61,6 +67,7 @@ public class CraftMapCanvas implements MapCanvas { return buffer; } + @Override public void drawImage(int x, int y, Image image) { byte[] bytes = MapPalette.imageToBytes(image); for (int x2 = 0; x2 < image.getWidth(null); ++x2) { @@ -70,6 +77,7 @@ public class CraftMapCanvas implements MapCanvas { } } + @Override public void drawText(int x, int y, MapFont font, String text) { int xStart = x; byte color = MapPalette.DARK_GRAY; diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java index 877c41a599..bdced54b21 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java @@ -44,18 +44,22 @@ public final class CraftMapView implements MapView { } } + @Override public boolean isVirtual() { return renderers.size() > 0 && !(renderers.get(0) instanceof CraftMapRenderer); } + @Override public Scale getScale() { return Scale.valueOf(worldMap.scale); } + @Override public void setScale(Scale scale) { worldMap.scale = scale.getValue(); } + @Override public World getWorld() { DimensionManager dimension = worldMap.map; WorldServer world = MinecraftServer.getServer().getWorldServer(dimension); @@ -63,30 +67,37 @@ public final class CraftMapView implements MapView { return (world == null) ? null : world.getWorld(); } + @Override public void setWorld(World world) { worldMap.map = ((CraftWorld) world).getHandle().dimension; } + @Override public int getCenterX() { return worldMap.centerX; } + @Override public int getCenterZ() { return worldMap.centerZ; } + @Override public void setCenterX(int x) { worldMap.centerX = x; } + @Override public void setCenterZ(int z) { worldMap.centerZ = z; } + @Override public List getRenderers() { return new ArrayList(renderers); } + @Override public void addRenderer(MapRenderer renderer) { if (!renderers.contains(renderer)) { renderers.add(renderer); @@ -95,6 +106,7 @@ public final class CraftMapView implements MapView { } } + @Override public boolean removeRenderer(MapRenderer renderer) { if (renderers.contains(renderer)) { renderers.remove(renderer); diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java index 648636b19d..87d680a877 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java @@ -17,6 +17,7 @@ import org.bukkit.potion.PotionType; public class CraftPotionBrewer implements PotionBrewer { private static final Map> cache = Maps.newHashMap(); + @Override public Collection getEffects(PotionType damage, boolean upgraded, boolean extended) { if (cache.containsKey(damage)) return cache.get(damage); diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java index 8040e8d349..692aca0482 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java @@ -33,14 +33,17 @@ class CraftAsyncTask extends CraftTask { } workers.add( new BukkitWorker() { + @Override public Thread getThread() { return thread; } + @Override public int getTaskId() { return CraftAsyncTask.this.getTaskId(); } + @Override public Plugin getOwner() { return CraftAsyncTask.this.getOwner(); } @@ -95,6 +98,7 @@ class CraftAsyncTask extends CraftTask { return workers; } + @Override boolean cancel0() { synchronized (workers) { // Synchronizing here prevents race condition for a completing task diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java index b47ed943b1..1e20385fd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java @@ -19,6 +19,7 @@ class CraftFuture extends CraftTask implements Future { this.callable = callable; } + @Override public synchronized boolean cancel(final boolean mayInterruptIfRunning) { if (getPeriod() != CraftTask.NO_REPEATING) { return false; @@ -27,11 +28,13 @@ class CraftFuture extends CraftTask implements Future { return true; } + @Override public boolean isDone() { final long period = this.getPeriod(); return period != CraftTask.NO_REPEATING && period != CraftTask.PROCESS_FOR_FUTURE; } + @Override public T get() throws CancellationException, InterruptedException, ExecutionException { try { return get(0, TimeUnit.MILLISECONDS); @@ -40,6 +43,7 @@ class CraftFuture extends CraftTask implements Future { } } + @Override public synchronized T get(long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { timeout = unit.toMillis(timeout); long period = this.getPeriod(); @@ -92,6 +96,7 @@ class CraftFuture extends CraftTask implements Future { } } + @Override synchronized boolean cancel0() { if (getPeriod() != CraftTask.NO_REPEATING) { return false; diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 071fc631b3..d694a2a24b 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -60,6 +60,7 @@ public class CraftScheduler implements BukkitScheduler { */ private final PriorityQueue pending = new PriorityQueue(10, new Comparator() { + @Override public int compare(final CraftTask o1, final CraftTask o2) { int value = Long.compare(o1.getNextRun(), o2.getNextRun()); @@ -227,6 +228,7 @@ public class CraftScheduler implements BukkitScheduler { } task = new CraftTask( new Runnable() { + @Override public void run() { if (!check(CraftScheduler.this.temp)) { check(CraftScheduler.this.pending); @@ -263,6 +265,7 @@ public class CraftScheduler implements BukkitScheduler { Validate.notNull(plugin, "Cannot cancel tasks of null plugin"); final CraftTask task = new CraftTask( new Runnable() { + @Override public void run() { check(CraftScheduler.this.pending); check(CraftScheduler.this.temp); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java index b22b506beb..5eaea24d25 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java @@ -24,18 +24,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective return objective; } + @Override public String getName() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return objective.getName(); } + @Override public String getDisplayName() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return CraftChatMessage.fromComponent(objective.getDisplayName()); } + @Override public void setDisplayName(String displayName) throws IllegalStateException, IllegalArgumentException { Validate.notNull(displayName, "Display name cannot be null"); Validate.isTrue(displayName.length() <= 128, "Display name '" + displayName + "' is longer than the limit of 128 characters"); @@ -44,18 +47,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective objective.setDisplayName(CraftChatMessage.fromString(displayName)[0]); // SPIGOT-4112: not nullable } + @Override public String getCriteria() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return criteria.bukkitName; } + @Override public boolean isModifiable() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return !criteria.criteria.isReadOnly(); } + @Override public void setDisplaySlot(DisplaySlot slot) throws IllegalStateException { CraftScoreboard scoreboard = checkState(); Scoreboard board = scoreboard.board; @@ -72,6 +78,7 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective } } + @Override public DisplaySlot getDisplaySlot() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); Scoreboard board = scoreboard.board; @@ -100,6 +107,7 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective return CraftScoreboardTranslations.toBukkitRender(this.objective.getRenderType()); } + @Override public Score getScore(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException { Validate.notNull(player, "Player cannot be null"); CraftScoreboard scoreboard = checkState(); @@ -107,6 +115,7 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective return new CraftScore(this, player.getName()); } + @Override public Score getScore(String entry) throws IllegalArgumentException, IllegalStateException { Validate.notNull(entry, "Entry cannot be null"); Validate.isTrue(entry.length() <= 40, "Score '" + entry + "' is longer than the limit of 40 characters"); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java index 3ed19d4db2..41d22d223d 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java @@ -24,18 +24,22 @@ final class CraftScore implements Score { this.entry = entry; } + @Override public OfflinePlayer getPlayer() { return Bukkit.getOfflinePlayer(entry); } + @Override public String getEntry() { return entry; } + @Override public Objective getObjective() { return objective; } + @Override public int getScore() throws IllegalStateException { Scoreboard board = objective.checkState().board; @@ -50,6 +54,7 @@ final class CraftScore implements Score { return 0; // Lazy } + @Override public void setScore(int score) throws IllegalStateException { objective.checkState().board.getPlayerScoreForObjective(entry, objective.getHandle()).setScore(score); } @@ -61,6 +66,7 @@ final class CraftScore implements Score { return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle()); } + @Override public CraftScoreboard getScoreboard() { return objective.getScoreboard(); } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java index c74b8330ca..e3036fe23f 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -49,12 +49,14 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return new CraftObjective(this, objective); } + @Override public Objective getObjective(String name) throws IllegalArgumentException { Validate.notNull(name, "Name cannot be null"); ScoreboardObjective nms = board.getObjective(name); return nms == null ? null : new CraftObjective(this, nms); } + @Override public ImmutableSet getObjectivesByCriteria(String criteria) throws IllegalArgumentException { Validate.notNull(criteria, "Criteria cannot be null"); @@ -68,6 +70,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return objectives.build(); } + @Override public ImmutableSet getObjectives() { return ImmutableSet.copyOf(Iterables.transform((Collection) this.board.getObjectives(), new Function() { @@ -78,6 +81,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { })); } + @Override public Objective getObjective(DisplaySlot slot) throws IllegalArgumentException { Validate.notNull(slot, "Display slot cannot be null"); ScoreboardObjective objective = board.getObjectiveForSlot(CraftScoreboardTranslations.fromBukkitSlot(slot)); @@ -87,12 +91,14 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return new CraftObjective(this, objective); } + @Override public ImmutableSet getScores(OfflinePlayer player) throws IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); return getScores(player.getName()); } + @Override public ImmutableSet getScores(String entry) throws IllegalArgumentException { Validate.notNull(entry, "Entry cannot be null"); @@ -103,12 +109,14 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return scores.build(); } + @Override public void resetScores(OfflinePlayer player) throws IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); resetScores(player.getName()); } + @Override public void resetScores(String entry) throws IllegalArgumentException { Validate.notNull(entry, "Entry cannot be null"); @@ -117,6 +125,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { } } + @Override public Team getPlayerTeam(OfflinePlayer player) throws IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); @@ -124,6 +133,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return team == null ? null : new CraftTeam(this, team); } + @Override public Team getEntryTeam(String entry) throws IllegalArgumentException { Validate.notNull(entry, "Entry cannot be null"); @@ -131,6 +141,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return team == null ? null : new CraftTeam(this, team); } + @Override public Team getTeam(String teamName) throws IllegalArgumentException { Validate.notNull(teamName, "Team name cannot be null"); @@ -138,6 +149,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return team == null ? null : new CraftTeam(this, team); } + @Override public ImmutableSet getTeams() { return ImmutableSet.copyOf(Iterables.transform((Collection) this.board.getTeams(), new Function() { @@ -148,6 +160,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { })); } + @Override public Team registerNewTeam(String name) throws IllegalArgumentException { Validate.notNull(name, "Team name cannot be null"); Validate.isTrue(name.length() <= 16, "Team name '" + name + "' is longer than the limit of 16 characters"); @@ -156,6 +169,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return new CraftTeam(this, board.createTeam(name)); } + @Override public ImmutableSet getPlayers() { ImmutableSet.Builder players = ImmutableSet.builder(); for (Object playerName : board.getPlayers()) { @@ -164,6 +178,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return players.build(); } + @Override public ImmutableSet getEntries() { ImmutableSet.Builder entries = ImmutableSet.builder(); for (Object entry : board.getPlayers()) { @@ -172,6 +187,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { return entries.build(); } + @Override public void clearSlot(DisplaySlot slot) throws IllegalArgumentException { Validate.notNull(slot, "Slot cannot be null"); board.setDisplaySlot(CraftScoreboardTranslations.fromBukkitSlot(slot), null); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java index afbc1a9603..fd9949e1e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -34,10 +34,12 @@ public final class CraftScoreboardManager implements ScoreboardManager { scoreboards.add(mainScoreboard); } + @Override public CraftScoreboard getMainScoreboard() { return mainScoreboard; } + @Override public CraftScoreboard getNewScoreboard() { CraftScoreboard scoreboard = new CraftScoreboard(new ScoreboardServer(server)); scoreboards.add(scoreboard); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java index 565b4e0681..bc92089eab 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -21,18 +21,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { this.team = team; } + @Override public String getName() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return team.getName(); } + @Override public String getDisplayName() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return CraftChatMessage.fromComponent(team.getDisplayName()); } + @Override public void setDisplayName(String displayName) throws IllegalStateException { Validate.notNull(displayName, "Display name cannot be null"); Validate.isTrue(displayName.length() <= 128, "Display name '" + displayName + "' is longer than the limit of 128 characters"); @@ -41,12 +44,14 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { team.setDisplayName(CraftChatMessage.fromString(displayName)[0]); // SPIGOT-4112: not nullable } + @Override public String getPrefix() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return CraftChatMessage.fromComponent(team.getPrefix()); } + @Override public void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException { Validate.notNull(prefix, "Prefix cannot be null"); Validate.isTrue(prefix.length() <= 64, "Prefix '" + prefix + "' is longer than the limit of 64 characters"); @@ -55,12 +60,14 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { team.setPrefix(CraftChatMessage.fromStringOrNull(prefix)); } + @Override public String getSuffix() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return CraftChatMessage.fromComponent(team.getSuffix()); } + @Override public void setSuffix(String suffix) throws IllegalStateException, IllegalArgumentException { Validate.notNull(suffix, "Suffix cannot be null"); Validate.isTrue(suffix.length() <= 64, "Suffix '" + suffix + "' is longer than the limit of 64 characters"); @@ -84,42 +91,49 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { team.setColor(CraftChatMessage.getColor(color)); } + @Override public boolean allowFriendlyFire() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return team.allowFriendlyFire(); } + @Override public void setAllowFriendlyFire(boolean enabled) throws IllegalStateException { CraftScoreboard scoreboard = checkState(); team.setAllowFriendlyFire(enabled); } + @Override public boolean canSeeFriendlyInvisibles() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return team.canSeeFriendlyInvisibles(); } + @Override public void setCanSeeFriendlyInvisibles(boolean enabled) throws IllegalStateException { CraftScoreboard scoreboard = checkState(); team.setCanSeeFriendlyInvisibles(enabled); } + @Override public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException { CraftScoreboard scoreboard = checkState(); return notchToBukkit(team.getNameTagVisibility()); } + @Override public void setNameTagVisibility(NameTagVisibility visibility) throws IllegalArgumentException { CraftScoreboard scoreboard = checkState(); team.setNameTagVisibility(bukkitToNotch(visibility)); } + @Override public Set getPlayers() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); @@ -141,17 +155,20 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { return entries.build(); } + @Override public int getSize() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); return team.getPlayerNameSet().size(); } + @Override public void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); addEntry(player.getName()); } + @Override public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException { Validate.notNull(entry, "Entry cannot be null"); CraftScoreboard scoreboard = checkState(); @@ -159,11 +176,13 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { scoreboard.board.addPlayerToTeam(entry, team); } + @Override public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); return removeEntry(player.getName()); } + @Override public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException { Validate.notNull(entry, "Entry cannot be null"); CraftScoreboard scoreboard = checkState(); @@ -176,11 +195,13 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { return true; } + @Override public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException { Validate.notNull(player, "OfflinePlayer cannot be null"); return hasEntry(player.getName()); } + @Override public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { Validate.notNull("Entry cannot be null"); diff --git a/src/main/java/org/bukkit/craftbukkit/util/DatFileFilter.java b/src/main/java/org/bukkit/craftbukkit/util/DatFileFilter.java index 712c44f145..66ff685d70 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DatFileFilter.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DatFileFilter.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FilenameFilter; public class DatFileFilter implements FilenameFilter { + @Override public boolean accept(File dir, String name) { return name.endsWith(".dat"); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/LazyHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LazyHashSet.java index dc76c616f1..1b2b4fb590 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/LazyHashSet.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LazyHashSet.java @@ -7,54 +7,67 @@ import java.util.Set; public abstract class LazyHashSet implements Set { Set reference = null; + @Override public int size() { return getReference().size(); } + @Override public boolean isEmpty() { return getReference().isEmpty(); } + @Override public boolean contains(Object o) { return getReference().contains(o); } + @Override public Iterator iterator() { return getReference().iterator(); } + @Override public Object[] toArray() { return getReference().toArray(); } + @Override public T[] toArray(T[] a) { return getReference().toArray(a); } + @Override public boolean add(E o) { return getReference().add(o); } + @Override public boolean remove(Object o) { return getReference().remove(o); } + @Override public boolean containsAll(Collection c) { return getReference().containsAll(c); } + @Override public boolean addAll(Collection c) { return getReference().addAll(c); } + @Override public boolean retainAll(Collection c) { return getReference().retainAll(c); } + @Override public boolean removeAll(Collection c) { return getReference().removeAll(c); } + @Override public void clear() { getReference().clear(); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java index f239cd6236..f267f99f96 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java @@ -21,6 +21,7 @@ public class TerminalConsoleWriterThread extends Thread { this.setDaemon(true); } + @Override public void run() { String message; diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java index 08d105603c..1aec70a1f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java +++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java @@ -43,6 +43,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc this(32); } + @Override public E get(int index) { rangeCheck(index); @@ -53,6 +54,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return (E) data[index]; } + @Override public E set(int index, E element) { rangeCheck(index); @@ -61,12 +63,14 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return old; } + @Override public boolean add(E element) { growIfNeeded(); data[size++] = element; return true; } + @Override public void add(int index, E element) { growIfNeeded(); System.arraycopy(data, index, data, index + 1, size - index); @@ -74,6 +78,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc size++; } + @Override public E remove(int index) { rangeCheck(index); @@ -87,6 +92,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return old; } + @Override public boolean remove(Object o) { int index = indexOf(o); if (index >= 0) { @@ -97,6 +103,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return false; } + @Override public int indexOf(Object o) { for (int i = 0; i < size; i++) { if (o == data[i] || o.equals(data[i])) { @@ -107,10 +114,12 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return -1; } + @Override public boolean contains(Object o) { return indexOf(o) >= 0; } + @Override public void clear() { // Create new array to reset memory usage to initial capacity size = 0; @@ -134,14 +143,17 @@ public class UnsafeList extends AbstractList implements List, RandomAcc } } + @Override public int size() { return size; } + @Override public boolean isEmpty() { return size == 0; } + @Override public Object clone() throws CloneNotSupportedException { UnsafeList copy = (UnsafeList) super.clone(); copy.data = Arrays.copyOf(data, size); @@ -154,6 +166,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return copy; } + @Override public Iterator iterator() { // Try to find an iterator that isn't in use for (Iterator iter : iterPool) { @@ -233,11 +246,13 @@ public class UnsafeList extends AbstractList implements List, RandomAcc valid = true; } + @Override public boolean hasNext() { valid = index != size; return valid; } + @Override public E next() { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); @@ -256,6 +271,7 @@ public class UnsafeList extends AbstractList implements List, RandomAcc return (E) data[lastRet = i]; } + @Override public void remove() { if (lastRet < 0) { throw new IllegalStateException(); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Waitable.java b/src/main/java/org/bukkit/craftbukkit/util/Waitable.java index 5cd1154348..a7ec02287d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Waitable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Waitable.java @@ -13,6 +13,7 @@ public abstract class Waitable implements Runnable { T value = null; Status status = Status.WAITING; + @Override public final void run() { synchronized (this) { if (status != Status.WAITING) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java index 712f2e10d8..166f4ee083 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java +++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java @@ -15,11 +15,13 @@ public final class WeakCollection implements Collection { collection = new ArrayList>(); } + @Override public boolean add(T value) { Validate.notNull(value, "Cannot add null value"); return collection.add(new WeakReference(value)); } + @Override public boolean addAll(Collection collection) { Collection> values = this.collection; boolean ret = false; @@ -30,10 +32,12 @@ public final class WeakCollection implements Collection { return ret; } + @Override public void clear() { collection.clear(); } + @Override public boolean contains(Object object) { if (object == null) { return false; @@ -46,19 +50,23 @@ public final class WeakCollection implements Collection { return false; } + @Override public boolean containsAll(Collection collection) { return toCollection().containsAll(collection); } + @Override public boolean isEmpty() { return !iterator().hasNext(); } + @Override public Iterator iterator() { return new Iterator() { Iterator> it = collection.iterator(); Object value = NO_VALUE; + @Override public boolean hasNext() { Object value = this.value; if (value != null && value != NO_VALUE) { @@ -81,6 +89,7 @@ public final class WeakCollection implements Collection { return false; } + @Override public T next() throws NoSuchElementException { if (!hasNext()) { throw new NoSuchElementException("No more elements"); @@ -92,6 +101,7 @@ public final class WeakCollection implements Collection { return value; } + @Override public void remove() throws IllegalStateException { if (value != NO_VALUE) { throw new IllegalStateException("No last element"); @@ -103,6 +113,7 @@ public final class WeakCollection implements Collection { }; } + @Override public boolean remove(Object object) { if (object == null) { return false; @@ -118,6 +129,7 @@ public final class WeakCollection implements Collection { return false; } + @Override public boolean removeAll(Collection collection) { Iterator it = this.iterator(); boolean ret = false; @@ -130,6 +142,7 @@ public final class WeakCollection implements Collection { return ret; } + @Override public boolean retainAll(Collection collection) { Iterator it = this.iterator(); boolean ret = false; @@ -142,6 +155,7 @@ public final class WeakCollection implements Collection { return ret; } + @Override public int size() { int s = 0; for (T value : this) { @@ -150,10 +164,12 @@ public final class WeakCollection implements Collection { return s; } + @Override public Object[] toArray() { return this.toArray(new Object[0]); } + @Override public T[] toArray(T[] array) { return toCollection().toArray(array); } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java index fc4a7ceb79..80be169551 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java @@ -44,6 +44,7 @@ public class ItemMetaImplementationOverrideTest { testData.add( new Object[] { new Callable() { + @Override public Method call() throws Exception { return clazz.getDeclaredMethod(method.getName(), method.getParameterTypes()); } @@ -56,6 +57,7 @@ public class ItemMetaImplementationOverrideTest { testData.add( new Object[] { new Callable() { + @Override public DelegateDeserialization call() throws Exception { return clazz.getAnnotation(DelegateDeserialization.class); } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java index b07c77da80..c8e8fbedf6 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java @@ -28,6 +28,7 @@ public class ItemStackBookTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 1", "Page 2"); @@ -36,6 +37,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -44,6 +46,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 1", "Page 2"); @@ -52,6 +55,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.setItemMeta(cleanStack.getItemMeta()); return cleanStack; @@ -61,6 +65,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 1", "Page 2"); @@ -69,6 +74,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 2", "Page 1"); @@ -80,6 +86,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 1", "Page 2"); @@ -88,6 +95,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.addPage("Page 1"); @@ -101,6 +109,7 @@ public class ItemStackBookTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setAuthor("AnAuthor"); @@ -109,6 +118,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -117,6 +127,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setAuthor("AnAuthor"); @@ -125,6 +136,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.setItemMeta(cleanStack.getItemMeta()); return cleanStack; @@ -134,6 +146,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setAuthor("AnAuthor"); @@ -142,6 +155,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setAuthor("AnotherAuthor"); @@ -155,6 +169,7 @@ public class ItemStackBookTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setTitle("Some title"); @@ -163,6 +178,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -171,6 +187,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setTitle("Some title"); @@ -179,6 +196,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.setItemMeta(cleanStack.getItemMeta()); return cleanStack; @@ -188,6 +206,7 @@ public class ItemStackBookTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setTitle("Some title"); @@ -196,6 +215,7 @@ public class ItemStackBookTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { BookMeta meta = (BookMeta) cleanStack.getItemMeta(); meta.setTitle("Different title"); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java index 4a7720bc0e..27ce215563 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java @@ -29,6 +29,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addStoredEnchant(Enchantment.DURABILITY, 1, true); @@ -37,6 +38,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -47,6 +49,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addStoredEnchant(Enchantment.KNOCKBACK, 1, true); @@ -55,6 +58,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -63,6 +67,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addStoredEnchant(Enchantment.DAMAGE_UNDEAD, 1, true); @@ -71,6 +76,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addStoredEnchant(Enchantment.DAMAGE_UNDEAD, 1, true); @@ -83,6 +89,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addStoredEnchant(Enchantment.PROTECTION_FIRE, 1, true); @@ -91,6 +98,7 @@ public class ItemStackEnchantStorageTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta(); meta.addEnchant(Enchantment.PROTECTION_FIRE, 2, true); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java index 287beadb76..eedc02b18c 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java @@ -31,6 +31,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).build()); @@ -39,6 +40,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.BLACK).build()); @@ -50,6 +52,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.CREEPER).build()); @@ -58,6 +61,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.BURST).build()); @@ -69,6 +73,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.BLUE).build()); @@ -77,6 +82,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.RED).build()); @@ -88,6 +94,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFlicker().build()); @@ -96,6 +103,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -106,6 +114,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta(); meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withTrail().build()); @@ -114,6 +123,7 @@ public class ItemStackFireworkChargeTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java index f68270e29b..6caf4341e3 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java @@ -31,6 +31,7 @@ public class ItemStackFireworkTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).build()); @@ -39,6 +40,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.BLACK).build()); @@ -51,6 +53,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.CREEPER).build()); @@ -59,6 +62,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.BURST).build()); @@ -70,6 +74,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.BLUE).build()); @@ -78,6 +83,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.RED).build()); @@ -89,6 +95,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFlicker().build()); @@ -97,6 +104,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -107,6 +115,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withTrail().build()); @@ -115,6 +124,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -125,6 +135,7 @@ public class ItemStackFireworkTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.setPower(127); @@ -133,6 +144,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.setPower(100); @@ -144,6 +156,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.setPower(42); @@ -152,6 +165,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -162,6 +176,7 @@ public class ItemStackFireworkTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta(); meta.setPower(10); @@ -170,6 +185,7 @@ public class ItemStackFireworkTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java index 32e60ed9ec..b18ca7552f 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java @@ -29,6 +29,7 @@ public class ItemStackLeatherTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { LeatherArmorMeta meta = (LeatherArmorMeta) cleanStack.getItemMeta(); meta.setColor(Color.FUCHSIA); @@ -37,6 +38,7 @@ public class ItemStackLeatherTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -45,6 +47,7 @@ public class ItemStackLeatherTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { LeatherArmorMeta meta = (LeatherArmorMeta) cleanStack.getItemMeta(); meta.setColor(Color.GRAY); @@ -53,6 +56,7 @@ public class ItemStackLeatherTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { LeatherArmorMeta meta = (LeatherArmorMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -63,6 +67,7 @@ public class ItemStackLeatherTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { LeatherArmorMeta meta = (LeatherArmorMeta) cleanStack.getItemMeta(); meta.setColor(Color.MAROON); @@ -71,6 +76,7 @@ public class ItemStackLeatherTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { LeatherArmorMeta meta = (LeatherArmorMeta) cleanStack.getItemMeta(); meta.setColor(Color.ORANGE); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java index 4dd2ab8c5e..fe4680dcd8 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java @@ -28,6 +28,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setLore(Arrays.asList("First Lore", "Second Lore")); @@ -36,6 +37,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -44,6 +46,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setLore(Arrays.asList("Some lore")); @@ -52,6 +55,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -62,6 +66,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setLore(Arrays.asList("Some more lore", "Another lore")); @@ -70,6 +75,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setLore(Arrays.asList("Some more lore")); @@ -83,6 +89,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setDisplayName("TestItemName"); @@ -91,6 +98,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -99,6 +107,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setDisplayName("AnotherItemName"); @@ -107,6 +116,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -117,6 +127,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setDisplayName("The original ItemName"); @@ -125,6 +136,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.setDisplayName("The other name"); @@ -138,12 +150,14 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.addUnsafeEnchantment(Enchantment.DIG_SPEED, 2); return cleanStack; } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -152,12 +166,14 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.addUnsafeEnchantment(Enchantment.OXYGEN, 1); return cleanStack; } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -168,12 +184,14 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); return cleanStack; } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { cleanStack.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); return cleanStack; @@ -183,6 +201,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.addEnchant(Enchantment.DURABILITY, 1, true); @@ -191,6 +210,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -201,6 +221,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.addEnchant(Enchantment.KNOCKBACK, 1, true); @@ -209,6 +230,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -217,6 +239,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.addEnchant(Enchantment.PROTECTION_FIRE, 1, true); @@ -225,6 +248,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); meta.addEnchant(Enchantment.PROTECTION_FIRE, 2, true); @@ -238,6 +262,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); ((Repairable) meta).setRepairCost(42); @@ -246,6 +271,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -254,6 +280,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); ((Repairable) meta).setRepairCost(36); @@ -262,6 +289,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -272,6 +300,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); ((Repairable) meta).setRepairCost(89); @@ -280,6 +309,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { ItemMeta meta = cleanStack.getItemMeta(); ((Repairable) meta).setRepairCost(88); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackMapTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackMapTest.java index 1d2de6f93e..3d356095fd 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackMapTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackMapTest.java @@ -28,6 +28,7 @@ public class ItemStackMapTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(true); @@ -36,6 +37,7 @@ public class ItemStackMapTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(false); @@ -47,6 +49,7 @@ public class ItemStackMapTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(true); @@ -55,6 +58,7 @@ public class ItemStackMapTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -65,6 +69,7 @@ public class ItemStackMapTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(false); @@ -73,6 +78,7 @@ public class ItemStackMapTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -83,6 +89,7 @@ public class ItemStackMapTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(true); @@ -91,6 +98,7 @@ public class ItemStackMapTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -99,6 +107,7 @@ public class ItemStackMapTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { MapMeta meta = (MapMeta) cleanStack.getItemMeta(); meta.setScaling(false); @@ -107,6 +116,7 @@ public class ItemStackMapTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java index 227c19666a..06aea52121 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java @@ -29,6 +29,7 @@ public class ItemStackPotionsTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.CONFUSION.createEffect(1, 1), false); @@ -37,6 +38,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } @@ -45,6 +47,7 @@ public class ItemStackPotionsTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.HARM.createEffect(2, 1), false); @@ -53,6 +56,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); cleanStack.setItemMeta(meta); @@ -63,6 +67,7 @@ public class ItemStackPotionsTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.SLOW_DIGGING.createEffect(1, 1), false); @@ -71,6 +76,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.FAST_DIGGING.createEffect(1, 1), false); @@ -82,6 +88,7 @@ public class ItemStackPotionsTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.JUMP.createEffect(1, 1), false); @@ -90,6 +97,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.JUMP.createEffect(1, 1), false); @@ -102,6 +110,7 @@ public class ItemStackPotionsTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.SPEED.createEffect(10, 1), false); @@ -110,6 +119,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.SPEED.createEffect(5, 1), false); @@ -121,6 +131,7 @@ public class ItemStackPotionsTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(1, 1), false); @@ -129,6 +140,7 @@ public class ItemStackPotionsTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { final PotionMeta meta = (PotionMeta) cleanStack.getItemMeta(); meta.addCustomEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(1, 2), false); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java index cfca718036..3067f60320 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java @@ -28,6 +28,7 @@ public class ItemStackSkullTest extends ItemStackTest { Arrays.asList( new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { SkullMeta meta = (SkullMeta) cleanStack.getItemMeta(); meta.setOwner("Notch"); @@ -36,6 +37,7 @@ public class ItemStackSkullTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { SkullMeta meta = (SkullMeta) cleanStack.getItemMeta(); meta.setOwner("Dinnerbone"); @@ -47,6 +49,7 @@ public class ItemStackSkullTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { SkullMeta meta = (SkullMeta) cleanStack.getItemMeta(); meta.setOwner("Notch"); @@ -55,6 +58,7 @@ public class ItemStackSkullTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { SkullMeta meta = (SkullMeta) cleanStack.getItemMeta(); meta.setOwner(null); @@ -66,6 +70,7 @@ public class ItemStackSkullTest extends ItemStackTest { }, new Object[] { new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { SkullMeta meta = (SkullMeta) cleanStack.getItemMeta(); meta.setOwner("Notch"); @@ -74,6 +79,7 @@ public class ItemStackSkullTest extends ItemStackTest { } }, new Operator() { + @Override public ItemStack operate(ItemStack cleanStack) { return cleanStack; } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java index 5f9385a8bb..f9c67008a7 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java @@ -124,6 +124,7 @@ public class ItemStackTest extends AbstractTestingBase { this.operators = operators; } + @Override public ItemStack operate(ItemStack cleanStack) { for (Operator operator : operators) { operator.operate(cleanStack); @@ -177,6 +178,7 @@ public class ItemStackTest extends AbstractTestingBase { final Operator op1 = (Operator) toOut[i]; final Operator op2 = (Operator) singleton[i]; toOut[i] = new Operator() { + @Override public ItemStack operate(final ItemStack cleanStack) { return op2.operate(op1.operate(cleanStack)); } @@ -257,6 +259,7 @@ public class ItemStackTest extends AbstractTestingBase { this.provider = provider; } + @Override public ItemStack stack() { return provider.craft(); } @@ -274,6 +277,7 @@ public class ItemStackTest extends AbstractTestingBase { this.provider = provider; } + @Override public ItemStack stack() { return provider.bukkit(); } diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java index c3b782a674..912c139ff9 100644 --- a/src/test/java/org/bukkit/support/DummyServer.java +++ b/src/test/java/org/bukkit/support/DummyServer.java @@ -26,6 +26,7 @@ public class DummyServer implements InvocationHandler { methods.put( Server.class.getMethod("getItemFactory"), new MethodHandler() { + @Override public Object handle(DummyServer server, Object[] args) { return CraftItemFactory.instance(); } @@ -34,6 +35,7 @@ public class DummyServer implements InvocationHandler { methods.put( Server.class.getMethod("getName"), new MethodHandler() { + @Override public Object handle(DummyServer server, Object[] args) { return DummyServer.class.getName(); } @@ -42,6 +44,7 @@ public class DummyServer implements InvocationHandler { methods.put( Server.class.getMethod("getVersion"), new MethodHandler() { + @Override public Object handle(DummyServer server, Object[] args) { return DummyServer.class.getPackage().getImplementationVersion(); } @@ -50,6 +53,7 @@ public class DummyServer implements InvocationHandler { methods.put( Server.class.getMethod("getBukkitVersion"), new MethodHandler() { + @Override public Object handle(DummyServer server, Object[] args) { return Versioning.getBukkitVersion(); } @@ -59,6 +63,7 @@ public class DummyServer implements InvocationHandler { Server.class.getMethod("getLogger"), new MethodHandler() { final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName()); + @Override public Object handle(DummyServer server, Object[] args) { return logger; } @@ -67,6 +72,7 @@ public class DummyServer implements InvocationHandler { methods.put( Server.class.getMethod("getUnsafe"), new MethodHandler() { + @Override public Object handle(DummyServer server, Object[] args) { return CraftMagicNumbers.INSTANCE; } @@ -76,6 +82,7 @@ public class DummyServer implements InvocationHandler { Server.class.getMethod("createBlockData", Material.class), new MethodHandler() { final Logger logger = Logger.getLogger(DummyServer.class.getCanonicalName()); + @Override public Object handle(DummyServer server, Object[] args) { return CraftBlockData.newData((Material) args[0], null); } @@ -100,6 +107,7 @@ public class DummyServer implements InvocationHandler { private DummyServer() {}; + @Override public Object invoke(Object proxy, Method method, Object[] args) { MethodHandler handler = methods.get(method); if (handler != null) { diff --git a/src/test/java/org/bukkit/support/Matchers.java b/src/test/java/org/bukkit/support/Matchers.java index b190c67369..324bbc7367 100644 --- a/src/test/java/org/bukkit/support/Matchers.java +++ b/src/test/java/org/bukkit/support/Matchers.java @@ -19,10 +19,12 @@ public final class Matchers { expected = object.hashCode(); } + @Override public boolean matches(Object item) { return item.hashCode() == expected; } + @Override public void describeTo(Description description) { description.appendValue(expected); }