Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Add Override annotations where appropriate
Dieser Commit ist enthalten in:
Ursprung
3331dade5e
Commit
e3df3d5cda
@ -44,6 +44,7 @@ public class CraftChunk implements Chunk {
|
|||||||
z = getHandle().getPos().z;
|
z = getHandle().getPos().z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return worldServer.getWorld();
|
return worldServer.getWorld();
|
||||||
}
|
}
|
||||||
@ -68,10 +69,12 @@ public class CraftChunk implements Chunk {
|
|||||||
weakChunk.clear();
|
weakChunk.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
@ -81,12 +84,14 @@ public class CraftChunk implements Chunk {
|
|||||||
return "CraftChunk{" + "x=" + getX() + "z=" + getZ() + '}';
|
return "CraftChunk{" + "x=" + getX() + "z=" + getZ() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getBlock(int x, int y, int z) {
|
public Block getBlock(int x, int y, int z) {
|
||||||
validateChunkCoordinates(x, y, z);
|
validateChunkCoordinates(x, y, z);
|
||||||
|
|
||||||
return new CraftBlock(worldServer, new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
|
return new CraftBlock(worldServer, new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Entity[] getEntities() {
|
public Entity[] getEntities() {
|
||||||
int count = 0, index = 0;
|
int count = 0, index = 0;
|
||||||
net.minecraft.server.Chunk chunk = getHandle();
|
net.minecraft.server.Chunk chunk = getHandle();
|
||||||
@ -111,6 +116,7 @@ public class CraftChunk implements Chunk {
|
|||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockState[] getTileEntities() {
|
public BlockState[] getTileEntities() {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
net.minecraft.server.Chunk chunk = getHandle();
|
net.minecraft.server.Chunk chunk = getHandle();
|
||||||
@ -129,18 +135,22 @@ public class CraftChunk implements Chunk {
|
|||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLoaded() {
|
public boolean isLoaded() {
|
||||||
return getWorld().isChunkLoaded(this);
|
return getWorld().isChunkLoaded(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean load() {
|
public boolean load() {
|
||||||
return getWorld().loadChunk(getX(), getZ(), true);
|
return getWorld().loadChunk(getX(), getZ(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean load(boolean generate) {
|
public boolean load(boolean generate) {
|
||||||
return getWorld().loadChunk(getX(), getZ(), generate);
|
return getWorld().loadChunk(getX(), getZ(), generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unload() {
|
public boolean unload() {
|
||||||
return getWorld().unloadChunk(getX(), getZ());
|
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;
|
return SeededRandom.a(getX(), getZ(), getWorld().getSeed(), 987234911L).nextInt(10) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unload(boolean save) {
|
public boolean unload(boolean save) {
|
||||||
return getWorld().unloadChunk(getX(), getZ(), save);
|
return getWorld().unloadChunk(getX(), getZ(), save);
|
||||||
}
|
}
|
||||||
@ -165,10 +176,12 @@ public class CraftChunk implements Chunk {
|
|||||||
getWorld().setChunkForceLoaded(getX(), getZ(), forced);
|
getWorld().setChunkForceLoaded(getX(), getZ(), forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ChunkSnapshot getChunkSnapshot() {
|
public ChunkSnapshot getChunkSnapshot() {
|
||||||
return getChunkSnapshot(true, false, false);
|
return getChunkSnapshot(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ChunkSnapshot getChunkSnapshot(boolean includeMaxBlockY, boolean includeBiome, boolean includeBiomeTempRain) {
|
public ChunkSnapshot getChunkSnapshot(boolean includeMaxBlockY, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||||
net.minecraft.server.Chunk chunk = getHandle();
|
net.minecraft.server.Chunk chunk = getHandle();
|
||||||
|
|
||||||
|
@ -42,14 +42,17 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
|||||||
this.biomeTemp = biomeTemp;
|
this.biomeTemp = biomeTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getWorldName() {
|
public String getWorldName() {
|
||||||
return worldname;
|
return worldname;
|
||||||
}
|
}
|
||||||
@ -75,6 +78,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
|||||||
return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z));
|
return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int getBlockSkyLight(int x, int y, int z) {
|
public final int getBlockSkyLight(int x, int y, int z) {
|
||||||
CraftChunk.validateChunkCoordinates(x, y, z);
|
CraftChunk.validateChunkCoordinates(x, y, z);
|
||||||
|
|
||||||
@ -82,6 +86,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
|||||||
return (skylight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
|
return (skylight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int getBlockEmittedLight(int x, int y, int z) {
|
public final int getBlockEmittedLight(int x, int y, int z) {
|
||||||
CraftChunk.validateChunkCoordinates(x, y, z);
|
CraftChunk.validateChunkCoordinates(x, y, z);
|
||||||
|
|
||||||
@ -89,28 +94,33 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
|||||||
return (emitlight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
|
return (emitlight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int getHighestBlockYAt(int x, int z) {
|
public final int getHighestBlockYAt(int x, int z) {
|
||||||
CraftChunk.validateChunkCoordinates(x, 0, z);
|
CraftChunk.validateChunkCoordinates(x, 0, z);
|
||||||
|
|
||||||
return hmap.a(x, z);
|
return hmap.a(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Biome getBiome(int x, int z) {
|
public final Biome getBiome(int x, int z) {
|
||||||
CraftChunk.validateChunkCoordinates(x, 0, z);
|
CraftChunk.validateChunkCoordinates(x, 0, z);
|
||||||
|
|
||||||
return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]);
|
return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final double getRawBiomeTemperature(int x, int z) {
|
public final double getRawBiomeTemperature(int x, int z) {
|
||||||
CraftChunk.validateChunkCoordinates(x, 0, z);
|
CraftChunk.validateChunkCoordinates(x, 0, z);
|
||||||
|
|
||||||
return biomeTemp[z << 4 | x];
|
return biomeTemp[z << 4 | x];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final long getCaptureFullTime() {
|
public final long getCaptureFullTime() {
|
||||||
return captureFulltime;
|
return captureFulltime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final boolean isSectionEmpty(int sy) {
|
public final boolean isSectionEmpty(int sy) {
|
||||||
return empty[sy];
|
return empty[sy];
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
|||||||
|
|
||||||
public class CraftCrashReport implements CrashReportCallable<Object> {
|
public class CraftCrashReport implements CrashReportCallable<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() throws Exception {
|
||||||
StringWriter value = new StringWriter();
|
StringWriter value = new StringWriter();
|
||||||
try {
|
try {
|
||||||
|
@ -38,10 +38,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOnline() {
|
public boolean isOnline() {
|
||||||
return getPlayer() != null;
|
return getPlayer() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
@ -64,6 +66,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public UUID getUniqueId() {
|
public UUID getUniqueId() {
|
||||||
return profile.getId();
|
return profile.getId();
|
||||||
}
|
}
|
||||||
@ -72,10 +75,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return server.getHandle().isOp(profile);
|
return server.getHandle().isOp(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOp(boolean value) {
|
public void setOp(boolean value) {
|
||||||
if (value == isOp()) {
|
if (value == isOp()) {
|
||||||
return;
|
return;
|
||||||
@ -88,6 +93,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
if (getName() == null) {
|
if (getName() == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -108,10 +114,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWhitelisted() {
|
public boolean isWhitelisted() {
|
||||||
return server.getHandle().getWhitelist().isWhitelisted(profile);
|
return server.getHandle().getWhitelist().isWhitelisted(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWhitelisted(boolean value) {
|
public void setWhitelisted(boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
server.getHandle().getWhitelist().add(new WhiteListEntry(profile));
|
server.getHandle().getWhitelist().add(new WhiteListEntry(profile));
|
||||||
@ -120,6 +128,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
@ -142,6 +151,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
return getClass().getSimpleName() + "[UUID=" + profile.getId() + "]";
|
return getClass().getSimpleName() + "[UUID=" + profile.getId() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return server.getPlayer(getUniqueId());
|
return server.getPlayer(getUniqueId());
|
||||||
}
|
}
|
||||||
@ -188,6 +198,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
return new File(storage.getPlayerDir(), getUniqueId() + ".dat");
|
return new File(storage.getPlayerDir(), getUniqueId() + ".dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getFirstPlayed() {
|
public long getFirstPlayed() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
if (player != null) return player.getFirstPlayed();
|
if (player != null) return player.getFirstPlayed();
|
||||||
@ -206,6 +217,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getLastPlayed() {
|
public long getLastPlayed() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
if (player != null) return player.getLastPlayed();
|
if (player != null) return player.getLastPlayed();
|
||||||
@ -224,10 +236,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPlayedBefore() {
|
public boolean hasPlayedBefore() {
|
||||||
return getData() != null;
|
return getData() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getBedSpawnLocation() {
|
public Location getBedSpawnLocation() {
|
||||||
NBTTagCompound data = getData();
|
NBTTagCompound data = getData();
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
|
@ -1847,6 +1847,7 @@ public final class CraftServer implements Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LootTable getLootTable(NamespacedKey key) {
|
public LootTable getLootTable(NamespacedKey key) {
|
||||||
Validate.notNull(key, "NamespacedKey cannot be null");
|
Validate.notNull(key, "NamespacedKey cannot be null");
|
||||||
|
|
||||||
|
@ -273,10 +273,12 @@ public class CraftWorld implements World {
|
|||||||
environment = env;
|
environment = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getBlockAt(int x, int y, int z) {
|
public Block getBlockAt(int x, int y, int z) {
|
||||||
return CraftBlock.at(world, new BlockPosition(x, y, z));
|
return CraftBlock.at(world, new BlockPosition(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getHighestBlockYAt(int x, int z) {
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
if (!isChunkLoaded(x >> 4, z >> 4)) {
|
if (!isChunkLoaded(x >> 4, z >> 4)) {
|
||||||
getChunkAt(x >> 4, z >> 4); // Transient load for this tick
|
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();
|
return world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(x, 0, z)).getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getSpawnLocation() {
|
public Location getSpawnLocation() {
|
||||||
BlockPosition spawn = world.getSpawn();
|
BlockPosition spawn = world.getSpawn();
|
||||||
return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ());
|
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;
|
return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setSpawnLocation(int x, int y, int z) {
|
public boolean setSpawnLocation(int x, int y, int z) {
|
||||||
try {
|
try {
|
||||||
Location previousLocation = getSpawnLocation();
|
Location previousLocation = getSpawnLocation();
|
||||||
@ -312,14 +316,17 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk getChunkAt(int x, int z) {
|
public Chunk getChunkAt(int x, int z) {
|
||||||
return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk;
|
return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk getChunkAt(Block block) {
|
public Chunk getChunkAt(Block block) {
|
||||||
return getChunkAt(block.getX() >> 4, block.getZ() >> 4);
|
return getChunkAt(block.getX() >> 4, block.getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isChunkLoaded(int x, int z) {
|
public boolean isChunkLoaded(int x, int z) {
|
||||||
net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false);
|
net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false);
|
||||||
return chunk != null && chunk.loaded;
|
return chunk != null && chunk.loaded;
|
||||||
@ -334,28 +341,34 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk[] getLoadedChunks() {
|
public Chunk[] getLoadedChunks() {
|
||||||
Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
|
Long2ObjectLinkedOpenHashMap<PlayerChunk> 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);
|
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) {
|
public void loadChunk(int x, int z) {
|
||||||
loadChunk(x, z, true);
|
loadChunk(x, z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unloadChunk(Chunk chunk) {
|
public boolean unloadChunk(Chunk chunk) {
|
||||||
return unloadChunk(chunk.getX(), chunk.getZ());
|
return unloadChunk(chunk.getX(), chunk.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unloadChunk(int x, int z) {
|
public boolean unloadChunk(int x, int z) {
|
||||||
return unloadChunk(x, z, true);
|
return unloadChunk(x, z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unloadChunk(int x, int z, boolean save) {
|
public boolean unloadChunk(int x, int z, boolean save) {
|
||||||
return unloadChunk0(x, z, save);
|
return unloadChunk0(x, z, save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean unloadChunkRequest(int x, int z) {
|
public boolean unloadChunkRequest(int x, int z) {
|
||||||
net.minecraft.server.IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, false);
|
net.minecraft.server.IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, false);
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
@ -378,6 +391,7 @@ public class CraftWorld implements World {
|
|||||||
return !isChunkLoaded(x, z);
|
return !isChunkLoaded(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean regenerateChunk(int x, int z) {
|
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 :)");
|
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) {
|
public boolean refreshChunk(int x, int z) {
|
||||||
if (!isChunkLoaded(x, z)) {
|
if (!isChunkLoaded(x, z)) {
|
||||||
return false;
|
return false;
|
||||||
@ -422,10 +437,12 @@ public class CraftWorld implements World {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isChunkInUse(int x, int z) {
|
public boolean isChunkInUse(int x, int z) {
|
||||||
return isChunkLoaded(x, z);
|
return isChunkLoaded(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean loadChunk(int x, int z, boolean generate) {
|
public boolean loadChunk(int x, int z, boolean generate) {
|
||||||
IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true);
|
IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true);
|
||||||
|
|
||||||
@ -443,10 +460,12 @@ public class CraftWorld implements World {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isChunkLoaded(Chunk chunk) {
|
public boolean isChunkLoaded(Chunk chunk) {
|
||||||
return isChunkLoaded(chunk.getX(), chunk.getZ());
|
return isChunkLoaded(chunk.getX(), chunk.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void loadChunk(Chunk chunk) {
|
public void loadChunk(Chunk chunk) {
|
||||||
loadChunk(chunk.getX(), chunk.getZ());
|
loadChunk(chunk.getX(), chunk.getZ());
|
||||||
((CraftChunk) getChunkAt(chunk.getX(), chunk.getZ())).getHandle().bukkitChunk = chunk;
|
((CraftChunk) getChunkAt(chunk.getX(), chunk.getZ())).getHandle().bukkitChunk = chunk;
|
||||||
@ -477,6 +496,7 @@ public class CraftWorld implements World {
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) {
|
public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) {
|
||||||
Validate.notNull(item, "Cannot drop a Null item.");
|
Validate.notNull(item, "Cannot drop a Null item.");
|
||||||
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), CraftItemStack.asNMSCopy(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);
|
return new CraftItem(world.getServer(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
|
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
|
||||||
double xs = (world.random.nextFloat() * 0.5F) + 0.25D;
|
double xs = (world.random.nextFloat() * 0.5F) + 0.25D;
|
||||||
double ys = (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);
|
return dropItem(loc, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
|
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
|
||||||
return spawnArrow(loc, velocity, speed, spread, Arrow.class);
|
return spawnArrow(loc, velocity, speed, spread, Arrow.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T extends Arrow> T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class<T> clazz) {
|
public <T extends Arrow> T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class<T> clazz) {
|
||||||
Validate.notNull(loc, "Can not spawn arrow with a null location");
|
Validate.notNull(loc, "Can not spawn arrow with a null location");
|
||||||
Validate.notNull(velocity, "Can not spawn arrow with a null velocity");
|
Validate.notNull(velocity, "Can not spawn arrow with a null velocity");
|
||||||
@ -525,22 +548,26 @@ public class CraftWorld implements World {
|
|||||||
return (T) arrow.getBukkitEntity();
|
return (T) arrow.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Entity spawnEntity(Location loc, EntityType entityType) {
|
public Entity spawnEntity(Location loc, EntityType entityType) {
|
||||||
return spawn(loc, entityType.getEntityClass());
|
return spawn(loc, entityType.getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LightningStrike strikeLightning(Location loc) {
|
public LightningStrike strikeLightning(Location loc) {
|
||||||
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), false);
|
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), false);
|
||||||
world.strikeLightning(lightning);
|
world.strikeLightning(lightning);
|
||||||
return new CraftLightningStrike(server, lightning);
|
return new CraftLightningStrike(server, lightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LightningStrike strikeLightningEffect(Location loc) {
|
public LightningStrike strikeLightningEffect(Location loc) {
|
||||||
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true);
|
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true);
|
||||||
world.strikeLightning(lightning);
|
world.strikeLightning(lightning);
|
||||||
return new CraftLightningStrike(server, lightning);
|
return new CraftLightningStrike(server, lightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean generateTree(Location loc, TreeType type) {
|
public boolean generateTree(Location loc, TreeType type) {
|
||||||
BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
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());
|
return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, new WorldGenFeatureEmptyConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
||||||
world.captureTreeGeneration = true;
|
world.captureTreeGeneration = true;
|
||||||
world.captureBlockStates = true;
|
world.captureBlockStates = true;
|
||||||
@ -626,6 +654,7 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return world.worldData.getName();
|
return world.worldData.getName();
|
||||||
}
|
}
|
||||||
@ -635,6 +664,7 @@ public class CraftWorld implements World {
|
|||||||
return world.worldData.getSeed();
|
return world.worldData.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public UUID getUID() {
|
public UUID getUID() {
|
||||||
return world.getDataManager().getUUID();
|
return world.getDataManager().getUUID();
|
||||||
}
|
}
|
||||||
@ -644,22 +674,26 @@ public class CraftWorld implements World {
|
|||||||
return "CraftWorld{name=" + getName() + '}';
|
return "CraftWorld{name=" + getName() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTime() {
|
public long getTime() {
|
||||||
long time = getFullTime() % 24000;
|
long time = getFullTime() % 24000;
|
||||||
if (time < 0) time += 24000;
|
if (time < 0) time += 24000;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTime(long time) {
|
public void setTime(long time) {
|
||||||
long margin = (time - getFullTime()) % 24000;
|
long margin = (time - getFullTime()) % 24000;
|
||||||
if (margin < 0) margin += 24000;
|
if (margin < 0) margin += 24000;
|
||||||
setFullTime(getFullTime() + margin);
|
setFullTime(getFullTime() + margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getFullTime() {
|
public long getFullTime() {
|
||||||
return world.getDayTime();
|
return world.getDayTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFullTime(long time) {
|
public void setFullTime(long time) {
|
||||||
world.setDayTime(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) {
|
public boolean createExplosion(double x, double y, double z, float power) {
|
||||||
return createExplosion(x, y, z, power, false, true);
|
return createExplosion(x, y, z, power, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
|
||||||
return createExplosion(x, y, z, power, setFire, true);
|
return createExplosion(x, y, z, power, setFire, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) {
|
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;
|
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) {
|
public boolean createExplosion(Location loc, float power) {
|
||||||
return createExplosion(loc, power, false);
|
return createExplosion(loc, power, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(Location loc, float power, boolean setFire) {
|
public boolean createExplosion(Location loc, float power, boolean setFire) {
|
||||||
return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire);
|
return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Environment getEnvironment() {
|
public Environment getEnvironment() {
|
||||||
return environment;
|
return environment;
|
||||||
}
|
}
|
||||||
@ -713,38 +753,47 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getBlockAt(Location location) {
|
public Block getBlockAt(Location location) {
|
||||||
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getHighestBlockYAt(Location location) {
|
public int getHighestBlockYAt(Location location) {
|
||||||
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ());
|
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk getChunkAt(Location location) {
|
public Chunk getChunkAt(Location location) {
|
||||||
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ChunkGenerator getGenerator() {
|
public ChunkGenerator getGenerator() {
|
||||||
return generator;
|
return generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<BlockPopulator> getPopulators() {
|
public List<BlockPopulator> getPopulators() {
|
||||||
return populators;
|
return populators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getHighestBlockAt(int x, int z) {
|
public Block getHighestBlockAt(int x, int z) {
|
||||||
return getBlockAt(x, getHighestBlockYAt(x, z), z);
|
return getBlockAt(x, getHighestBlockYAt(x, z), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getHighestBlockAt(Location location) {
|
public Block getHighestBlockAt(Location location) {
|
||||||
return getHighestBlockAt(location.getBlockX(), location.getBlockZ());
|
return getHighestBlockAt(location.getBlockX(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return CraftBlock.biomeBaseToBiome(this.world.getBiome(new BlockPosition(x, 0, z)));
|
return CraftBlock.biomeBaseToBiome(this.world.getBiome(new BlockPosition(x, 0, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBiome(int x, int z, Biome bio) {
|
public void setBiome(int x, int z, Biome bio) {
|
||||||
BiomeBase bb = CraftBlock.biomeToBiomeBase(bio);
|
BiomeBase bb = CraftBlock.biomeToBiomeBase(bio);
|
||||||
if (this.world.isLoaded(new BlockPosition(x, 0, z))) {
|
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) {
|
public double getTemperature(int x, int z) {
|
||||||
return this.world.getBiome(new BlockPosition(x, 0, z)).getTemperature();
|
return this.world.getBiome(new BlockPosition(x, 0, z)).getTemperature();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getHumidity(int x, int z) {
|
public double getHumidity(int x, int z) {
|
||||||
return this.world.getBiome(new BlockPosition(x, 0, z)).getHumidity();
|
return this.world.getBiome(new BlockPosition(x, 0, z)).getHumidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Entity> getEntities() {
|
public List<Entity> getEntities() {
|
||||||
List<Entity> list = new ArrayList<Entity>();
|
List<Entity> list = new ArrayList<Entity>();
|
||||||
|
|
||||||
@ -785,6 +837,7 @@ public class CraftWorld implements World {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<LivingEntity> getLivingEntities() {
|
public List<LivingEntity> getLivingEntities() {
|
||||||
List<LivingEntity> list = new ArrayList<LivingEntity>();
|
List<LivingEntity> list = new ArrayList<LivingEntity>();
|
||||||
|
|
||||||
@ -803,12 +856,14 @@ public class CraftWorld implements World {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes) {
|
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes) {
|
||||||
return (Collection<T>)getEntitiesByClasses(classes);
|
return (Collection<T>)getEntitiesByClasses(classes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> clazz) {
|
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> clazz) {
|
||||||
Collection<T> list = new ArrayList<T>();
|
Collection<T> list = new ArrayList<T>();
|
||||||
@ -832,6 +887,7 @@ public class CraftWorld implements World {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<Entity> getEntitiesByClasses(Class<?>... classes) {
|
public Collection<Entity> getEntitiesByClasses(Class<?>... classes) {
|
||||||
Collection<Entity> list = new ArrayList<Entity>();
|
Collection<Entity> list = new ArrayList<Entity>();
|
||||||
|
|
||||||
@ -1015,6 +1071,7 @@ public class CraftWorld implements World {
|
|||||||
return blockHit;
|
return blockHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Player> getPlayers() {
|
public List<Player> getPlayers() {
|
||||||
List<Player> list = new ArrayList<Player>(world.getPlayers().size());
|
List<Player> list = new ArrayList<Player>(world.getPlayers().size());
|
||||||
|
|
||||||
@ -1029,6 +1086,7 @@ public class CraftWorld implements World {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void save() {
|
public void save() {
|
||||||
this.server.checkSaveState();
|
this.server.checkSaveState();
|
||||||
try {
|
try {
|
||||||
@ -1043,18 +1101,22 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAutoSave() {
|
public boolean isAutoSave() {
|
||||||
return !world.savingDisabled;
|
return !world.savingDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAutoSave(boolean value) {
|
public void setAutoSave(boolean value) {
|
||||||
world.savingDisabled = !value;
|
world.savingDisabled = !value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDifficulty(Difficulty difficulty) {
|
public void setDifficulty(Difficulty difficulty) {
|
||||||
this.getHandle().worldData.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
|
this.getHandle().worldData.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Difficulty getDifficulty() {
|
public Difficulty getDifficulty() {
|
||||||
return Difficulty.getByValue(this.getHandle().getDifficulty().ordinal());
|
return Difficulty.getByValue(this.getHandle().getDifficulty().ordinal());
|
||||||
}
|
}
|
||||||
@ -1063,48 +1125,59 @@ public class CraftWorld implements World {
|
|||||||
return blockMetadata;
|
return blockMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasStorm() {
|
public boolean hasStorm() {
|
||||||
return world.worldData.hasStorm();
|
return world.worldData.hasStorm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setStorm(boolean hasStorm) {
|
public void setStorm(boolean hasStorm) {
|
||||||
world.worldData.setStorm(hasStorm);
|
world.worldData.setStorm(hasStorm);
|
||||||
setWeatherDuration(0); // Reset weather duration (legacy behaviour)
|
setWeatherDuration(0); // Reset weather duration (legacy behaviour)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getWeatherDuration() {
|
public int getWeatherDuration() {
|
||||||
return world.worldData.getWeatherDuration();
|
return world.worldData.getWeatherDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWeatherDuration(int duration) {
|
public void setWeatherDuration(int duration) {
|
||||||
world.worldData.setWeatherDuration(duration);
|
world.worldData.setWeatherDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isThundering() {
|
public boolean isThundering() {
|
||||||
return world.worldData.isThundering();
|
return world.worldData.isThundering();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setThundering(boolean thundering) {
|
public void setThundering(boolean thundering) {
|
||||||
world.worldData.setThundering(thundering);
|
world.worldData.setThundering(thundering);
|
||||||
setThunderDuration(0); // Reset weather duration (legacy behaviour)
|
setThunderDuration(0); // Reset weather duration (legacy behaviour)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getThunderDuration() {
|
public int getThunderDuration() {
|
||||||
return world.worldData.getThunderDuration();
|
return world.worldData.getThunderDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setThunderDuration(int duration) {
|
public void setThunderDuration(int duration) {
|
||||||
world.worldData.setThunderDuration(duration);
|
world.worldData.setThunderDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getSeed() {
|
public long getSeed() {
|
||||||
return world.worldData.getSeed();
|
return world.worldData.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getPVP() {
|
public boolean getPVP() {
|
||||||
return world.pvpMode;
|
return world.pvpMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPVP(boolean pvp) {
|
public void setPVP(boolean pvp) {
|
||||||
world.pvpMode = pvp;
|
world.pvpMode = pvp;
|
||||||
}
|
}
|
||||||
@ -1113,14 +1186,17 @@ public class CraftWorld implements World {
|
|||||||
playEffect(player.getLocation(), effect, data, 0);
|
playEffect(player.getLocation(), effect, data, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void playEffect(Location location, Effect effect, int data) {
|
public void playEffect(Location location, Effect effect, int data) {
|
||||||
playEffect(location, effect, data, 64);
|
playEffect(location, effect, data, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> void playEffect(Location loc, Effect effect, T data) {
|
public <T> void playEffect(Location loc, Effect effect, T data) {
|
||||||
playEffect(loc, effect, data, 64);
|
playEffect(loc, effect, data, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
|
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!");
|
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);
|
playEffect(loc, effect, datavalue, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void playEffect(Location location, Effect effect, int data, int radius) {
|
public void playEffect(Location location, Effect effect, int data, int radius) {
|
||||||
Validate.notNull(location, "Location cannot be null");
|
Validate.notNull(location, "Location cannot be null");
|
||||||
Validate.notNull(effect, "Effect cannot be null");
|
Validate.notNull(effect, "Effect cannot be null");
|
||||||
@ -1152,6 +1229,7 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException {
|
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException {
|
||||||
return spawn(location, clazz, null, SpawnReason.CUSTOM);
|
return spawn(location, clazz, null, SpawnReason.CUSTOM);
|
||||||
}
|
}
|
||||||
@ -1167,6 +1245,7 @@ public class CraftWorld implements World {
|
|||||||
return spawnFallingBlock(location, data.getItemType(), data.getData());
|
return spawnFallingBlock(location, data.getItemType(), data.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FallingBlock spawnFallingBlock(Location location, org.bukkit.Material material, byte data) throws IllegalArgumentException {
|
public FallingBlock spawnFallingBlock(Location location, org.bukkit.Material material, byte data) throws IllegalArgumentException {
|
||||||
Validate.notNull(location, "Location cannot be null");
|
Validate.notNull(location, "Location cannot be null");
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
@ -1558,34 +1637,42 @@ public class CraftWorld implements World {
|
|||||||
return addEntity(entity, reason, function);
|
return addEntity(entity, reason, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) {
|
public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||||
return CraftChunk.getEmptyChunkSnapshot(x, z, this, includeBiome, includeBiomeTempRain);
|
return CraftChunk.getEmptyChunkSnapshot(x, z, this, includeBiome, includeBiomeTempRain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) {
|
public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) {
|
||||||
world.setSpawnFlags(allowMonsters, allowAnimals);
|
world.setSpawnFlags(allowMonsters, allowAnimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getAllowAnimals() {
|
public boolean getAllowAnimals() {
|
||||||
return world.getChunkProvider().allowAnimals;
|
return world.getChunkProvider().allowAnimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getAllowMonsters() {
|
public boolean getAllowMonsters() {
|
||||||
return world.getChunkProvider().allowMonsters;
|
return world.getChunkProvider().allowMonsters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return world.getHeight();
|
return world.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSeaLevel() {
|
public int getSeaLevel() {
|
||||||
return world.getSeaLevel();
|
return world.getSeaLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getKeepSpawnInMemory() {
|
public boolean getKeepSpawnInMemory() {
|
||||||
return world.keepSpawnInMemory;
|
return world.keepSpawnInMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
||||||
world.keepSpawnInMemory = keepLoaded;
|
world.keepSpawnInMemory = keepLoaded;
|
||||||
// Grab the worlds spawn chunk
|
// Grab the worlds spawn chunk
|
||||||
@ -1625,10 +1712,12 @@ public class CraftWorld implements World {
|
|||||||
return this.getUID() == other.getUID();
|
return this.getUID() == other.getUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public File getWorldFolder() {
|
public File getWorldFolder() {
|
||||||
return ((WorldNBTStorage) world.getDataManager()).getDirectory();
|
return ((WorldNBTStorage) world.getDataManager()).getDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
|
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
|
||||||
StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);
|
StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);
|
||||||
|
|
||||||
@ -1637,6 +1726,7 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<String> getListeningPluginChannels() {
|
public Set<String> getListeningPluginChannels() {
|
||||||
Set<String> result = new HashSet<String>();
|
Set<String> result = new HashSet<String>();
|
||||||
|
|
||||||
@ -1647,46 +1737,57 @@ public class CraftWorld implements World {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.WorldType getWorldType() {
|
public org.bukkit.WorldType getWorldType() {
|
||||||
return org.bukkit.WorldType.getByName(world.getWorldData().getType().name());
|
return org.bukkit.WorldType.getByName(world.getWorldData().getType().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canGenerateStructures() {
|
public boolean canGenerateStructures() {
|
||||||
return world.getWorldData().shouldGenerateMapFeatures();
|
return world.getWorldData().shouldGenerateMapFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTicksPerAnimalSpawns() {
|
public long getTicksPerAnimalSpawns() {
|
||||||
return world.ticksPerAnimalSpawns;
|
return world.ticksPerAnimalSpawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
||||||
world.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
|
world.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTicksPerMonsterSpawns() {
|
public long getTicksPerMonsterSpawns() {
|
||||||
return world.ticksPerMonsterSpawns;
|
return world.ticksPerMonsterSpawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
||||||
world.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
|
world.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
server.getWorldMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
server.getWorldMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
return server.getWorldMetadata().getMetadata(this, metadataKey);
|
return server.getWorldMetadata().getMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
return server.getWorldMetadata().hasMetadata(this, metadataKey);
|
return server.getWorldMetadata().hasMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMonsterSpawnLimit() {
|
public int getMonsterSpawnLimit() {
|
||||||
if (monsterSpawn < 0) {
|
if (monsterSpawn < 0) {
|
||||||
return server.getMonsterSpawnLimit();
|
return server.getMonsterSpawnLimit();
|
||||||
@ -1695,10 +1796,12 @@ public class CraftWorld implements World {
|
|||||||
return monsterSpawn;
|
return monsterSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMonsterSpawnLimit(int limit) {
|
public void setMonsterSpawnLimit(int limit) {
|
||||||
monsterSpawn = limit;
|
monsterSpawn = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAnimalSpawnLimit() {
|
public int getAnimalSpawnLimit() {
|
||||||
if (animalSpawn < 0) {
|
if (animalSpawn < 0) {
|
||||||
return server.getAnimalSpawnLimit();
|
return server.getAnimalSpawnLimit();
|
||||||
@ -1707,10 +1810,12 @@ public class CraftWorld implements World {
|
|||||||
return animalSpawn;
|
return animalSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAnimalSpawnLimit(int limit) {
|
public void setAnimalSpawnLimit(int limit) {
|
||||||
animalSpawn = limit;
|
animalSpawn = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getWaterAnimalSpawnLimit() {
|
public int getWaterAnimalSpawnLimit() {
|
||||||
if (waterAnimalSpawn < 0) {
|
if (waterAnimalSpawn < 0) {
|
||||||
return server.getWaterAnimalSpawnLimit();
|
return server.getWaterAnimalSpawnLimit();
|
||||||
@ -1719,10 +1824,12 @@ public class CraftWorld implements World {
|
|||||||
return waterAnimalSpawn;
|
return waterAnimalSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWaterAnimalSpawnLimit(int limit) {
|
public void setWaterAnimalSpawnLimit(int limit) {
|
||||||
waterAnimalSpawn = limit;
|
waterAnimalSpawn = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAmbientSpawnLimit() {
|
public int getAmbientSpawnLimit() {
|
||||||
if (ambientSpawn < 0) {
|
if (ambientSpawn < 0) {
|
||||||
return server.getAmbientSpawnLimit();
|
return server.getAmbientSpawnLimit();
|
||||||
@ -1731,14 +1838,17 @@ public class CraftWorld implements World {
|
|||||||
return ambientSpawn;
|
return ambientSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAmbientSpawnLimit(int limit) {
|
public void setAmbientSpawnLimit(int limit) {
|
||||||
ambientSpawn = limit;
|
ambientSpawn = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void playSound(Location loc, Sound sound, float volume, float pitch) {
|
public void playSound(Location loc, Sound sound, float volume, float pitch) {
|
||||||
playSound(loc, sound, org.bukkit.SoundCategory.MASTER, volume, pitch);
|
playSound(loc, sound, org.bukkit.SoundCategory.MASTER, volume, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void playSound(Location loc, String sound, float volume, float pitch) {
|
public void playSound(Location loc, String sound, float volume, float pitch) {
|
||||||
playSound(loc, sound, org.bukkit.SoundCategory.MASTER, volume, 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);
|
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) {
|
public String getGameRuleValue(String rule) {
|
||||||
// In method contract for some reason
|
// In method contract for some reason
|
||||||
if (rule == null) {
|
if (rule == null) {
|
||||||
@ -1776,6 +1887,7 @@ public class CraftWorld implements World {
|
|||||||
return value != null ? value.getValue() : "";
|
return value != null ? value.getValue() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setGameRuleValue(String rule, String value) {
|
public boolean setGameRuleValue(String rule, String value) {
|
||||||
// No null values allowed
|
// No null values allowed
|
||||||
if (rule == null || value == null) return false;
|
if (rule == null || value == null) return false;
|
||||||
@ -1786,10 +1898,12 @@ public class CraftWorld implements World {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getGameRules() {
|
public String[] getGameRules() {
|
||||||
return GameRules.getGameRules().keySet().toArray(new String[GameRules.getGameRules().size()]);
|
return GameRules.getGameRules().keySet().toArray(new String[GameRules.getGameRules().size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isGameRule(String rule) {
|
public boolean isGameRule(String rule) {
|
||||||
Validate.isTrue(rule != null && !rule.isEmpty(), "Rule cannot be null nor empty");
|
Validate.isTrue(rule != null && !rule.isEmpty(), "Rule cannot be null nor empty");
|
||||||
return GameRules.getGameRules().containsKey(rule);
|
return GameRules.getGameRules().containsKey(rule);
|
||||||
|
@ -73,6 +73,7 @@ public class CraftBlock implements Block {
|
|||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return world.getMinecraftWorld().getWorld();
|
return world.getMinecraftWorld().getWorld();
|
||||||
}
|
}
|
||||||
@ -81,10 +82,12 @@ public class CraftBlock implements Block {
|
|||||||
return (CraftWorld) getWorld();
|
return (CraftWorld) getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return new Location(getWorld(), position.getX(), position.getY(), position.getZ());
|
return new Location(getWorld(), position.getX(), position.getY(), position.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation(Location loc) {
|
public Location getLocation(Location loc) {
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
loc.setWorld(getWorld());
|
loc.setWorld(getWorld());
|
||||||
@ -102,18 +105,22 @@ public class CraftBlock implements Block {
|
|||||||
return new BlockVector(getX(), getY(), getZ());
|
return new BlockVector(getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return position.getX();
|
return position.getX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return position.getY();
|
return position.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return position.getZ();
|
return position.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk getChunk() {
|
public Chunk getChunk() {
|
||||||
return getWorld().getChunkAt(this);
|
return getWorld().getChunkAt(this);
|
||||||
}
|
}
|
||||||
@ -138,6 +145,7 @@ public class CraftBlock implements Block {
|
|||||||
return world.getType(position);
|
return world.getType(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getData() {
|
public byte getData() {
|
||||||
IBlockData blockData = world.getType(position);
|
IBlockData blockData = world.getType(position);
|
||||||
return CraftMagicNumbers.toLegacyData(blockData);
|
return CraftMagicNumbers.toLegacyData(blockData);
|
||||||
@ -148,6 +156,7 @@ public class CraftBlock implements Block {
|
|||||||
return CraftBlockData.fromData(getData0());
|
return CraftBlockData.fromData(getData0());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setType(final Material type) {
|
public void setType(final Material type) {
|
||||||
setType(type, true);
|
setType(type, true);
|
||||||
}
|
}
|
||||||
@ -197,18 +206,22 @@ public class CraftBlock implements Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Material getType() {
|
public Material getType() {
|
||||||
return CraftMagicNumbers.getMaterial(world.getType(position).getBlock());
|
return CraftMagicNumbers.getMaterial(world.getType(position).getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getLightLevel() {
|
public byte getLightLevel() {
|
||||||
return (byte) world.getMinecraftWorld().getLightLevel(position);
|
return (byte) world.getMinecraftWorld().getLightLevel(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getLightFromSky() {
|
public byte getLightFromSky() {
|
||||||
return (byte) world.getBrightness(EnumSkyBlock.SKY, position);
|
return (byte) world.getBrightness(EnumSkyBlock.SKY, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getLightFromBlocks() {
|
public byte getLightFromBlocks() {
|
||||||
return (byte) world.getBrightness(EnumSkyBlock.BLOCK, position);
|
return (byte) world.getBrightness(EnumSkyBlock.BLOCK, position);
|
||||||
}
|
}
|
||||||
@ -222,18 +235,22 @@ public class CraftBlock implements Block {
|
|||||||
return getRelative(face, distance);
|
return getRelative(face, distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getRelative(final int modX, final int modY, final int modZ) {
|
public Block getRelative(final int modX, final int modY, final int modZ) {
|
||||||
return getWorld().getBlockAt(getX() + modX, getY() + modY, getZ() + modZ);
|
return getWorld().getBlockAt(getX() + modX, getY() + modY, getZ() + modZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getRelative(BlockFace face) {
|
public Block getRelative(BlockFace face) {
|
||||||
return getRelative(face, 1);
|
return getRelative(face, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getRelative(BlockFace face, int distance) {
|
public Block getRelative(BlockFace face, int distance) {
|
||||||
return getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
return getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockFace getFace(final Block block) {
|
public BlockFace getFace(final Block block) {
|
||||||
BlockFace[] values = BlockFace.values();
|
BlockFace[] values = BlockFace.values();
|
||||||
|
|
||||||
@ -293,6 +310,7 @@ public class CraftBlock implements Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockState getState() {
|
public BlockState getState() {
|
||||||
Material material = getType();
|
Material material = getType();
|
||||||
|
|
||||||
@ -456,10 +474,12 @@ public class CraftBlock implements Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Biome getBiome() {
|
public Biome getBiome() {
|
||||||
return getWorld().getBiome(getX(), getZ());
|
return getWorld().getBiome(getX(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBiome(Biome bio) {
|
public void setBiome(Biome bio) {
|
||||||
getWorld().setBiome(getX(), getZ(), 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)));
|
return IRegistry.BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getTemperature() {
|
public double getTemperature() {
|
||||||
return world.getBiome(position).getAdjustedTemperature(position);
|
return world.getBiome(position).getAdjustedTemperature(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getHumidity() {
|
public double getHumidity() {
|
||||||
return getWorld().getHumidity(getX(), getZ());
|
return getWorld().getHumidity(getX(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlockPowered() {
|
public boolean isBlockPowered() {
|
||||||
return world.getMinecraftWorld().getBlockPower(position) > 0;
|
return world.getMinecraftWorld().getBlockPower(position) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlockIndirectlyPowered() {
|
public boolean isBlockIndirectlyPowered() {
|
||||||
return world.getMinecraftWorld().isBlockIndirectlyPowered(position);
|
return world.getMinecraftWorld().isBlockIndirectlyPowered(position);
|
||||||
}
|
}
|
||||||
@ -510,10 +534,12 @@ public class CraftBlock implements Block {
|
|||||||
return this.position.hashCode() ^ this.getWorld().hashCode();
|
return this.position.hashCode() ^ this.getWorld().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlockFacePowered(BlockFace face) {
|
public boolean isBlockFacePowered(BlockFace face) {
|
||||||
return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face));
|
return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
|
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
|
||||||
int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face));
|
int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face));
|
||||||
|
|
||||||
@ -525,6 +551,7 @@ public class CraftBlock implements Block {
|
|||||||
return power > 0;
|
return power > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getBlockPower(BlockFace face) {
|
public int getBlockPower(BlockFace face) {
|
||||||
int power = 0;
|
int power = 0;
|
||||||
BlockRedstoneWire wire = (BlockRedstoneWire) Blocks.REDSTONE_WIRE;
|
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;
|
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getBlockPower() {
|
public int getBlockPower() {
|
||||||
return getBlockPower(BlockFace.SELF);
|
return getBlockPower(BlockFace.SELF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return getNMS().isAir();
|
return getNMS().isAir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLiquid() {
|
public boolean isLiquid() {
|
||||||
return (getType() == Material.WATER) || (getType() == Material.LAVA);
|
return (getType() == Material.WATER) || (getType() == Material.LAVA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PistonMoveReaction getPistonMoveReaction() {
|
public PistonMoveReaction getPistonMoveReaction() {
|
||||||
return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal());
|
return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean breakNaturally() {
|
public boolean breakNaturally() {
|
||||||
return breakNaturally(new ItemStack(Material.AIR));
|
return breakNaturally(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean breakNaturally(ItemStack item) {
|
public boolean breakNaturally(ItemStack item) {
|
||||||
// Order matters here, need to drop before setting to air so skulls can get their data
|
// Order matters here, need to drop before setting to air so skulls can get their data
|
||||||
net.minecraft.server.Block block = this.getNMSBlock();
|
net.minecraft.server.Block block = this.getNMSBlock();
|
||||||
@ -574,27 +607,33 @@ public class CraftBlock implements Block {
|
|||||||
return setTypeAndData(Blocks.AIR.getBlockData(), true) && result;
|
return setTypeAndData(Blocks.AIR.getBlockData(), true) && result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<ItemStack> getDrops() {
|
public Collection<ItemStack> getDrops() {
|
||||||
return getDrops(new ItemStack(Material.AIR));
|
return getDrops(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<ItemStack> getDrops(ItemStack item) {
|
public Collection<ItemStack> getDrops(ItemStack item) {
|
||||||
return net.minecraft.server.Block.getDrops(getNMS(), (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), null, CraftItemStack.asNMSCopy(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());
|
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
return getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
|
return getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
return getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
|
return getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||||
}
|
}
|
||||||
|
@ -56,23 +56,28 @@ public class CraftBlockState implements BlockState {
|
|||||||
return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
|
return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return position.getX();
|
return position.getX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return position.getY();
|
return position.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return position.getZ();
|
return position.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Chunk getChunk() {
|
public Chunk getChunk() {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk;
|
return chunk;
|
||||||
@ -101,6 +106,7 @@ public class CraftBlockState implements BlockState {
|
|||||||
this.data = ((CraftBlockData) data).getState();
|
this.data = ((CraftBlockData) data).getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setData(final MaterialData data) {
|
public void setData(final MaterialData data) {
|
||||||
Material mat = CraftMagicNumbers.getMaterial(this.data).getItemType();
|
Material mat = CraftMagicNumbers.getMaterial(this.data).getItemType();
|
||||||
|
|
||||||
@ -116,10 +122,12 @@ public class CraftBlockState implements BlockState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MaterialData getData() {
|
public MaterialData getData() {
|
||||||
return CraftMagicNumbers.getMaterial(data);
|
return CraftMagicNumbers.getMaterial(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setType(final Material type) {
|
public void setType(final Material type) {
|
||||||
Preconditions.checkArgument(type != null, "Material cannot be null");
|
Preconditions.checkArgument(type != null, "Material cannot be null");
|
||||||
Preconditions.checkArgument(type.isBlock(), "Material must be a block!");
|
Preconditions.checkArgument(type.isBlock(), "Material must be a block!");
|
||||||
@ -129,6 +137,7 @@ public class CraftBlockState implements BlockState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Material getType() {
|
public Material getType() {
|
||||||
return CraftMagicNumbers.getMaterial(data.getBlock());
|
return CraftMagicNumbers.getMaterial(data.getBlock());
|
||||||
}
|
}
|
||||||
@ -141,23 +150,28 @@ public class CraftBlockState implements BlockState {
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getLightLevel() {
|
public byte getLightLevel() {
|
||||||
return getBlock().getLightLevel();
|
return getBlock().getLightLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CraftBlock getBlock() {
|
public CraftBlock getBlock() {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return CraftBlock.at(world.getHandle(), position);
|
return CraftBlock.at(world.getHandle(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean update() {
|
public boolean update() {
|
||||||
return update(false);
|
return update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean update(boolean force) {
|
public boolean update(boolean force) {
|
||||||
return update(force, true);
|
return update(force, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean update(boolean force, boolean applyPhysics) {
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
if (!isPlaced()) {
|
if (!isPlaced()) {
|
||||||
return true;
|
return true;
|
||||||
@ -187,14 +201,17 @@ public class CraftBlockState implements BlockState {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getRawData() {
|
public byte getRawData() {
|
||||||
return CraftMagicNumbers.toLegacyData(data);
|
return CraftMagicNumbers.toLegacyData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return new Location(world, getX(), getY(), getZ());
|
return new Location(world, getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation(Location loc) {
|
public Location getLocation(Location loc) {
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
loc.setWorld(world);
|
loc.setWorld(world);
|
||||||
@ -208,6 +225,7 @@ public class CraftBlockState implements BlockState {
|
|||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRawData(byte data) {
|
public void setRawData(byte data) {
|
||||||
this.data = CraftMagicNumbers.getBlock(getType(), data);
|
this.data = CraftMagicNumbers.getBlock(getType(), data);
|
||||||
}
|
}
|
||||||
@ -242,21 +260,25 @@ public class CraftBlockState implements BlockState {
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
chunk.getCraftWorld().getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue);
|
chunk.getCraftWorld().getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk.getCraftWorld().getBlockMetadata().getMetadata(getBlock(), metadataKey);
|
return chunk.getCraftWorld().getBlockMetadata().getMetadata(getBlock(), metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk.getCraftWorld().getBlockMetadata().hasMetadata(getBlock(), metadataKey);
|
return chunk.getCraftWorld().getBlockMetadata().hasMetadata(getBlock(), metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
chunk.getCraftWorld().getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin);
|
chunk.getCraftWorld().getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin);
|
||||||
|
@ -16,6 +16,7 @@ public class ConsoleCommandCompleter implements Completer {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
|
public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
|
||||||
Waitable<List<String>> waitable = new Waitable<List<String>>() {
|
Waitable<List<String>> waitable = new Waitable<List<String>>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,30 +21,36 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
|
|||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
return CraftBlock.at(tile.getWorld(), tile.getPosition());
|
return CraftBlock.at(tile.getWorld(), tile.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
|
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
|
||||||
block.base.sendMessage(component);
|
block.base.sendMessage(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String[] messages) {
|
public void sendMessage(String[] messages) {
|
||||||
for (String message : messages) {
|
for (String message : messages) {
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return block.getName();
|
return block.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOp(boolean value) {
|
public void setOp(boolean value) {
|
||||||
throw new UnsupportedOperationException("Cannot change operator status of a block");
|
throw new UnsupportedOperationException("Cannot change operator status of a block");
|
||||||
}
|
}
|
||||||
|
@ -18,48 +18,59 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
sendRawMessage(message);
|
sendRawMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendRawMessage(String message) {
|
public void sendRawMessage(String message) {
|
||||||
System.out.println(ChatColor.stripColor(message));
|
System.out.println(ChatColor.stripColor(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String[] messages) {
|
public void sendMessage(String[] messages) {
|
||||||
for (String message : messages) {
|
for (String message : messages) {
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "CONSOLE";
|
return "CONSOLE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOp(boolean value) {
|
public void setOp(boolean value) {
|
||||||
throw new UnsupportedOperationException("Cannot change operator status of server console");
|
throw new UnsupportedOperationException("Cannot change operator status of server console");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean beginConversation(Conversation conversation) {
|
public boolean beginConversation(Conversation conversation) {
|
||||||
return conversationTracker.beginConversation(conversation);
|
return conversationTracker.beginConversation(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void abandonConversation(Conversation conversation) {
|
public void abandonConversation(Conversation conversation) {
|
||||||
conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
|
conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
|
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
|
||||||
conversationTracker.abandonConversation(conversation, details);
|
conversationTracker.abandonConversation(conversation, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void acceptConversationInput(String input) {
|
public void acceptConversationInput(String input) {
|
||||||
conversationTracker.acceptConversationInput(input);
|
conversationTracker.acceptConversationInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isConversing() {
|
public boolean isConversing() {
|
||||||
return conversationTracker.isConversing();
|
return conversationTracker.isConversing();
|
||||||
}
|
}
|
||||||
|
@ -16,46 +16,57 @@ public abstract class ServerCommandSender implements CommandSender {
|
|||||||
public ServerCommandSender() {
|
public ServerCommandSender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPermissionSet(String name) {
|
public boolean isPermissionSet(String name) {
|
||||||
return perm.isPermissionSet(name);
|
return perm.isPermissionSet(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPermissionSet(Permission perm) {
|
public boolean isPermissionSet(Permission perm) {
|
||||||
return this.perm.isPermissionSet(perm);
|
return this.perm.isPermissionSet(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPermission(String name) {
|
public boolean hasPermission(String name) {
|
||||||
return perm.hasPermission(name);
|
return perm.hasPermission(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPermission(Permission perm) {
|
public boolean hasPermission(Permission perm) {
|
||||||
return this.perm.hasPermission(perm);
|
return this.perm.hasPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
||||||
return perm.addAttachment(plugin, name, value);
|
return perm.addAttachment(plugin, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin) {
|
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||||
return perm.addAttachment(plugin);
|
return perm.addAttachment(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
||||||
return perm.addAttachment(plugin, name, value, ticks);
|
return perm.addAttachment(plugin, name, value, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||||
return perm.addAttachment(plugin, ticks);
|
return perm.addAttachment(plugin, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeAttachment(PermissionAttachment attachment) {
|
public void removeAttachment(PermissionAttachment attachment) {
|
||||||
perm.removeAttachment(attachment);
|
perm.removeAttachment(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void recalculatePermissions() {
|
public void recalculatePermissions() {
|
||||||
perm.recalculatePermissions();
|
perm.recalculatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||||
return perm.getEffectivePermissions();
|
return perm.getEffectivePermissions();
|
||||||
}
|
}
|
||||||
@ -64,6 +75,7 @@ public abstract class ServerCommandSender implements CommandSender {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Server getServer() {
|
public Server getServer() {
|
||||||
return Bukkit.getServer();
|
return Bukkit.getServer();
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,12 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti
|
|||||||
doesBounce = false;
|
doesBounce = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean doesBounce() {
|
public boolean doesBounce() {
|
||||||
return doesBounce;
|
return doesBounce;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBounce(boolean doesBounce) {
|
public void setBounce(boolean doesBounce) {
|
||||||
this.doesBounce = doesBounce;
|
this.doesBounce = doesBounce;
|
||||||
}
|
}
|
||||||
|
@ -22,33 +22,40 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
|
|||||||
return (EntityHorseAbstract) entity;
|
return (EntityHorseAbstract) entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setVariant(Horse.Variant variant) {
|
public void setVariant(Horse.Variant variant) {
|
||||||
throw new UnsupportedOperationException("Not supported.");
|
throw new UnsupportedOperationException("Not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getDomestication() {
|
public int getDomestication() {
|
||||||
return getHandle().getTemper();
|
return getHandle().getTemper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDomestication(int value) {
|
public void setDomestication(int value) {
|
||||||
Validate.isTrue(value >= 0, "Domestication cannot be less than zero");
|
Validate.isTrue(value >= 0, "Domestication cannot be less than zero");
|
||||||
Validate.isTrue(value <= getMaxDomestication(), "Domestication cannot be greater than the max domestication");
|
Validate.isTrue(value <= getMaxDomestication(), "Domestication cannot be greater than the max domestication");
|
||||||
getHandle().setTemper(value);
|
getHandle().setTemper(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxDomestication() {
|
public int getMaxDomestication() {
|
||||||
return getHandle().getMaxDomestication();
|
return getHandle().getMaxDomestication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxDomestication(int value) {
|
public void setMaxDomestication(int value) {
|
||||||
Validate.isTrue(value > 0, "Max domestication cannot be zero or less");
|
Validate.isTrue(value > 0, "Max domestication cannot be zero or less");
|
||||||
getHandle().maxDomestication = value;
|
getHandle().maxDomestication = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getJumpStrength() {
|
public double getJumpStrength() {
|
||||||
return getHandle().getJumpStrength();
|
return getHandle().getJumpStrength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setJumpStrength(double strength) {
|
public void setJumpStrength(double strength) {
|
||||||
Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
|
Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
|
||||||
getHandle().getAttributeInstance(EntityHorse.attributeJumpStrength).setValue(strength);
|
getHandle().getAttributeInstance(EntityHorse.attributeJumpStrength).setValue(strength);
|
||||||
|
@ -9,43 +9,52 @@ public class CraftAgeable extends CraftCreature implements Ageable {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return getHandle().getAge();
|
return getHandle().getAge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
getHandle().setAgeRaw(age);
|
getHandle().setAgeRaw(age);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAgeLock(boolean lock) {
|
public void setAgeLock(boolean lock) {
|
||||||
getHandle().ageLocked = lock;
|
getHandle().ageLocked = lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getAgeLock() {
|
public boolean getAgeLock() {
|
||||||
return getHandle().ageLocked;
|
return getHandle().ageLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBaby() {
|
public void setBaby() {
|
||||||
if (isAdult()) {
|
if (isAdult()) {
|
||||||
setAge(-24000);
|
setAge(-24000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAdult() {
|
public void setAdult() {
|
||||||
if (!isAdult()) {
|
if (!isAdult()) {
|
||||||
setAge(0);
|
setAge(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAdult() {
|
public boolean isAdult() {
|
||||||
return getAge() >= 0;
|
return getAge() >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canBreed() {
|
public boolean canBreed() {
|
||||||
return getAge() == 0;
|
return getAge() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBreed(boolean breed) {
|
public void setBreed(boolean breed) {
|
||||||
if (breed) {
|
if (breed) {
|
||||||
setAge(0);
|
setAge(0);
|
||||||
|
@ -20,6 +20,7 @@ public class CraftAmbient extends CraftMob implements Ambient {
|
|||||||
return "CraftAmbient";
|
return "CraftAmbient";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -214,11 +214,13 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
|
|||||||
return CraftPotionUtil.toBukkit(getHandle().getType());
|
return CraftPotionUtil.toBukkit(getHandle().getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProjectileSource getSource() {
|
public ProjectileSource getSource() {
|
||||||
EntityLiving source = getHandle().getSource();
|
EntityLiving source = getHandle().getSource();
|
||||||
return (source == null) ? null : (LivingEntity) source.getBukkitEntity();
|
return (source == null) ? null : (LivingEntity) source.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSource(ProjectileSource shooter) {
|
public void setSource(ProjectileSource shooter) {
|
||||||
if (shooter instanceof CraftLivingEntity) {
|
if (shooter instanceof CraftLivingEntity) {
|
||||||
getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
|
getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
|
||||||
|
@ -17,11 +17,13 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setKnockbackStrength(int knockbackStrength) {
|
public void setKnockbackStrength(int knockbackStrength) {
|
||||||
Validate.isTrue(knockbackStrength >= 0, "Knockback cannot be negative");
|
Validate.isTrue(knockbackStrength >= 0, "Knockback cannot be negative");
|
||||||
getHandle().setKnockbackStrength(knockbackStrength);
|
getHandle().setKnockbackStrength(knockbackStrength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getKnockbackStrength() {
|
public int getKnockbackStrength() {
|
||||||
return getHandle().knockbackStrength;
|
return getHandle().knockbackStrength;
|
||||||
}
|
}
|
||||||
@ -37,18 +39,22 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
|
|||||||
getHandle().setDamage(damage);
|
getHandle().setDamage(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCritical() {
|
public boolean isCritical() {
|
||||||
return getHandle().isCritical();
|
return getHandle().isCritical();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCritical(boolean critical) {
|
public void setCritical(boolean critical) {
|
||||||
getHandle().setCritical(critical);
|
getHandle().setCritical(critical);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProjectileSource getShooter() {
|
public ProjectileSource getShooter() {
|
||||||
return getHandle().projectileSource;
|
return getHandle().projectileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShooter(ProjectileSource shooter) {
|
public void setShooter(ProjectileSource shooter) {
|
||||||
if (shooter instanceof Entity) {
|
if (shooter instanceof Entity) {
|
||||||
getHandle().setShooter(((CraftEntity) shooter).getHandle());
|
getHandle().setShooter(((CraftEntity) shooter).getHandle());
|
||||||
@ -102,6 +108,7 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
|
|||||||
return "CraftArrow";
|
return "CraftArrow";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftBat extends CraftAmbient implements Bat {
|
|||||||
return "CraftBat";
|
return "CraftBat";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.BAT;
|
return EntityType.BAT;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftBlaze extends CraftMonster implements Blaze {
|
|||||||
return "CraftBlaze";
|
return "CraftBlaze";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.BLAZE;
|
return EntityType.BLAZE;
|
||||||
}
|
}
|
||||||
|
@ -22,38 +22,46 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
|||||||
getHandle().setType(getBoatType(species));
|
getHandle().setType(getBoatType(species));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getMaxSpeed() {
|
public double getMaxSpeed() {
|
||||||
return getHandle().maxSpeed;
|
return getHandle().maxSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxSpeed(double speed) {
|
public void setMaxSpeed(double speed) {
|
||||||
if (speed >= 0D) {
|
if (speed >= 0D) {
|
||||||
getHandle().maxSpeed = speed;
|
getHandle().maxSpeed = speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getOccupiedDeceleration() {
|
public double getOccupiedDeceleration() {
|
||||||
return getHandle().occupiedDeceleration;
|
return getHandle().occupiedDeceleration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOccupiedDeceleration(double speed) {
|
public void setOccupiedDeceleration(double speed) {
|
||||||
if (speed >= 0D) {
|
if (speed >= 0D) {
|
||||||
getHandle().occupiedDeceleration = speed;
|
getHandle().occupiedDeceleration = speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getUnoccupiedDeceleration() {
|
public double getUnoccupiedDeceleration() {
|
||||||
return getHandle().unoccupiedDeceleration;
|
return getHandle().unoccupiedDeceleration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUnoccupiedDeceleration(double speed) {
|
public void setUnoccupiedDeceleration(double speed) {
|
||||||
getHandle().unoccupiedDeceleration = speed;
|
getHandle().unoccupiedDeceleration = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getWorkOnLand() {
|
public boolean getWorkOnLand() {
|
||||||
return getHandle().landBoats;
|
return getHandle().landBoats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWorkOnLand(boolean workOnLand) {
|
public void setWorkOnLand(boolean workOnLand) {
|
||||||
getHandle().landBoats = workOnLand;
|
getHandle().landBoats = workOnLand;
|
||||||
}
|
}
|
||||||
@ -68,6 +76,7 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
|||||||
return "CraftBoat";
|
return "CraftBoat";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.BOAT;
|
return EntityType.BOAT;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider {
|
|||||||
return "CraftCaveSpider";
|
return "CraftCaveSpider";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.CAVE_SPIDER;
|
return EntityType.CAVE_SPIDER;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftChicken extends CraftAnimals implements Chicken {
|
|||||||
return "CraftChicken";
|
return "CraftChicken";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.CHICKEN;
|
return EntityType.CHICKEN;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ComplexLivingEntity getParent() {
|
public ComplexLivingEntity getParent() {
|
||||||
return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity();
|
return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity();
|
||||||
}
|
}
|
||||||
@ -42,6 +43,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
|
|||||||
return "CraftComplexPart";
|
return "CraftComplexPart";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftCow extends CraftAnimals implements Cow {
|
|||||||
return "CraftCow";
|
return "CraftCow";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.COW;
|
return EntityType.COW;
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,12 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPowered() {
|
public boolean isPowered() {
|
||||||
return getHandle().isPowered();
|
return getHandle().isPowered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPowered(boolean powered) {
|
public void setPowered(boolean powered) {
|
||||||
CraftServer server = this.server;
|
CraftServer server = this.server;
|
||||||
Creeper entity = (Creeper) this.getHandle().getBukkitEntity();
|
Creeper entity = (Creeper) this.getHandle().getBukkitEntity();
|
||||||
@ -72,6 +74,7 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
|||||||
return "CraftCreeper";
|
return "CraftCreeper";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.CREEPER;
|
return EntityType.CREEPER;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftEgg extends CraftProjectile implements Egg {
|
|||||||
return "CraftEgg";
|
return "CraftEgg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.EGG;
|
return EntityType.EGG;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
|
|||||||
return "CraftEnderCrystal";
|
return "CraftEnderCrystal";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ENDER_CRYSTAL;
|
return EntityType.ENDER_CRYSTAL;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<ComplexEntityPart> getParts() {
|
public Set<ComplexEntityPart> getParts() {
|
||||||
Builder<ComplexEntityPart> builder = ImmutableSet.builder();
|
Builder<ComplexEntityPart> builder = ImmutableSet.builder();
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
|
|||||||
return "CraftEnderDragon";
|
return "CraftEnderDragon";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ENDER_DRAGON;
|
return EntityType.ENDER_DRAGON;
|
||||||
}
|
}
|
||||||
|
@ -26,30 +26,37 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
|
|||||||
return "CraftEnderDragonPart";
|
return "CraftEnderDragonPart";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void damage(double amount) {
|
public void damage(double amount) {
|
||||||
getParent().damage(amount);
|
getParent().damage(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void damage(double amount, Entity source) {
|
public void damage(double amount, Entity source) {
|
||||||
getParent().damage(amount, source);
|
getParent().damage(amount, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getHealth() {
|
public double getHealth() {
|
||||||
return getParent().getHealth();
|
return getParent().getHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHealth(double health) {
|
public void setHealth(double health) {
|
||||||
getParent().setHealth(health);
|
getParent().setHealth(health);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getMaxHealth() {
|
public double getMaxHealth() {
|
||||||
return getParent().getMaxHealth();
|
return getParent().getMaxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxHealth(double health) {
|
public void setMaxHealth(double health) {
|
||||||
getParent().setMaxHealth(health);
|
getParent().setMaxHealth(health);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void resetMaxHealth() {
|
public void resetMaxHealth() {
|
||||||
getParent().resetMaxHealth();
|
getParent().resetMaxHealth();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftEnderPearl extends CraftProjectile implements EnderPearl {
|
|||||||
return "CraftEnderPearl";
|
return "CraftEnderPearl";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ENDER_PEARL;
|
return EntityType.ENDER_PEARL;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MaterialData getCarriedMaterial() {
|
public MaterialData getCarriedMaterial() {
|
||||||
IBlockData blockData = getHandle().getCarried();
|
IBlockData blockData = getHandle().getCarried();
|
||||||
return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData);
|
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);
|
return (blockData == null) ? null : CraftBlockData.fromData(blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCarriedMaterial(MaterialData data) {
|
public void setCarriedMaterial(MaterialData data) {
|
||||||
getHandle().setCarried(CraftMagicNumbers.getBlock(data));
|
getHandle().setCarried(CraftMagicNumbers.getBlock(data));
|
||||||
}
|
}
|
||||||
@ -46,6 +48,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
|
|||||||
return "CraftEnderman";
|
return "CraftEnderman";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ENDERMAN;
|
return EntityType.ENDERMAN;
|
||||||
}
|
}
|
||||||
|
@ -370,10 +370,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
|
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.getBukkitYaw(), entity.pitch);
|
return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.getBukkitYaw(), entity.pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation(Location loc) {
|
public Location getLocation(Location loc) {
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
loc.setWorld(getWorld());
|
loc.setWorld(getWorld());
|
||||||
@ -387,10 +389,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getVelocity() {
|
public Vector getVelocity() {
|
||||||
return CraftVector.toBukkit(entity.getMot());
|
return CraftVector.toBukkit(entity.getMot());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setVelocity(Vector velocity) {
|
public void setVelocity(Vector velocity) {
|
||||||
Preconditions.checkArgument(velocity != null, "velocity");
|
Preconditions.checkArgument(velocity != null, "velocity");
|
||||||
velocity.checkFinite();
|
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);
|
return new BoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOnGround() {
|
public boolean isOnGround() {
|
||||||
if (entity instanceof EntityArrow) {
|
if (entity instanceof EntityArrow) {
|
||||||
return ((EntityArrow) entity).inGround;
|
return ((EntityArrow) entity).inGround;
|
||||||
@ -421,6 +426,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return entity.onGround;
|
return entity.onGround;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return entity.world.getWorld();
|
return entity.world.getWorld();
|
||||||
}
|
}
|
||||||
@ -440,10 +446,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
entity.setHeadRotation(yaw);
|
entity.setHeadRotation(yaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean teleport(Location location) {
|
public boolean teleport(Location location) {
|
||||||
return teleport(location, TeleportCause.PLUGIN);
|
return teleport(location, TeleportCause.PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean teleport(Location location, TeleportCause cause) {
|
public boolean teleport(Location location, TeleportCause cause) {
|
||||||
Preconditions.checkArgument(location != null, "location");
|
Preconditions.checkArgument(location != null, "location");
|
||||||
location.checkFinite();
|
location.checkFinite();
|
||||||
@ -469,14 +477,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean teleport(org.bukkit.entity.Entity destination) {
|
public boolean teleport(org.bukkit.entity.Entity destination) {
|
||||||
return teleport(destination.getLocation());
|
return teleport(destination.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean teleport(org.bukkit.entity.Entity destination, TeleportCause cause) {
|
public boolean teleport(org.bukkit.entity.Entity destination, TeleportCause cause) {
|
||||||
return teleport(destination.getLocation(), cause);
|
return teleport(destination.getLocation(), cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
|
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
|
||||||
List<Entity> notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null);
|
List<Entity> notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null);
|
||||||
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
|
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
|
||||||
@ -487,34 +498,42 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return bukkitEntityList;
|
return bukkitEntityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
return entity.getId();
|
return entity.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getFireTicks() {
|
public int getFireTicks() {
|
||||||
return entity.fireTicks;
|
return entity.fireTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxFireTicks() {
|
public int getMaxFireTicks() {
|
||||||
return entity.getMaxFireTicks();
|
return entity.getMaxFireTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFireTicks(int ticks) {
|
public void setFireTicks(int ticks) {
|
||||||
entity.fireTicks = ticks;
|
entity.fireTicks = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
entity.die();
|
entity.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDead() {
|
public boolean isDead() {
|
||||||
return !entity.isAlive();
|
return !entity.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return entity.isAlive() && entity.valid;
|
return entity.isAlive() && entity.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Server getServer() {
|
public Server getServer() {
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
@ -537,10 +556,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
setVelocity(value);
|
setVelocity(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.entity.Entity getPassenger() {
|
public org.bukkit.entity.Entity getPassenger() {
|
||||||
return isEmpty() ? null : getHandle().passengers.get(0).getBukkitEntity();
|
return isEmpty() ? null : getHandle().passengers.get(0).getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setPassenger(org.bukkit.entity.Entity passenger) {
|
public boolean setPassenger(org.bukkit.entity.Entity passenger) {
|
||||||
Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself.");
|
Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself.");
|
||||||
if (passenger instanceof CraftEntity) {
|
if (passenger instanceof CraftEntity) {
|
||||||
@ -576,10 +597,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return !getHandle().isVehicle();
|
return !getHandle().isVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean eject() {
|
public boolean eject() {
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@ -589,30 +612,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getFallDistance() {
|
public float getFallDistance() {
|
||||||
return getHandle().fallDistance;
|
return getHandle().fallDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFallDistance(float distance) {
|
public void setFallDistance(float distance) {
|
||||||
getHandle().fallDistance = distance;
|
getHandle().fallDistance = distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLastDamageCause(EntityDamageEvent event) {
|
public void setLastDamageCause(EntityDamageEvent event) {
|
||||||
lastDamageEvent = event;
|
lastDamageEvent = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityDamageEvent getLastDamageCause() {
|
public EntityDamageEvent getLastDamageCause() {
|
||||||
return lastDamageEvent;
|
return lastDamageEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public UUID getUniqueId() {
|
public UUID getUniqueId() {
|
||||||
return getHandle().getUniqueID();
|
return getHandle().getUniqueID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getTicksLived() {
|
public int getTicksLived() {
|
||||||
return getHandle().ticksLived;
|
return getHandle().ticksLived;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTicksLived(int value) {
|
public void setTicksLived(int value) {
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
throw new IllegalArgumentException("Age must be at least 1 tick");
|
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;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
return server.getEntityMetadata().getMetadata(this, metadataKey);
|
return server.getEntityMetadata().getMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
return server.getEntityMetadata().hasMetadata(this, metadataKey);
|
return server.getEntityMetadata().hasMetadata(this, metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isInsideVehicle() {
|
public boolean isInsideVehicle() {
|
||||||
return getHandle().isPassenger();
|
return getHandle().isPassenger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean leaveVehicle() {
|
public boolean leaveVehicle() {
|
||||||
if (!isInsideVehicle()) {
|
if (!isInsideVehicle()) {
|
||||||
return false;
|
return false;
|
||||||
@ -690,6 +726,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.entity.Entity getVehicle() {
|
public org.bukkit.entity.Entity getVehicle() {
|
||||||
if (!isInsideVehicle()) {
|
if (!isInsideVehicle()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -10,10 +10,12 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getExperience() {
|
public int getExperience() {
|
||||||
return getHandle().value;
|
return getHandle().value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setExperience(int value) {
|
public void setExperience(int value) {
|
||||||
getHandle().value = value;
|
getHandle().value = value;
|
||||||
}
|
}
|
||||||
@ -28,6 +30,7 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
|||||||
return "CraftExperienceOrb";
|
return "CraftExperienceOrb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.EXPERIENCE_ORB;
|
return EntityType.EXPERIENCE_ORB;
|
||||||
}
|
}
|
||||||
|
@ -25,22 +25,27 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
|
|||||||
return "CraftFallingBlock";
|
return "CraftFallingBlock";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.FALLING_BLOCK;
|
return EntityType.FALLING_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
return CraftMagicNumbers.getMaterial(getHandle().getBlock()).getItemType();
|
return CraftMagicNumbers.getMaterial(getHandle().getBlock()).getItemType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockData getBlockData() {
|
public BlockData getBlockData() {
|
||||||
return CraftBlockData.fromData(getHandle().getBlock());
|
return CraftBlockData.fromData(getHandle().getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getDropItem() {
|
public boolean getDropItem() {
|
||||||
return getHandle().dropItem;
|
return getHandle().dropItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDropItem(boolean drop) {
|
public void setDropItem(boolean drop) {
|
||||||
getHandle().dropItem = drop;
|
getHandle().dropItem = drop;
|
||||||
}
|
}
|
||||||
|
@ -14,26 +14,32 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getYield() {
|
public float getYield() {
|
||||||
return getHandle().bukkitYield;
|
return getHandle().bukkitYield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIncendiary() {
|
public boolean isIncendiary() {
|
||||||
return getHandle().isIncendiary;
|
return getHandle().isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIsIncendiary(boolean isIncendiary) {
|
public void setIsIncendiary(boolean isIncendiary) {
|
||||||
getHandle().isIncendiary = isIncendiary;
|
getHandle().isIncendiary = isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setYield(float yield) {
|
public void setYield(float yield) {
|
||||||
getHandle().bukkitYield = yield;
|
getHandle().bukkitYield = yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProjectileSource getShooter() {
|
public ProjectileSource getShooter() {
|
||||||
return getHandle().projectileSource;
|
return getHandle().projectileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShooter(ProjectileSource shooter) {
|
public void setShooter(ProjectileSource shooter) {
|
||||||
if (shooter instanceof CraftLivingEntity) {
|
if (shooter instanceof CraftLivingEntity) {
|
||||||
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
||||||
@ -43,10 +49,12 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
|||||||
getHandle().projectileSource = shooter;
|
getHandle().projectileSource = shooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getDirection() {
|
public Vector getDirection() {
|
||||||
return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ);
|
return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDirection(Vector direction) {
|
public void setDirection(Vector direction) {
|
||||||
Validate.notNull(direction, "Direction can not be null");
|
Validate.notNull(direction, "Direction can not be null");
|
||||||
double x = direction.getX();
|
double x = direction.getX();
|
||||||
@ -68,6 +76,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
|||||||
return "CraftFireball";
|
return "CraftFireball";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProjectileSource getShooter() {
|
public ProjectileSource getShooter() {
|
||||||
if (getHandle().owner != null) {
|
if (getHandle().owner != null) {
|
||||||
return getHandle().owner.getBukkitEntity();
|
return getHandle().owner.getBukkitEntity();
|
||||||
@ -25,6 +26,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShooter(ProjectileSource shooter) {
|
public void setShooter(ProjectileSource shooter) {
|
||||||
if (shooter instanceof CraftHumanEntity) {
|
if (shooter instanceof CraftHumanEntity) {
|
||||||
getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
||||||
@ -41,10 +43,12 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
|||||||
return "CraftFishingHook";
|
return "CraftFishingHook";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.FISHING_HOOK;
|
return EntityType.FISHING_HOOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getBiteChance() {
|
public double getBiteChance() {
|
||||||
EntityFishingHook hook = getHandle();
|
EntityFishingHook hook = getHandle();
|
||||||
|
|
||||||
@ -57,6 +61,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
|||||||
return this.biteChance;
|
return this.biteChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBiteChance(double chance) {
|
public void setBiteChance(double chance) {
|
||||||
Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
|
Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
|
||||||
this.biteChance = chance;
|
this.biteChance = chance;
|
||||||
|
@ -21,6 +21,7 @@ public class CraftGhast extends CraftFlying implements Ghast {
|
|||||||
return "CraftGhast";
|
return "CraftGhast";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.GHAST;
|
return EntityType.GHAST;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftGiant extends CraftMonster implements Giant {
|
|||||||
return "CraftGiant";
|
return "CraftGiant";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.GIANT;
|
return EntityType.GIANT;
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,17 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockFace getAttachedFace() {
|
public BlockFace getAttachedFace() {
|
||||||
return getFacing().getOppositeFace();
|
return getFacing().getOppositeFace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFacingDirection(BlockFace face) {
|
public void setFacingDirection(BlockFace face) {
|
||||||
setFacingDirection(face, false);
|
setFacingDirection(face, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||||
EntityHanging hanging = getHandle();
|
EntityHanging hanging = getHandle();
|
||||||
EnumDirection dir = hanging.direction;
|
EnumDirection dir = hanging.direction;
|
||||||
@ -47,6 +50,7 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockFace getFacing() {
|
public BlockFace getFacing() {
|
||||||
EnumDirection direction = this.getHandle().direction;
|
EnumDirection direction = this.getHandle().direction;
|
||||||
if (direction == null) return BlockFace.SELF;
|
if (direction == null) return BlockFace.SELF;
|
||||||
@ -63,6 +67,7 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
|||||||
return "CraftHanging";
|
return "CraftHanging";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -91,34 +91,42 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
enderChest = new CraftInventory(entity.getEnderChest());
|
enderChest = new CraftInventory(entity.getEnderChest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PlayerInventory getInventory() {
|
public PlayerInventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityEquipment getEquipment() {
|
public EntityEquipment getEquipment() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Inventory getEnderChest() {
|
public Inventory getEnderChest() {
|
||||||
return enderChest;
|
return enderChest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MainHand getMainHand() {
|
public MainHand getMainHand() {
|
||||||
return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
|
return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItemInHand() {
|
public ItemStack getItemInHand() {
|
||||||
return getInventory().getItemInHand();
|
return getInventory().getItemInHand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItemInHand(ItemStack item) {
|
public void setItemInHand(ItemStack item) {
|
||||||
getInventory().setItemInHand(item);
|
getInventory().setItemInHand(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItemOnCursor() {
|
public ItemStack getItemOnCursor() {
|
||||||
return CraftItemStack.asCraftMirror(getHandle().inventory.getCarried());
|
return CraftItemStack.asCraftMirror(getHandle().inventory.getCarried());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItemOnCursor(ItemStack item) {
|
public void setItemOnCursor(ItemStack item) {
|
||||||
net.minecraft.server.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
||||||
getHandle().inventory.setCarried(stack);
|
getHandle().inventory.setCarried(stack);
|
||||||
@ -127,10 +135,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSleeping() {
|
public boolean isSleeping() {
|
||||||
return getHandle().isSleeping();
|
return getHandle().isSleeping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSleepTicks() {
|
public int getSleepTicks() {
|
||||||
return getHandle().sleepTicks;
|
return getHandle().sleepTicks;
|
||||||
}
|
}
|
||||||
@ -207,63 +217,78 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return getHandle().getName();
|
return getHandle().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPermissionSet(String name) {
|
public boolean isPermissionSet(String name) {
|
||||||
return perm.isPermissionSet(name);
|
return perm.isPermissionSet(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPermissionSet(Permission perm) {
|
public boolean isPermissionSet(Permission perm) {
|
||||||
return this.perm.isPermissionSet(perm);
|
return this.perm.isPermissionSet(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPermission(String name) {
|
public boolean hasPermission(String name) {
|
||||||
return perm.hasPermission(name);
|
return perm.hasPermission(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPermission(Permission perm) {
|
public boolean hasPermission(Permission perm) {
|
||||||
return this.perm.hasPermission(perm);
|
return this.perm.hasPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
||||||
return perm.addAttachment(plugin, name, value);
|
return perm.addAttachment(plugin, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin) {
|
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||||
return perm.addAttachment(plugin);
|
return perm.addAttachment(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
||||||
return perm.addAttachment(plugin, name, value, ticks);
|
return perm.addAttachment(plugin, name, value, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||||
return perm.addAttachment(plugin, ticks);
|
return perm.addAttachment(plugin, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeAttachment(PermissionAttachment attachment) {
|
public void removeAttachment(PermissionAttachment attachment) {
|
||||||
perm.removeAttachment(attachment);
|
perm.removeAttachment(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void recalculatePermissions() {
|
public void recalculatePermissions() {
|
||||||
perm.recalculatePermissions();
|
perm.recalculatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOp(boolean value) {
|
public void setOp(boolean value) {
|
||||||
this.op = value;
|
this.op = value;
|
||||||
perm.recalculatePermissions();
|
perm.recalculatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||||
return perm.getEffectivePermissions();
|
return perm.getEffectivePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public GameMode getGameMode() {
|
public GameMode getGameMode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setGameMode(GameMode mode) {
|
public void setGameMode(GameMode mode) {
|
||||||
if (mode == null) {
|
if (mode == null) {
|
||||||
throw new IllegalArgumentException("Mode cannot be 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() + '}';
|
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryView getOpenInventory() {
|
public InventoryView getOpenInventory() {
|
||||||
return getHandle().activeContainer.getBukkitView();
|
return getHandle().activeContainer.getBukkitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryView openInventory(Inventory inventory) {
|
public InventoryView openInventory(Inventory inventory) {
|
||||||
if(!(getHandle() instanceof EntityPlayer)) return null;
|
if(!(getHandle() instanceof EntityPlayer)) return null;
|
||||||
EntityPlayer player = (EntityPlayer) getHandle();
|
EntityPlayer player = (EntityPlayer) getHandle();
|
||||||
@ -463,6 +490,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
getHandle().activeContainer.addSlotListener(player);
|
getHandle().activeContainer.addSlotListener(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryView openWorkbench(Location location, boolean force) {
|
public InventoryView openWorkbench(Location location, boolean force) {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
@ -480,6 +508,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return getHandle().activeContainer.getBukkitView();
|
return getHandle().activeContainer.getBukkitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryView openEnchanting(Location location, boolean force) {
|
public InventoryView openEnchanting(Location location, boolean force) {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
@ -501,6 +530,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return getHandle().activeContainer.getBukkitView();
|
return getHandle().activeContainer.getBukkitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void openInventory(InventoryView inventory) {
|
public void openInventory(InventoryView inventory) {
|
||||||
if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support?
|
if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support?
|
||||||
if (((EntityPlayer) getHandle()).playerConnection == null) return;
|
if (((EntityPlayer) getHandle()).playerConnection == null) return;
|
||||||
@ -567,10 +597,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return this.getHandle().activeContainer.getBukkitView();
|
return this.getHandle().activeContainer.getBukkitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
getHandle().closeInventory();
|
getHandle().closeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlocking() {
|
public boolean isBlocking() {
|
||||||
return getHandle().isBlocking();
|
return getHandle().isBlocking();
|
||||||
}
|
}
|
||||||
@ -580,10 +612,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return getHandle().isHandRaised();
|
return getHandle().isHandRaised();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setWindowProperty(InventoryView.Property prop, int value) {
|
public boolean setWindowProperty(InventoryView.Property prop, int value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getExpToLevel() {
|
public int getExpToLevel() {
|
||||||
return getHandle().getExpToLevel();
|
return getHandle().getExpToLevel();
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,12 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
|
|||||||
return "CraftIronGolem";
|
return "CraftIronGolem";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPlayerCreated() {
|
public boolean isPlayerCreated() {
|
||||||
return getHandle().isPlayerCreated();
|
return getHandle().isPlayerCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPlayerCreated(boolean playerCreated) {
|
public void setPlayerCreated(boolean playerCreated) {
|
||||||
getHandle().setPlayerCreated(playerCreated);
|
getHandle().setPlayerCreated(playerCreated);
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,22 @@ public class CraftItem extends CraftEntity implements Item {
|
|||||||
this(server, entity, entity);
|
this(server, entity, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
return CraftItemStack.asCraftMirror(item.getItemStack());
|
return CraftItemStack.asCraftMirror(item.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItemStack(ItemStack stack) {
|
public void setItemStack(ItemStack stack) {
|
||||||
item.setItemStack(CraftItemStack.asNMSCopy(stack));
|
item.setItemStack(CraftItemStack.asNMSCopy(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getPickupDelay() {
|
public int getPickupDelay() {
|
||||||
return item.pickupDelay;
|
return item.pickupDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPickupDelay(int delay) {
|
public void setPickupDelay(int delay) {
|
||||||
item.pickupDelay = Math.min(delay, Short.MAX_VALUE);
|
item.pickupDelay = Math.min(delay, Short.MAX_VALUE);
|
||||||
}
|
}
|
||||||
@ -49,6 +53,7 @@ public class CraftItem extends CraftEntity implements Item {
|
|||||||
return "CraftItem";
|
return "CraftItem";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.DROPPED_ITEM;
|
return EntityType.DROPPED_ITEM;
|
||||||
}
|
}
|
||||||
|
@ -54,18 +54,22 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||||||
this.entity = frame;
|
this.entity = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItem(org.bukkit.inventory.ItemStack item) {
|
public void setItem(org.bukkit.inventory.ItemStack item) {
|
||||||
setItem(item, true);
|
setItem(item, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItem(org.bukkit.inventory.ItemStack item, boolean playSound) {
|
public void setItem(org.bukkit.inventory.ItemStack item, boolean playSound) {
|
||||||
getHandle().setItem(CraftItemStack.asNMSCopy(item), true, playSound);
|
getHandle().setItem(CraftItemStack.asNMSCopy(item), true, playSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public org.bukkit.inventory.ItemStack getItem() {
|
public org.bukkit.inventory.ItemStack getItem() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Rotation getRotation() {
|
public Rotation getRotation() {
|
||||||
return toBukkitRotation(getHandle().getRotation());
|
return toBukkitRotation(getHandle().getRotation());
|
||||||
}
|
}
|
||||||
@ -94,6 +98,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRotation(Rotation rotation) {
|
public void setRotation(Rotation rotation) {
|
||||||
Validate.notNull(rotation, "Rotation cannot be null");
|
Validate.notNull(rotation, "Rotation cannot be null");
|
||||||
getHandle().setRotation(toInteger(rotation));
|
getHandle().setRotation(toInteger(rotation));
|
||||||
@ -133,6 +138,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||||||
return "CraftItemFrame{item=" + getItem() + ", rotation=" + getRotation() + "}";
|
return "CraftItemFrame{item=" + getItem() + ", rotation=" + getRotation() + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ITEM_FRAME;
|
return EntityType.ITEM_FRAME;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class CraftLargeFireball extends CraftFireball implements LargeFireball {
|
|||||||
return "CraftLargeFireball";
|
return "CraftLargeFireball";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.FIREBALL;
|
return EntityType.FIREBALL;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftLeash extends CraftHanging implements LeashHitch {
|
|||||||
return "CraftLeash";
|
return "CraftLeash";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.LEASH_HITCH;
|
return EntityType.LEASH_HITCH;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEffect() {
|
public boolean isEffect() {
|
||||||
return ((EntityLightning) super.getHandle()).isEffect;
|
return ((EntityLightning) super.getHandle()).isEffect;
|
||||||
}
|
}
|
||||||
@ -24,6 +25,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
|||||||
return "CraftLightningStrike";
|
return "CraftLightningStrike";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.LIGHTNING;
|
return EntityType.LIGHTNING;
|
||||||
}
|
}
|
||||||
|
@ -92,10 +92,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getHealth() {
|
public double getHealth() {
|
||||||
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
|
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHealth(double health) {
|
public void setHealth(double health) {
|
||||||
health = (float) health;
|
health = (float) health;
|
||||||
if ((health < 0) || (health > getMaxHealth())) {
|
if ((health < 0) || (health > getMaxHealth())) {
|
||||||
@ -109,10 +111,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getMaxHealth() {
|
public double getMaxHealth() {
|
||||||
return getHandle().getMaxHealth();
|
return getHandle().getMaxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxHealth(double amount) {
|
public void setMaxHealth(double amount) {
|
||||||
Validate.isTrue(amount > 0, "Max health must be greater than 0");
|
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() {
|
public void resetMaxHealth() {
|
||||||
setMaxHealth(getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).getAttribute().getDefault());
|
setMaxHealth(getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).getAttribute().getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getEyeHeight() {
|
public double getEyeHeight() {
|
||||||
return getHandle().getHeadHeight();
|
return getHandle().getHeadHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getEyeHeight(boolean ignorePose) {
|
public double getEyeHeight(boolean ignorePose) {
|
||||||
return getEyeHeight();
|
return getEyeHeight();
|
||||||
}
|
}
|
||||||
@ -158,15 +165,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Block> getLineOfSight(Set<Material> transparent, int maxDistance) {
|
public List<Block> getLineOfSight(Set<Material> transparent, int maxDistance) {
|
||||||
return getLineOfSight(transparent, maxDistance, 0);
|
return getLineOfSight(transparent, maxDistance, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Block getTargetBlock(Set<Material> transparent, int maxDistance) {
|
public Block getTargetBlock(Set<Material> transparent, int maxDistance) {
|
||||||
List<Block> blocks = getLineOfSight(transparent, maxDistance, 1);
|
List<Block> blocks = getLineOfSight(transparent, maxDistance, 1);
|
||||||
return blocks.get(0);
|
return blocks.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
|
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
|
||||||
return getLineOfSight(transparent, maxDistance, 2);
|
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);
|
return this.getWorld().rayTraceBlocks(eyeLocation, direction, maxDistance, fluidCollisionMode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRemainingAir() {
|
public int getRemainingAir() {
|
||||||
return getHandle().getAirTicks();
|
return getHandle().getAirTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRemainingAir(int ticks) {
|
public void setRemainingAir(int ticks) {
|
||||||
getHandle().setAirTicks(ticks);
|
getHandle().setAirTicks(ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaximumAir() {
|
public int getMaximumAir() {
|
||||||
return getHandle().maxAirTicks;
|
return getHandle().maxAirTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaximumAir(int ticks) {
|
public void setMaximumAir(int ticks) {
|
||||||
getHandle().maxAirTicks = ticks;
|
getHandle().maxAirTicks = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void damage(double amount) {
|
public void damage(double amount) {
|
||||||
damage(amount, null);
|
damage(amount, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void damage(double amount, org.bukkit.entity.Entity source) {
|
public void damage(double amount, org.bukkit.entity.Entity source) {
|
||||||
DamageSource reason = DamageSource.GENERIC;
|
DamageSource reason = DamageSource.GENERIC;
|
||||||
|
|
||||||
@ -226,32 +242,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
entity.damageEntity(reason, (float) amount);
|
entity.damageEntity(reason, (float) amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getEyeLocation() {
|
public Location getEyeLocation() {
|
||||||
Location loc = getLocation();
|
Location loc = getLocation();
|
||||||
loc.setY(loc.getY() + getEyeHeight());
|
loc.setY(loc.getY() + getEyeHeight());
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaximumNoDamageTicks() {
|
public int getMaximumNoDamageTicks() {
|
||||||
return getHandle().maxNoDamageTicks;
|
return getHandle().maxNoDamageTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaximumNoDamageTicks(int ticks) {
|
public void setMaximumNoDamageTicks(int ticks) {
|
||||||
getHandle().maxNoDamageTicks = ticks;
|
getHandle().maxNoDamageTicks = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getLastDamage() {
|
public double getLastDamage() {
|
||||||
return getHandle().lastDamage;
|
return getHandle().lastDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLastDamage(double damage) {
|
public void setLastDamage(double damage) {
|
||||||
getHandle().lastDamage = (float) damage;
|
getHandle().lastDamage = (float) damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getNoDamageTicks() {
|
public int getNoDamageTicks() {
|
||||||
return getHandle().noDamageTicks;
|
return getHandle().noDamageTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNoDamageTicks(int ticks) {
|
public void setNoDamageTicks(int ticks) {
|
||||||
getHandle().noDamageTicks = ticks;
|
getHandle().noDamageTicks = ticks;
|
||||||
}
|
}
|
||||||
@ -270,14 +293,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
|
return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Player getKiller() {
|
public Player getKiller() {
|
||||||
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
|
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean addPotionEffect(PotionEffect effect) {
|
public boolean addPotionEffect(PotionEffect effect) {
|
||||||
return addPotionEffect(effect, false);
|
return addPotionEffect(effect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
||||||
if (hasPotionEffect(effect.getType())) {
|
if (hasPotionEffect(effect.getType())) {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
@ -289,6 +315,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean addPotionEffects(Collection<PotionEffect> effects) {
|
public boolean addPotionEffects(Collection<PotionEffect> effects) {
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
@ -297,6 +324,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPotionEffect(PotionEffectType type) {
|
public boolean hasPotionEffect(PotionEffectType type) {
|
||||||
return getHandle().hasEffect(MobEffectList.fromId(type.getId()));
|
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());
|
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) {
|
public void removePotionEffect(PotionEffectType type) {
|
||||||
getHandle().removeEffect(MobEffectList.fromId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN);
|
getHandle().removeEffect(MobEffectList.fromId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<PotionEffect> getActivePotionEffects() {
|
public Collection<PotionEffect> getActivePotionEffects() {
|
||||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||||
for (MobEffect handle : getHandle().effects.values()) {
|
for (MobEffect handle : getHandle().effects.values()) {
|
||||||
@ -319,10 +349,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return effects;
|
return effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
|
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
|
||||||
return launchProjectile(projectile, null);
|
return launchProjectile(projectile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
|
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
|
||||||
net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
|
net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
|
||||||
@ -405,32 +437,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return (T) launch.getBukkitEntity();
|
return (T) launch.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.UNKNOWN;
|
return EntityType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasLineOfSight(Entity other) {
|
public boolean hasLineOfSight(Entity other) {
|
||||||
return getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
|
return getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getRemoveWhenFarAway() {
|
public boolean getRemoveWhenFarAway() {
|
||||||
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent;
|
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRemoveWhenFarAway(boolean remove) {
|
public void setRemoveWhenFarAway(boolean remove) {
|
||||||
if (getHandle() instanceof EntityInsentient) {
|
if (getHandle() instanceof EntityInsentient) {
|
||||||
((EntityInsentient) getHandle()).persistent = !remove;
|
((EntityInsentient) getHandle()).persistent = !remove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityEquipment getEquipment() {
|
public EntityEquipment getEquipment() {
|
||||||
return equipment;
|
return equipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCanPickupItems(boolean pickup) {
|
public void setCanPickupItems(boolean pickup) {
|
||||||
getHandle().canPickUpLoot = pickup;
|
getHandle().canPickUpLoot = pickup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getCanPickupItems() {
|
public boolean getCanPickupItems() {
|
||||||
return getHandle().canPickUpLoot;
|
return getHandle().canPickUpLoot;
|
||||||
}
|
}
|
||||||
@ -444,6 +483,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return super.teleport(location, cause);
|
return super.teleport(location, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLeashed() {
|
public boolean isLeashed() {
|
||||||
if (!(getHandle() instanceof EntityInsentient)) {
|
if (!(getHandle() instanceof EntityInsentient)) {
|
||||||
return false;
|
return false;
|
||||||
@ -451,6 +491,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return ((EntityInsentient) getHandle()).getLeashHolder() != null;
|
return ((EntityInsentient) getHandle()).getLeashHolder() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Entity getLeashHolder() throws IllegalStateException {
|
public Entity getLeashHolder() throws IllegalStateException {
|
||||||
if (!isLeashed()) {
|
if (!isLeashed()) {
|
||||||
throw new IllegalStateException("Entity not leashed");
|
throw new IllegalStateException("Entity not leashed");
|
||||||
@ -466,6 +507,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setLeashHolder(Entity holder) {
|
public boolean setLeashHolder(Entity holder) {
|
||||||
if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
|
if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,6 +11,7 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityMagmaCube getHandle() {
|
public EntityMagmaCube getHandle() {
|
||||||
return (EntityMagmaCube) entity;
|
return (EntityMagmaCube) entity;
|
||||||
}
|
}
|
||||||
@ -20,6 +21,7 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube {
|
|||||||
return "CraftMagmaCube";
|
return "CraftMagmaCube";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MAGMA_CUBE;
|
return EntityType.MAGMA_CUBE;
|
||||||
}
|
}
|
||||||
|
@ -16,44 +16,54 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDamage(double damage) {
|
public void setDamage(double damage) {
|
||||||
getHandle().setDamage((float) damage);
|
getHandle().setDamage((float) damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getDamage() {
|
public double getDamage() {
|
||||||
return getHandle().getDamage();
|
return getHandle().getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getMaxSpeed() {
|
public double getMaxSpeed() {
|
||||||
return getHandle().maxSpeed;
|
return getHandle().maxSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxSpeed(double speed) {
|
public void setMaxSpeed(double speed) {
|
||||||
if (speed >= 0D) {
|
if (speed >= 0D) {
|
||||||
getHandle().maxSpeed = speed;
|
getHandle().maxSpeed = speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSlowWhenEmpty() {
|
public boolean isSlowWhenEmpty() {
|
||||||
return getHandle().slowWhenEmpty;
|
return getHandle().slowWhenEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSlowWhenEmpty(boolean slow) {
|
public void setSlowWhenEmpty(boolean slow) {
|
||||||
getHandle().slowWhenEmpty = slow;
|
getHandle().slowWhenEmpty = slow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getFlyingVelocityMod() {
|
public Vector getFlyingVelocityMod() {
|
||||||
return getHandle().getFlyingVelocityMod();
|
return getHandle().getFlyingVelocityMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFlyingVelocityMod(Vector flying) {
|
public void setFlyingVelocityMod(Vector flying) {
|
||||||
getHandle().setFlyingVelocityMod(flying);
|
getHandle().setFlyingVelocityMod(flying);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getDerailedVelocityMod() {
|
public Vector getDerailedVelocityMod() {
|
||||||
return getHandle().getDerailedVelocityMod();
|
return getHandle().getDerailedVelocityMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDerailedVelocityMod(Vector derailed) {
|
public void setDerailedVelocityMod(Vector derailed) {
|
||||||
getHandle().setDerailedVelocityMod(derailed);
|
getHandle().setDerailedVelocityMod(derailed);
|
||||||
}
|
}
|
||||||
@ -63,6 +73,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
return (EntityMinecartAbstract) entity;
|
return (EntityMinecartAbstract) entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDisplayBlock(MaterialData material) {
|
public void setDisplayBlock(MaterialData material) {
|
||||||
if(material != null) {
|
if(material != null) {
|
||||||
IBlockData block = CraftMagicNumbers.getBlock(material);
|
IBlockData block = CraftMagicNumbers.getBlock(material);
|
||||||
@ -86,6 +97,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MaterialData getDisplayBlock() {
|
public MaterialData getDisplayBlock() {
|
||||||
IBlockData blockData = getHandle().getDisplayBlock();
|
IBlockData blockData = getHandle().getDisplayBlock();
|
||||||
return CraftMagicNumbers.getMaterial(blockData);
|
return CraftMagicNumbers.getMaterial(blockData);
|
||||||
@ -97,10 +109,12 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
return CraftBlockData.fromData(blockData);
|
return CraftBlockData.fromData(blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDisplayBlockOffset(int offset) {
|
public void setDisplayBlockOffset(int offset) {
|
||||||
getHandle().setDisplayBlockOffset(offset);
|
getHandle().setDisplayBlockOffset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getDisplayBlockOffset() {
|
public int getDisplayBlockOffset() {
|
||||||
return getHandle().getDisplayBlockOffset();
|
return getHandle().getDisplayBlockOffset();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ public class CraftMinecartChest extends CraftMinecartContainer implements Storag
|
|||||||
inventory = new CraftInventory(entity);
|
inventory = new CraftInventory(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
@ -25,6 +26,7 @@ public class CraftMinecartChest extends CraftMinecartContainer implements Storag
|
|||||||
return "CraftMinecartChest{" + "inventory=" + inventory + '}';
|
return "CraftMinecartChest{" + "inventory=" + inventory + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART_CHEST;
|
return EntityType.MINECART_CHEST;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca
|
|||||||
return "CraftMinecartFurnace";
|
return "CraftMinecartFurnace";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART_FURNACE;
|
return EntityType.MINECART_FURNACE;
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,12 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
|
|||||||
return "CraftMinecartHopper{" + "inventory=" + inventory + '}';
|
return "CraftMinecartHopper{" + "inventory=" + inventory + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART_HOPPER;
|
return EntityType.MINECART_HOPPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ final class CraftMinecartMobSpawner extends CraftMinecart implements SpawnerMine
|
|||||||
return "CraftMinecartMobSpawner";
|
return "CraftMinecartMobSpawner";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART_MOB_SPAWNER;
|
return EntityType.MINECART_MOB_SPAWNER;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ public class CraftMinecartRideable extends CraftMinecart implements RideableMine
|
|||||||
return "CraftMinecartRideable";
|
return "CraftMinecartRideable";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART;
|
return EntityType.MINECART;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart
|
|||||||
return "CraftMinecartTNT";
|
return "CraftMinecartTNT";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.MINECART_TNT;
|
return EntityType.MINECART_TNT;
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,12 @@ public class CraftOcelot extends CraftAnimals implements Ocelot {
|
|||||||
return (EntityOcelot) entity;
|
return (EntityOcelot) entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getCatType() {
|
public Type getCatType() {
|
||||||
return Type.WILD_OCELOT;
|
return Type.WILD_OCELOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCatType(Type type) {
|
public void setCatType(Type type) {
|
||||||
throw new UnsupportedOperationException("Cats are now a different entity!");
|
throw new UnsupportedOperationException("Cats are now a different entity!");
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,18 @@ public class CraftPainting extends CraftHanging implements Painting {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Art getArt() {
|
public Art getArt() {
|
||||||
Paintings art = getHandle().art;
|
Paintings art = getHandle().art;
|
||||||
return CraftArt.NotchToBukkit(art);
|
return CraftArt.NotchToBukkit(art);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setArt(Art art) {
|
public boolean setArt(Art art) {
|
||||||
return setArt(art, false);
|
return setArt(art, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setArt(Art art, boolean force) {
|
public boolean setArt(Art art, boolean force) {
|
||||||
EntityPainting painting = this.getHandle();
|
EntityPainting painting = this.getHandle();
|
||||||
Paintings oldArt = painting.art;
|
Paintings oldArt = painting.art;
|
||||||
@ -42,6 +45,7 @@ public class CraftPainting extends CraftHanging implements Painting {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||||
if (super.setFacingDirection(face, force)) {
|
if (super.setFacingDirection(face, force)) {
|
||||||
update();
|
update();
|
||||||
@ -73,6 +77,7 @@ public class CraftPainting extends CraftHanging implements Painting {
|
|||||||
return "CraftPainting{art=" + getArt() + "}";
|
return "CraftPainting{art=" + getArt() + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.PAINTING;
|
return EntityType.PAINTING;
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,17 @@ public class CraftPig extends CraftAnimals implements Pig {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasSaddle() {
|
public boolean hasSaddle() {
|
||||||
return getHandle().hasSaddle();
|
return getHandle().hasSaddle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSaddle(boolean saddled) {
|
public void setSaddle(boolean saddled) {
|
||||||
getHandle().setSaddle(saddled);
|
getHandle().setSaddle(saddled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityPig getHandle() {
|
public EntityPig getHandle() {
|
||||||
return (EntityPig) entity;
|
return (EntityPig) entity;
|
||||||
}
|
}
|
||||||
@ -27,6 +30,7 @@ public class CraftPig extends CraftAnimals implements Pig {
|
|||||||
return "CraftPig";
|
return "CraftPig";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.PIG;
|
return EntityType.PIG;
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,22 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAnger() {
|
public int getAnger() {
|
||||||
return getHandle().angerLevel;
|
return getHandle().angerLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAnger(int level) {
|
public void setAnger(int level) {
|
||||||
getHandle().angerLevel = level;
|
getHandle().angerLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAngry(boolean angry) {
|
public void setAngry(boolean angry) {
|
||||||
setAnger(angry ? 400 : 0);
|
setAnger(angry ? 400 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAngry() {
|
public boolean isAngry() {
|
||||||
return getAnger() > 0;
|
return getAnger() > 0;
|
||||||
}
|
}
|
||||||
@ -37,6 +41,7 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
|
|||||||
return "CraftPigZombie";
|
return "CraftPigZombie";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.PIG_ZOMBIE;
|
return EntityType.PIG_ZOMBIE;
|
||||||
}
|
}
|
||||||
|
@ -157,10 +157,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
perm.recalculatePermissions();
|
perm.recalculatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOnline() {
|
public boolean isOnline() {
|
||||||
return server.getPlayer(getUniqueId()) != null;
|
return server.getPlayer(getUniqueId()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InetSocketAddress getAddress() {
|
public InetSocketAddress getAddress() {
|
||||||
if (getHandle().playerConnection == null) return null;
|
if (getHandle().playerConnection == null) return null;
|
||||||
|
|
||||||
|
@ -11,10 +11,12 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProjectileSource getShooter() {
|
public ProjectileSource getShooter() {
|
||||||
return getHandle().projectileSource;
|
return getHandle().projectileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShooter(ProjectileSource shooter) {
|
public void setShooter(ProjectileSource shooter) {
|
||||||
if (shooter instanceof CraftLivingEntity) {
|
if (shooter instanceof CraftLivingEntity) {
|
||||||
getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||||
|
@ -12,18 +12,22 @@ public class CraftSheep extends CraftAnimals implements Sheep {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DyeColor getColor() {
|
public DyeColor getColor() {
|
||||||
return DyeColor.getByWoolData((byte) getHandle().getColor().getColorIndex());
|
return DyeColor.getByWoolData((byte) getHandle().getColor().getColorIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setColor(DyeColor color) {
|
public void setColor(DyeColor color) {
|
||||||
getHandle().setColor(EnumColor.fromColorIndex(color.getWoolData()));
|
getHandle().setColor(EnumColor.fromColorIndex(color.getWoolData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSheared() {
|
public boolean isSheared() {
|
||||||
return getHandle().isSheared();
|
return getHandle().isSheared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSheared(boolean flag) {
|
public void setSheared(boolean flag) {
|
||||||
getHandle().setSheared(flag);
|
getHandle().setSheared(flag);
|
||||||
}
|
}
|
||||||
@ -38,6 +42,7 @@ public class CraftSheep extends CraftAnimals implements Sheep {
|
|||||||
return "CraftSheep";
|
return "CraftSheep";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SHEEP;
|
return EntityType.SHEEP;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftSilverfish extends CraftMonster implements Silverfish {
|
|||||||
return "CraftSilverfish";
|
return "CraftSilverfish";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SILVERFISH;
|
return EntityType.SILVERFISH;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftSkeleton extends CraftMonster implements Skeleton {
|
|||||||
return "CraftSkeleton";
|
return "CraftSkeleton";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SKELETON;
|
return EntityType.SKELETON;
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,12 @@ public class CraftSlime extends CraftMob implements Slime {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return getHandle().getSize();
|
return getHandle().getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSize(int size) {
|
public void setSize(int size) {
|
||||||
getHandle().setSize(size, true);
|
getHandle().setSize(size, true);
|
||||||
}
|
}
|
||||||
@ -29,6 +31,7 @@ public class CraftSlime extends CraftMob implements Slime {
|
|||||||
return "CraftSlime";
|
return "CraftSlime";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SLIME;
|
return EntityType.SLIME;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftSmallFireball extends CraftFireball implements SmallFireball {
|
|||||||
return "CraftSmallFireball";
|
return "CraftSmallFireball";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SMALL_FIREBALL;
|
return EntityType.SMALL_FIREBALL;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftSnowball extends CraftProjectile implements Snowball {
|
|||||||
return "CraftSnowball";
|
return "CraftSnowball";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SNOWBALL;
|
return EntityType.SNOWBALL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ public class CraftSnowman extends CraftGolem implements Snowman {
|
|||||||
return "CraftSnowman";
|
return "CraftSnowman";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SNOWMAN;
|
return EntityType.SNOWMAN;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftSpider extends CraftMonster implements Spider {
|
|||||||
return "CraftSpider";
|
return "CraftSpider";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SPIDER;
|
return EntityType.SPIDER;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class CraftSquid extends CraftWaterMob implements Squid {
|
|||||||
return "CraftSquid";
|
return "CraftSquid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.SQUID;
|
return EntityType.SQUID;
|
||||||
}
|
}
|
||||||
|
@ -13,26 +13,32 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getYield() {
|
public float getYield() {
|
||||||
return getHandle().yield;
|
return getHandle().yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIncendiary() {
|
public boolean isIncendiary() {
|
||||||
return getHandle().isIncendiary;
|
return getHandle().isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIsIncendiary(boolean isIncendiary) {
|
public void setIsIncendiary(boolean isIncendiary) {
|
||||||
getHandle().isIncendiary = isIncendiary;
|
getHandle().isIncendiary = isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setYield(float yield) {
|
public void setYield(float yield) {
|
||||||
getHandle().yield = yield;
|
getHandle().yield = yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getFuseTicks() {
|
public int getFuseTicks() {
|
||||||
return getHandle().getFuseTicks();
|
return getHandle().getFuseTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFuseTicks(int fuseTicks) {
|
public void setFuseTicks(int fuseTicks) {
|
||||||
getHandle().setFuseTicks(fuseTicks);
|
getHandle().setFuseTicks(fuseTicks);
|
||||||
}
|
}
|
||||||
@ -47,10 +53,12 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
|||||||
return "CraftTNTPrimed";
|
return "CraftTNTPrimed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.PRIMED_TNT;
|
return EntityType.PRIMED_TNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Entity getSource() {
|
public Entity getSource() {
|
||||||
EntityLiving source = getHandle().getSource();
|
EntityLiving source = getHandle().getSource();
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
|
|||||||
getHandle().setOwnerUUID(uuid);
|
getHandle().setOwnerUUID(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public AnimalTamer getOwner() {
|
public AnimalTamer getOwner() {
|
||||||
if (getOwnerUUID() == null) {
|
if (getOwnerUUID() == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -42,10 +43,12 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
|
|||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isTamed() {
|
public boolean isTamed() {
|
||||||
return getHandle().isTamed();
|
return getHandle().isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setOwner(AnimalTamer tamer) {
|
public void setOwner(AnimalTamer tamer) {
|
||||||
if (tamer != null) {
|
if (tamer != null) {
|
||||||
setTamed(true);
|
setTamed(true);
|
||||||
@ -57,6 +60,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTamed(boolean tame) {
|
public void setTamed(boolean tame) {
|
||||||
getHandle().setTamed(tame);
|
getHandle().setTamed(tame);
|
||||||
if (!tame) {
|
if (!tame) {
|
||||||
|
@ -20,6 +20,7 @@ public class CraftThrownExpBottle extends CraftProjectile implements ThrownExpBo
|
|||||||
return "EntityThrownExpBottle";
|
return "EntityThrownExpBottle";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.THROWN_EXP_BOTTLE;
|
return EntityType.THROWN_EXP_BOTTLE;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<PotionEffect> getEffects() {
|
public Collection<PotionEffect> getEffects() {
|
||||||
ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
|
ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
|
||||||
for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) {
|
for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) {
|
||||||
@ -28,6 +29,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
|
|||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,17 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
|||||||
return "CraftVillager";
|
return "CraftVillager";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.VILLAGER;
|
return EntityType.VILLAGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Profession getProfession() {
|
public Profession getProfession() {
|
||||||
return Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(getHandle().getVillagerData().getProfession()).getKey().toUpperCase(Locale.ROOT));
|
return Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(getHandle().getVillagerData().getProfession()).getKey().toUpperCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setProfession(Profession profession) {
|
public void setProfession(Profession profession) {
|
||||||
Validate.notNull(profession);
|
Validate.notNull(profession);
|
||||||
getHandle().setVillagerData(getHandle().getVillagerData().withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
|
getHandle().setVillagerData(getHandle().getVillagerData().withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
|
||||||
|
@ -20,6 +20,7 @@ public class CraftWitch extends CraftRaider implements Witch {
|
|||||||
return "CraftWitch";
|
return "CraftWitch";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.WITCH;
|
return EntityType.WITCH;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ public class CraftWither extends CraftMonster implements Wither {
|
|||||||
return "CraftWither";
|
return "CraftWither";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.WITHER;
|
return EntityType.WITHER;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ public class CraftWitherSkull extends CraftFireball implements WitherSkull {
|
|||||||
return "CraftWitherSkull";
|
return "CraftWitherSkull";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.WITHER_SKULL;
|
return EntityType.WITHER_SKULL;
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,12 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
|
|||||||
super(server, wolf);
|
super(server, wolf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAngry() {
|
public boolean isAngry() {
|
||||||
return getHandle().isAngry();
|
return getHandle().isAngry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAngry(boolean angry) {
|
public void setAngry(boolean angry) {
|
||||||
getHandle().setAngry(angry);
|
getHandle().setAngry(angry);
|
||||||
}
|
}
|
||||||
@ -30,10 +32,12 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
|
|||||||
return EntityType.WOLF;
|
return EntityType.WOLF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DyeColor getCollarColor() {
|
public DyeColor getCollarColor() {
|
||||||
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getColorIndex());
|
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getColorIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCollarColor(DyeColor color) {
|
public void setCollarColor(DyeColor color) {
|
||||||
getHandle().setCollarColor(EnumColor.fromColorIndex(color.getWoolData()));
|
getHandle().setCollarColor(EnumColor.fromColorIndex(color.getWoolData()));
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,22 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
|||||||
return "CraftZombie";
|
return "CraftZombie";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.ZOMBIE;
|
return EntityType.ZOMBIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBaby() {
|
public boolean isBaby() {
|
||||||
return getHandle().isBaby();
|
return getHandle().isBaby();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBaby(boolean flag) {
|
public void setBaby(boolean flag) {
|
||||||
getHandle().setBaby(flag);
|
getHandle().setBaby(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isVillager() {
|
public boolean isVillager() {
|
||||||
return getHandle() instanceof EntityZombieVillager;
|
return getHandle() instanceof EntityZombieVillager;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ public class CustomHelpTopic extends HelpTopic {
|
|||||||
this.fullText = shortText + "\n" + fullText;
|
this.fullText = shortText + "\n" + fullText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canSee(CommandSender sender) {
|
public boolean canSee(CommandSender sender) {
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -34,6 +34,7 @@ public class MultipleCommandAliasHelpTopic extends HelpTopic {
|
|||||||
fullText = ChatColor.GOLD + "Alias for: " + ChatColor.WHITE + getShortText();
|
fullText = ChatColor.GOLD + "Alias for: " + ChatColor.WHITE + getShortText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canSee(CommandSender sender) {
|
public boolean canSee(CommandSender sender) {
|
||||||
if (amendedPermission == null) {
|
if (amendedPermission == null) {
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.help.HelpTopicFactory;
|
|||||||
*/
|
*/
|
||||||
public class MultipleCommandAliasHelpTopicFactory implements HelpTopicFactory<MultipleCommandAlias> {
|
public class MultipleCommandAliasHelpTopicFactory implements HelpTopicFactory<MultipleCommandAlias> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public HelpTopic createTopic(MultipleCommandAlias multipleCommandAlias) {
|
public HelpTopic createTopic(MultipleCommandAlias multipleCommandAlias) {
|
||||||
return new MultipleCommandAliasHelpTopic(multipleCommandAlias);
|
return new MultipleCommandAliasHelpTopic(multipleCommandAlias);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory());
|
registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized HelpTopic getHelpTopic(String topicName) {
|
public synchronized HelpTopic getHelpTopic(String topicName) {
|
||||||
if (topicName.equals("")) {
|
if (topicName.equals("")) {
|
||||||
return defaultTopic;
|
return defaultTopic;
|
||||||
@ -66,10 +67,12 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<HelpTopic> getHelpTopics() {
|
public Collection<HelpTopic> getHelpTopics() {
|
||||||
return helpTopics.values();
|
return helpTopics.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized void addTopic(HelpTopic topic) {
|
public synchronized void addTopic(HelpTopic topic) {
|
||||||
// Existing topics take priority
|
// Existing topics take priority
|
||||||
if (!helpTopics.containsKey(topic.getName())) {
|
if (!helpTopics.containsKey(topic.getName())) {
|
||||||
@ -77,10 +80,12 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized void clear() {
|
public synchronized void clear() {
|
||||||
helpTopics.clear();
|
helpTopics.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> getIgnoredPlugins() {
|
public List<String> getIgnoredPlugins() {
|
||||||
return yaml.getIgnoredPlugins();
|
return yaml.getIgnoredPlugins();
|
||||||
}
|
}
|
||||||
@ -216,6 +221,7 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerHelpTopicFactory(Class commandClass, HelpTopicFactory factory) {
|
public void registerHelpTopicFactory(Class commandClass, HelpTopicFactory factory) {
|
||||||
if (!Command.class.isAssignableFrom(commandClass) && !CommandExecutor.class.isAssignableFrom(commandClass)) {
|
if (!Command.class.isAssignableFrom(commandClass) && !CommandExecutor.class.isAssignableFrom(commandClass)) {
|
||||||
throw new IllegalArgumentException("commandClass must implement either Command or CommandExecutor!");
|
throw new IllegalArgumentException("commandClass must implement either Command or CommandExecutor!");
|
||||||
@ -225,6 +231,7 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
|
|
||||||
private class IsCommandTopicPredicate implements Predicate<HelpTopic> {
|
private class IsCommandTopicPredicate implements Predicate<HelpTopic> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean apply(HelpTopic topic) {
|
public boolean apply(HelpTopic topic) {
|
||||||
return topic.getName().charAt(0) == '/';
|
return topic.getName().charAt(0) == '/';
|
||||||
}
|
}
|
||||||
|
@ -45,38 +45,47 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
setItemInMainHand(stack);
|
setItemInMainHand(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getHelmet() {
|
public ItemStack getHelmet() {
|
||||||
return getEquipment(EnumItemSlot.HEAD);
|
return getEquipment(EnumItemSlot.HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHelmet(ItemStack helmet) {
|
public void setHelmet(ItemStack helmet) {
|
||||||
setEquipment(EnumItemSlot.HEAD, helmet);
|
setEquipment(EnumItemSlot.HEAD, helmet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getChestplate() {
|
public ItemStack getChestplate() {
|
||||||
return getEquipment(EnumItemSlot.CHEST);
|
return getEquipment(EnumItemSlot.CHEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setChestplate(ItemStack chestplate) {
|
public void setChestplate(ItemStack chestplate) {
|
||||||
setEquipment(EnumItemSlot.CHEST, chestplate);
|
setEquipment(EnumItemSlot.CHEST, chestplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getLeggings() {
|
public ItemStack getLeggings() {
|
||||||
return getEquipment(EnumItemSlot.LEGS);
|
return getEquipment(EnumItemSlot.LEGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLeggings(ItemStack leggings) {
|
public void setLeggings(ItemStack leggings) {
|
||||||
setEquipment(EnumItemSlot.LEGS, leggings);
|
setEquipment(EnumItemSlot.LEGS, leggings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getBoots() {
|
public ItemStack getBoots() {
|
||||||
return getEquipment(EnumItemSlot.FEET);
|
return getEquipment(EnumItemSlot.FEET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBoots(ItemStack boots) {
|
public void setBoots(ItemStack boots) {
|
||||||
setEquipment(EnumItemSlot.FEET, boots);
|
setEquipment(EnumItemSlot.FEET, boots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack[] getArmorContents() {
|
public ItemStack[] getArmorContents() {
|
||||||
ItemStack[] armor = new ItemStack[]{
|
ItemStack[] armor = new ItemStack[]{
|
||||||
getEquipment(EnumItemSlot.FEET),
|
getEquipment(EnumItemSlot.FEET),
|
||||||
@ -87,6 +96,7 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
return armor;
|
return armor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setArmorContents(ItemStack[] items) {
|
public void setArmorContents(ItemStack[] items) {
|
||||||
setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null);
|
setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null);
|
||||||
setEquipment(EnumItemSlot.LEGS, items.length >= 2 ? items[1] : 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));
|
entity.getHandle().setSlot(slot, CraftItemStack.asNMSCopy(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||||
setEquipment(slot, null);
|
setEquipment(slot, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Entity getHolder() {
|
public Entity getHolder() {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@ -142,34 +154,42 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
setDropChance(EnumItemSlot.OFFHAND, chance);
|
setDropChance(EnumItemSlot.OFFHAND, chance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getHelmetDropChance() {
|
public float getHelmetDropChance() {
|
||||||
return getDropChance(EnumItemSlot.HEAD);
|
return getDropChance(EnumItemSlot.HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHelmetDropChance(float chance) {
|
public void setHelmetDropChance(float chance) {
|
||||||
setDropChance(EnumItemSlot.HEAD, chance);
|
setDropChance(EnumItemSlot.HEAD, chance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getChestplateDropChance() {
|
public float getChestplateDropChance() {
|
||||||
return getDropChance(EnumItemSlot.CHEST);
|
return getDropChance(EnumItemSlot.CHEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setChestplateDropChance(float chance) {
|
public void setChestplateDropChance(float chance) {
|
||||||
setDropChance(EnumItemSlot.CHEST, chance);
|
setDropChance(EnumItemSlot.CHEST, chance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getLeggingsDropChance() {
|
public float getLeggingsDropChance() {
|
||||||
return getDropChance(EnumItemSlot.LEGS);
|
return getDropChance(EnumItemSlot.LEGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLeggingsDropChance(float chance) {
|
public void setLeggingsDropChance(float chance) {
|
||||||
setDropChance(EnumItemSlot.LEGS, chance);
|
setDropChance(EnumItemSlot.LEGS, chance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getBootsDropChance() {
|
public float getBootsDropChance() {
|
||||||
return getDropChance(EnumItemSlot.FEET);
|
return getDropChance(EnumItemSlot.FEET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBootsDropChance(float chance) {
|
public void setBootsDropChance(float chance) {
|
||||||
setDropChance(EnumItemSlot.FEET, chance);
|
setDropChance(EnumItemSlot.FEET, chance);
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,12 @@ public class CraftInventory implements Inventory {
|
|||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return getInventory().getSize();
|
return getInventory().getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItem(int index) {
|
public ItemStack getItem(int index) {
|
||||||
net.minecraft.server.ItemStack item = getInventory().getItem(index);
|
net.minecraft.server.ItemStack item = getInventory().getItem(index);
|
||||||
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
|
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
|
||||||
@ -71,12 +73,14 @@ public class CraftInventory implements Inventory {
|
|||||||
setContents(items);
|
setContents(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
List<net.minecraft.server.ItemStack> mcItems = getInventory().getContents();
|
List<net.minecraft.server.ItemStack> mcItems = getInventory().getContents();
|
||||||
|
|
||||||
return asCraftMirror(mcItems);
|
return asCraftMirror(mcItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setContents(ItemStack[] items) {
|
public void setContents(ItemStack[] items) {
|
||||||
if (getSize() < items.length) {
|
if (getSize() < items.length) {
|
||||||
throw new IllegalArgumentException("Invalid inventory size; expected " + getSize() + " or less");
|
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) {
|
public void setItem(int index, ItemStack item) {
|
||||||
getInventory().setItem(index, CraftItemStack.asNMSCopy(item));
|
getInventory().setItem(index, CraftItemStack.asNMSCopy(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Material material) {
|
public boolean contains(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
material = CraftLegacy.fromLegacy(material);
|
material = CraftLegacy.fromLegacy(material);
|
||||||
@ -106,6 +112,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(ItemStack item) {
|
public boolean contains(ItemStack item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -118,6 +125,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Material material, int amount) {
|
public boolean contains(Material material, int amount) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
material = CraftLegacy.fromLegacy(material);
|
material = CraftLegacy.fromLegacy(material);
|
||||||
@ -134,6 +142,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(ItemStack item, int amount) {
|
public boolean contains(ItemStack item, int amount) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -149,6 +158,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean containsAtLeast(ItemStack item, int amount) {
|
public boolean containsAtLeast(ItemStack item, int amount) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -164,6 +174,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HashMap<Integer, ItemStack> all(Material material) {
|
public HashMap<Integer, ItemStack> all(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
material = CraftLegacy.fromLegacy(material);
|
material = CraftLegacy.fromLegacy(material);
|
||||||
@ -179,6 +190,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HashMap<Integer, ItemStack> all(ItemStack item) {
|
public HashMap<Integer, ItemStack> all(ItemStack item) {
|
||||||
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@ -192,6 +204,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int first(Material material) {
|
public int first(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
material = CraftLegacy.fromLegacy(material);
|
material = CraftLegacy.fromLegacy(material);
|
||||||
@ -205,6 +218,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int first(ItemStack item) {
|
public int first(ItemStack item) {
|
||||||
return first(item, true);
|
return first(item, true);
|
||||||
}
|
}
|
||||||
@ -224,6 +238,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int firstEmpty() {
|
public int firstEmpty() {
|
||||||
ItemStack[] inventory = getStorageContents();
|
ItemStack[] inventory = getStorageContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
@ -262,6 +277,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
||||||
Validate.noNullElements(items, "Item cannot be null");
|
Validate.noNullElements(items, "Item cannot be null");
|
||||||
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||||
@ -327,6 +343,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return leftover;
|
return leftover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HashMap<Integer, ItemStack> removeItem(ItemStack... items) {
|
public HashMap<Integer, ItemStack> removeItem(ItemStack... items) {
|
||||||
Validate.notNull(items, "Items cannot be null");
|
Validate.notNull(items, "Items cannot be null");
|
||||||
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||||
@ -374,6 +391,7 @@ public class CraftInventory implements Inventory {
|
|||||||
return getInventory().getMaxStackSize();
|
return getInventory().getMaxStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void remove(Material material) {
|
public void remove(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
material = CraftLegacy.fromLegacy(material);
|
material = CraftLegacy.fromLegacy(material);
|
||||||
@ -385,6 +403,7 @@ public class CraftInventory implements Inventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void remove(ItemStack item) {
|
public void remove(ItemStack item) {
|
||||||
ItemStack[] items = getStorageContents();
|
ItemStack[] items = getStorageContents();
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
@ -394,20 +413,24 @@ public class CraftInventory implements Inventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear(int index) {
|
public void clear(int index) {
|
||||||
setItem(index, null);
|
setItem(index, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
for (int i = 0; i < getSize(); i++) {
|
for (int i = 0; i < getSize(); i++) {
|
||||||
clear(i);
|
clear(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ListIterator<ItemStack> iterator() {
|
public ListIterator<ItemStack> iterator() {
|
||||||
return new InventoryIterator(this);
|
return new InventoryIterator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ListIterator<ItemStack> iterator(int index) {
|
public ListIterator<ItemStack> iterator(int index) {
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += getSize() + 1; // ie, with -1, previous() will return the last element
|
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);
|
return new InventoryIterator(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<HumanEntity> getViewers() {
|
public List<HumanEntity> getViewers() {
|
||||||
return this.inventory.getViewers();
|
return this.inventory.getViewers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryType getType() {
|
public InventoryType getType() {
|
||||||
// Thanks to Droppers extending Dispensers, Blast Furnaces & Smokers extending Furnace, order is important.
|
// Thanks to Droppers extending Dispensers, Blast Furnaces & Smokers extending Furnace, order is important.
|
||||||
if (inventory instanceof InventoryCrafting) {
|
if (inventory instanceof InventoryCrafting) {
|
||||||
@ -470,14 +495,17 @@ public class CraftInventory implements Inventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryHolder getHolder() {
|
public InventoryHolder getHolder() {
|
||||||
return inventory.getOwner();
|
return inventory.getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxStackSize() {
|
public int getMaxStackSize() {
|
||||||
return inventory.getMaxStackSize();
|
return inventory.getMaxStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxStackSize(int size) {
|
public void setMaxStackSize(int size) {
|
||||||
inventory.setMaxStackSize(size);
|
inventory.setMaxStackSize(size);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,12 @@ public class CraftInventoryBeacon extends CraftInventory implements BeaconInvent
|
|||||||
super(beacon);
|
super(beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItem(ItemStack item) {
|
public void setItem(ItemStack item) {
|
||||||
setItem(0, item);
|
setItem(0, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return getItem(0);
|
return getItem(0);
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ public class CraftInventoryBrewer extends CraftInventory implements BrewerInvent
|
|||||||
super(inventory);
|
super(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getIngredient() {
|
public ItemStack getIngredient() {
|
||||||
return getItem(3);
|
return getItem(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIngredient(ItemStack ingredient) {
|
public void setIngredient(ItemStack ingredient) {
|
||||||
setItem(3, ingredient);
|
setItem(3, ingredient);
|
||||||
}
|
}
|
||||||
|
@ -81,18 +81,21 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack[] getMatrix() {
|
public ItemStack[] getMatrix() {
|
||||||
List<net.minecraft.server.ItemStack> matrix = getMatrixInventory().getContents();
|
List<net.minecraft.server.ItemStack> matrix = getMatrixInventory().getContents();
|
||||||
|
|
||||||
return asCraftMirror(matrix);
|
return asCraftMirror(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getResult() {
|
public ItemStack getResult() {
|
||||||
net.minecraft.server.ItemStack item = getResultInventory().getItem(0);
|
net.minecraft.server.ItemStack item = getResultInventory().getItem(0);
|
||||||
if (!item.isEmpty()) return CraftItemStack.asCraftMirror(item);
|
if (!item.isEmpty()) return CraftItemStack.asCraftMirror(item);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMatrix(ItemStack[] contents) {
|
public void setMatrix(ItemStack[] contents) {
|
||||||
if (getMatrixInventory().getSize() > contents.length) {
|
if (getMatrixInventory().getSize() > contents.length) {
|
||||||
throw new IllegalArgumentException("Invalid inventory size; expected " + getMatrixInventory().getSize() + " or less");
|
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) {
|
public void setResult(ItemStack item) {
|
||||||
List<net.minecraft.server.ItemStack> contents = getResultInventory().getContents();
|
List<net.minecraft.server.ItemStack> contents = getResultInventory().getContents();
|
||||||
contents.set(0, CraftItemStack.asNMSCopy(item));
|
contents.set(0, CraftItemStack.asNMSCopy(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Recipe getRecipe() {
|
public Recipe getRecipe() {
|
||||||
IRecipe recipe = getInventory().getCurrentRecipe();
|
IRecipe recipe = getInventory().getCurrentRecipe();
|
||||||
return recipe == null ? null : recipe.toBukkitRecipe();
|
return recipe == null ? null : recipe.toBukkitRecipe();
|
||||||
|
@ -62,14 +62,17 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
this.type = InventoryType.CHEST;
|
this.type = InventoryType.CHEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getItem(int i) {
|
public ItemStack getItem(int i) {
|
||||||
return items.get(i);
|
return items.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack splitStack(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
ItemStack stack = this.getItem(i);
|
ItemStack stack = this.getItem(i);
|
||||||
ItemStack result;
|
ItemStack result;
|
||||||
@ -85,6 +88,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack splitWithoutUpdate(int i) {
|
public ItemStack splitWithoutUpdate(int i) {
|
||||||
ItemStack stack = this.getItem(i);
|
ItemStack stack = this.getItem(i);
|
||||||
ItemStack result;
|
ItemStack result;
|
||||||
@ -99,6 +103,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItem(int i, ItemStack itemstack) {
|
public void setItem(int i, ItemStack itemstack) {
|
||||||
items.set(i, itemstack);
|
items.set(i, itemstack);
|
||||||
if (itemstack != ItemStack.a && this.getMaxStackSize() > 0 && itemstack.getCount() > this.getMaxStackSize()) {
|
if (itemstack != ItemStack.a && this.getMaxStackSize() > 0 && itemstack.getCount() > this.getMaxStackSize()) {
|
||||||
@ -106,32 +111,40 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxStackSize() {
|
public int getMaxStackSize() {
|
||||||
return maxStack;
|
return maxStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMaxStackSize(int size) {
|
public void setMaxStackSize(int size) {
|
||||||
maxStack = size;
|
maxStack = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update() {}
|
public void update() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean a(EntityHuman entityhuman) {
|
public boolean a(EntityHuman entityhuman) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onOpen(CraftHumanEntity who) {
|
public void onOpen(CraftHumanEntity who) {
|
||||||
viewers.add(who);
|
viewers.add(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onClose(CraftHumanEntity who) {
|
public void onClose(CraftHumanEntity who) {
|
||||||
viewers.remove(who);
|
viewers.remove(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<HumanEntity> getViewers() {
|
public List<HumanEntity> getViewers() {
|
||||||
return viewers;
|
return viewers;
|
||||||
}
|
}
|
||||||
@ -140,10 +153,12 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InventoryHolder getOwner() {
|
public InventoryHolder getOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean b(int i, ItemStack itemstack) {
|
public boolean b(int i, ItemStack itemstack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,12 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Inventory getLeftSide() {
|
public Inventory getLeftSide() {
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Inventory getRightSide() {
|
public Inventory getRightSide() {
|
||||||
return right;
|
return right;
|
||||||
}
|
}
|
||||||
|
@ -10,26 +10,32 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
|
|||||||
super(inventory);
|
super(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getResult() {
|
public ItemStack getResult() {
|
||||||
return getItem(2);
|
return getItem(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getFuel() {
|
public ItemStack getFuel() {
|
||||||
return getItem(1);
|
return getItem(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getSmelting() {
|
public ItemStack getSmelting() {
|
||||||
return getItem(0);
|
return getItem(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFuel(ItemStack stack) {
|
public void setFuel(ItemStack stack) {
|
||||||
setItem(1,stack);
|
setItem(1,stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setResult(ItemStack stack) {
|
public void setResult(ItemStack stack) {
|
||||||
setItem(2,stack);
|
setItem(2,stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSmelting(ItemStack stack) {
|
public void setSmelting(ItemStack stack) {
|
||||||
setItem(0,stack);
|
setItem(0,stack);
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements
|
|||||||
super(inventory);
|
super(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getArmor() {
|
public ItemStack getArmor() {
|
||||||
return getItem(1);
|
return getItem(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setArmor(ItemStack stack) {
|
public void setArmor(ItemStack stack) {
|
||||||
setItem(1, stack);
|
setItem(1, stack);
|
||||||
}
|
}
|
||||||
|
@ -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)));
|
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.defaultContainer.windowId, index, CraftItemStack.asNMSCopy(item)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getHeldItemSlot() {
|
public int getHeldItemSlot() {
|
||||||
return getInventory().itemInHandIndex;
|
return getInventory().itemInHandIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHeldItemSlot(int slot) {
|
public void setHeldItemSlot(int slot) {
|
||||||
Validate.isTrue(slot >= 0 && slot < PlayerInventory.getHotbarSize(), "Slot is not between 0 and 8 inclusive");
|
Validate.isTrue(slot >= 0 && slot < PlayerInventory.getHotbarSize(), "Slot is not between 0 and 8 inclusive");
|
||||||
this.getInventory().itemInHandIndex = slot;
|
this.getInventory().itemInHandIndex = slot;
|
||||||
((CraftPlayer) this.getHolder()).getHandle().playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(slot));
|
((CraftPlayer) this.getHolder()).getHandle().playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getHelmet() {
|
public ItemStack getHelmet() {
|
||||||
return getItem(getSize() - 2);
|
return getItem(getSize() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getChestplate() {
|
public ItemStack getChestplate() {
|
||||||
return getItem(getSize() - 3);
|
return getItem(getSize() - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getLeggings() {
|
public ItemStack getLeggings() {
|
||||||
return getItem(getSize() - 4);
|
return getItem(getSize() - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getBoots() {
|
public ItemStack getBoots() {
|
||||||
return getItem(getSize() - 5);
|
return getItem(getSize() - 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHelmet(ItemStack helmet) {
|
public void setHelmet(ItemStack helmet) {
|
||||||
setItem(getSize() - 2, helmet);
|
setItem(getSize() - 2, helmet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setChestplate(ItemStack chestplate) {
|
public void setChestplate(ItemStack chestplate) {
|
||||||
setItem(getSize() - 3, chestplate);
|
setItem(getSize() - 3, chestplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLeggings(ItemStack leggings) {
|
public void setLeggings(ItemStack leggings) {
|
||||||
setItem(getSize() - 4, leggings);
|
setItem(getSize() - 4, leggings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBoots(ItemStack boots) {
|
public void setBoots(ItemStack boots) {
|
||||||
setItem(getSize() - 5, boots);
|
setItem(getSize() - 5, boots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack[] getArmorContents() {
|
public ItemStack[] getArmorContents() {
|
||||||
return asCraftMirror(getInventory().armor);
|
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");
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getHelmetDropChance() {
|
public float getHelmetDropChance() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setHelmetDropChance(float chance) {
|
public void setHelmetDropChance(float chance) {
|
||||||
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getChestplateDropChance() {
|
public float getChestplateDropChance() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setChestplateDropChance(float chance) {
|
public void setChestplateDropChance(float chance) {
|
||||||
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getLeggingsDropChance() {
|
public float getLeggingsDropChance() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLeggingsDropChance(float chance) {
|
public void setLeggingsDropChance(float chance) {
|
||||||
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public float getBootsDropChance() {
|
public float getBootsDropChance() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBootsDropChance(float chance) {
|
public void setBootsDropChance(float chance) {
|
||||||
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
private CraftItemFactory() {
|
private CraftItemFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isApplicable(ItemMeta meta, ItemStack itemstack) {
|
public boolean isApplicable(ItemMeta meta, ItemStack itemstack) {
|
||||||
if (itemstack == null) {
|
if (itemstack == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -46,6 +47,7 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
return isApplicable(meta, itemstack.getType());
|
return isApplicable(meta, itemstack.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isApplicable(ItemMeta meta, Material type) {
|
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
|
type = CraftLegacy.fromLegacy(type); // This may be called from legacy item stacks, try to get the right material
|
||||||
if (type == null || meta == null) {
|
if (type == null || meta == null) {
|
||||||
@ -58,6 +60,7 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
return ((CraftMetaItem) meta).applicableTo(type);
|
return ((CraftMetaItem) meta).applicableTo(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemMeta getItemMeta(Material material) {
|
public ItemMeta getItemMeta(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
return getItemMeta(material, null);
|
return getItemMeta(material, null);
|
||||||
@ -254,6 +257,7 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(ItemMeta meta1, ItemMeta meta2) {
|
public boolean equals(ItemMeta meta1, ItemMeta meta2) {
|
||||||
if (meta1 == meta2) {
|
if (meta1 == meta2) {
|
||||||
return true;
|
return true;
|
||||||
@ -291,11 +295,13 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemMeta asMetaFor(ItemMeta meta, ItemStack stack) {
|
public ItemMeta asMetaFor(ItemMeta meta, ItemStack stack) {
|
||||||
Validate.notNull(stack, "Stack cannot be null");
|
Validate.notNull(stack, "Stack cannot be null");
|
||||||
return asMetaFor(meta, stack.getType());
|
return asMetaFor(meta, stack.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemMeta asMetaFor(ItemMeta meta, Material material) {
|
public ItemMeta asMetaFor(ItemMeta meta, Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
if (!(meta instanceof CraftMetaItem)) {
|
if (!(meta instanceof CraftMetaItem)) {
|
||||||
@ -304,6 +310,7 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
return getItemMeta(material, (CraftMetaItem) meta);
|
return getItemMeta(material, (CraftMetaItem) meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Color getDefaultLeatherColor() {
|
public Color getDefaultLeatherColor() {
|
||||||
return DEFAULT_LEATHER_COLOR;
|
return DEFAULT_LEATHER_COLOR;
|
||||||
}
|
}
|
||||||
|
@ -161,26 +161,32 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasAuthor() {
|
public boolean hasAuthor() {
|
||||||
return !Strings.isNullOrEmpty(author);
|
return !Strings.isNullOrEmpty(author);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasTitle() {
|
public boolean hasTitle() {
|
||||||
return !Strings.isNullOrEmpty(title);
|
return !Strings.isNullOrEmpty(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPages() {
|
public boolean hasPages() {
|
||||||
return !pages.isEmpty();
|
return !pages.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasGeneration() {
|
public boolean hasGeneration() {
|
||||||
return generation != null;
|
return generation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return this.title;
|
return this.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean setTitle(final String title) {
|
public boolean setTitle(final String title) {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
this.title = null;
|
this.title = null;
|
||||||
@ -193,10 +199,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAuthor() {
|
public String getAuthor() {
|
||||||
return this.author;
|
return this.author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAuthor(final String author) {
|
public void setAuthor(final String author) {
|
||||||
this.author = author;
|
this.author = author;
|
||||||
}
|
}
|
||||||
@ -211,11 +219,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|||||||
this.generation = (generation == null) ? null : generation.ordinal();
|
this.generation = (generation == null) ? null : generation.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getPage(final int page) {
|
public String getPage(final int page) {
|
||||||
Validate.isTrue(isValidPage(page), "Invalid page number");
|
Validate.isTrue(isValidPage(page), "Invalid page number");
|
||||||
return CraftChatMessage.fromComponent(pages.get(page - 1));
|
return CraftChatMessage.fromComponent(pages.get(page - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPage(final int page, final String text) {
|
public void setPage(final int page, final String text) {
|
||||||
if (!isValidPage(page)) {
|
if (!isValidPage(page)) {
|
||||||
throw new IllegalArgumentException("Invalid page number " + page + "/" + pages.size());
|
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]);
|
pages.set(page - 1, CraftChatMessage.fromString(newText, true)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPages(final String... pages) {
|
public void setPages(final String... pages) {
|
||||||
this.pages.clear();
|
this.pages.clear();
|
||||||
|
|
||||||
addPage(pages);
|
addPage(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addPage(final String... pages) {
|
public void addPage(final String... pages) {
|
||||||
for (String page : pages) {
|
for (String page : pages) {
|
||||||
if (this.pages.size() >= MAX_PAGES) {
|
if (this.pages.size() >= MAX_PAGES) {
|
||||||
@ -247,14 +259,17 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getPageCount() {
|
public int getPageCount() {
|
||||||
return pages.size();
|
return pages.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> getPages() {
|
public List<String> getPages() {
|
||||||
return pages.stream().map(CraftChatMessage::fromComponent).collect(ImmutableList.toImmutableList());
|
return pages.stream().map(CraftChatMessage::fromComponent).collect(ImmutableList.toImmutableList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPages(List<String> pages) {
|
public void setPages(List<String> pages) {
|
||||||
this.pages.clear();
|
this.pages.clear();
|
||||||
for (String page : pages) {
|
for (String page : pages) {
|
||||||
|
@ -123,10 +123,12 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage
|
|||||||
return !hasStoredEnchants();
|
return !hasStoredEnchants();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasStoredEnchant(Enchantment ench) {
|
public boolean hasStoredEnchant(Enchantment ench) {
|
||||||
return hasStoredEnchants() && enchantments.containsKey(ench);
|
return hasStoredEnchants() && enchantments.containsKey(ench);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getStoredEnchantLevel(Enchantment ench) {
|
public int getStoredEnchantLevel(Enchantment ench) {
|
||||||
Integer level = hasStoredEnchants() ? enchantments.get(ench) : null;
|
Integer level = hasStoredEnchants() ? enchantments.get(ench) : null;
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
@ -135,10 +137,12 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<Enchantment, Integer> getStoredEnchants() {
|
public Map<Enchantment, Integer> getStoredEnchants() {
|
||||||
return hasStoredEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
return hasStoredEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
|
public boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
|
||||||
if (enchantments == null) {
|
if (enchantments == null) {
|
||||||
enchantments = new HashMap<Enchantment, Integer>(4);
|
enchantments = new HashMap<Enchantment, Integer>(4);
|
||||||
@ -151,14 +155,17 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean removeStoredEnchant(Enchantment ench) {
|
public boolean removeStoredEnchant(Enchantment ench) {
|
||||||
return hasStoredEnchants() && enchantments.remove(ench) != null;
|
return hasStoredEnchants() && enchantments.remove(ench) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasStoredEnchants() {
|
public boolean hasStoredEnchants() {
|
||||||
return !(enchantments == null || enchantments.isEmpty());
|
return !(enchantments == null || enchantments.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasConflictingStoredEnchant(Enchantment ench) {
|
public boolean hasConflictingStoredEnchant(Enchantment ench) {
|
||||||
return checkConflictingEnchants(enchantments, ench);
|
return checkConflictingEnchants(enchantments, ench);
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
|||||||
safelyAddEffects(effects);
|
safelyAddEffects(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasEffects() {
|
public boolean hasEffects() {
|
||||||
return !(effects == null || effects.isEmpty());
|
return !(effects == null || effects.isEmpty());
|
||||||
}
|
}
|
||||||
@ -330,6 +331,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
|||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addEffect(FireworkEffect effect) {
|
public void addEffect(FireworkEffect effect) {
|
||||||
Validate.notNull(effect, "Effect cannot be null");
|
Validate.notNull(effect, "Effect cannot be null");
|
||||||
if (this.effects == null) {
|
if (this.effects == null) {
|
||||||
@ -338,6 +340,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
|||||||
this.effects.add(effect);
|
this.effects.add(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addEffects(FireworkEffect...effects) {
|
public void addEffects(FireworkEffect...effects) {
|
||||||
Validate.notNull(effects, "Effects cannot be null");
|
Validate.notNull(effects, "Effects cannot be null");
|
||||||
if (effects.length == 0) {
|
if (effects.length == 0) {
|
||||||
@ -355,19 +358,23 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addEffects(Iterable<FireworkEffect> effects) {
|
public void addEffects(Iterable<FireworkEffect> effects) {
|
||||||
Validate.notNull(effects, "Effects cannot be null");
|
Validate.notNull(effects, "Effects cannot be null");
|
||||||
safelyAddEffects(effects);
|
safelyAddEffects(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<FireworkEffect> getEffects() {
|
public List<FireworkEffect> getEffects() {
|
||||||
return this.effects == null ? ImmutableList.<FireworkEffect>of() : ImmutableList.copyOf(this.effects);
|
return this.effects == null ? ImmutableList.<FireworkEffect>of() : ImmutableList.copyOf(this.effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getEffectsSize() {
|
public int getEffectsSize() {
|
||||||
return this.effects == null ? 0 : this.effects.size();
|
return this.effects == null ? 0 : this.effects.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeEffect(int index) {
|
public void removeEffect(int index) {
|
||||||
if (this.effects == null) {
|
if (this.effects == null) {
|
||||||
throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
|
throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
|
||||||
@ -376,14 +383,17 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clearEffects() {
|
public void clearEffects() {
|
||||||
this.effects = null;
|
this.effects = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getPower() {
|
public int getPower() {
|
||||||
return this.power;
|
return this.power;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPower(int power) {
|
public void setPower(int power) {
|
||||||
Validate.isTrue(power >= 0, "Power cannot be less than zero: ", power);
|
Validate.isTrue(power >= 0, "Power cannot be less than zero: ", power);
|
||||||
Validate.isTrue(power < 0x80, "Power cannot be more than 127: ", power);
|
Validate.isTrue(power < 0x80, "Power cannot be more than 127: ", power);
|
||||||
|
@ -191,6 +191,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
throw new AssertionError();
|
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());
|
return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasCustomModelData() || hasBlockData() || hasRepairCost() || !unhandledTags.isEmpty() || !persistentDataContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return CraftChatMessage.fromComponent(displayName, EnumChatFormat.WHITE);
|
return CraftChatMessage.fromComponent(displayName, EnumChatFormat.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void setDisplayName(String name) {
|
public final void setDisplayName(String name) {
|
||||||
this.displayName = CraftChatMessage.wrapOrNull(name);
|
this.displayName = CraftChatMessage.wrapOrNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasDisplayName() {
|
public boolean hasDisplayName() {
|
||||||
return displayName != null;
|
return displayName != null;
|
||||||
}
|
}
|
||||||
@ -774,19 +778,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
return locName != null;
|
return locName != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasLore() {
|
public boolean hasLore() {
|
||||||
return this.lore != null && !this.lore.isEmpty();
|
return this.lore != null && !this.lore.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasRepairCost() {
|
public boolean hasRepairCost() {
|
||||||
return repairCost > 0;
|
return repairCost > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasEnchant(Enchantment ench) {
|
public boolean hasEnchant(Enchantment ench) {
|
||||||
Validate.notNull(ench, "Enchantment cannot be null");
|
Validate.notNull(ench, "Enchantment cannot be null");
|
||||||
return hasEnchants() && enchantments.containsKey(ench);
|
return hasEnchants() && enchantments.containsKey(ench);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getEnchantLevel(Enchantment ench) {
|
public int getEnchantLevel(Enchantment ench) {
|
||||||
Validate.notNull(ench, "Enchantment cannot be null");
|
Validate.notNull(ench, "Enchantment cannot be null");
|
||||||
Integer level = hasEnchants() ? enchantments.get(ench) : null;
|
Integer level = hasEnchants() ? enchantments.get(ench) : null;
|
||||||
@ -796,10 +804,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<Enchantment, Integer> getEnchants() {
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
return hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
return hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean addEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
|
public boolean addEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
|
||||||
Validate.notNull(ench, "Enchantment cannot be null");
|
Validate.notNull(ench, "Enchantment cannot be null");
|
||||||
if (enchantments == null) {
|
if (enchantments == null) {
|
||||||
@ -813,15 +823,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean removeEnchant(Enchantment ench) {
|
public boolean removeEnchant(Enchantment ench) {
|
||||||
Validate.notNull(ench, "Enchantment cannot be null");
|
Validate.notNull(ench, "Enchantment cannot be null");
|
||||||
return hasEnchants() && enchantments.remove(ench) != null;
|
return hasEnchants() && enchantments.remove(ench) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasEnchants() {
|
public boolean hasEnchants() {
|
||||||
return !(enchantments == null || enchantments.isEmpty());
|
return !(enchantments == null || enchantments.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasConflictingEnchant(Enchantment ench) {
|
public boolean hasConflictingEnchant(Enchantment ench) {
|
||||||
return checkConflictingEnchants(enchantments, ench);
|
return checkConflictingEnchants(enchantments, ench);
|
||||||
}
|
}
|
||||||
@ -863,10 +876,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
return (byte) (1 << hideFlag.ordinal());
|
return (byte) (1 << hideFlag.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> getLore() {
|
public List<String> getLore() {
|
||||||
return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, (line) -> CraftChatMessage.fromComponent(line, EnumChatFormat.DARK_PURPLE)));
|
return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, (line) -> CraftChatMessage.fromComponent(line, EnumChatFormat.DARK_PURPLE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setLore(List<String> lore) { // too tired to think if .clone is better
|
public void setLore(List<String> lore) { // too tired to think if .clone is better
|
||||||
if (lore == null) {
|
if (lore == null) {
|
||||||
this.lore = null;
|
this.lore = null;
|
||||||
@ -911,10 +926,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates();
|
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRepairCost() {
|
public int getRepairCost() {
|
||||||
return repairCost;
|
return repairCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRepairCost(int cost) { // TODO: Does this have limits?
|
public void setRepairCost(int cost) { // TODO: Does this have limits?
|
||||||
repairCost = cost;
|
repairCost = cost;
|
||||||
}
|
}
|
||||||
@ -1182,6 +1199,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Map<String, Object> serialize() {
|
public final Map<String, Object> serialize() {
|
||||||
ImmutableMap.Builder<String, Object> map = ImmutableMap.builder();
|
ImmutableMap.Builder<String, Object> map = ImmutableMap.builder();
|
||||||
map.put(SerializableMeta.TYPE_FIELD, SerializableMeta.classMap.get(getClass()));
|
map.put(SerializableMeta.TYPE_FIELD, SerializableMeta.classMap.get(getClass()));
|
||||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren