Whitespace + general cleanup
Dieser Commit ist enthalten in:
Ursprung
e54d8c3352
Commit
309846d732
@ -12,7 +12,7 @@ public class BlockBloodStone extends Block {
|
|||||||
super(i, j, Material.STONE);
|
super(i, j, Material.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||||
@ -24,5 +24,5 @@ public class BlockBloodStone extends Block {
|
|||||||
server.getPluginManager().callEvent(eventRedstone);
|
server.getPluginManager().callEvent(eventRedstone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Dispenser;
|
import org.bukkit.block.Dispenser;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
@ -10,6 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class BlockDispenser extends BlockContainer {
|
public class BlockDispenser extends BlockContainer {
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - private->public
|
// CraftBukkit - private -> public
|
||||||
public void dispense(World world, int i, int j, int k, Random random) {
|
public void dispense(World world, int i, int j, int k, Random random) {
|
||||||
int l = world.getData(i, j, k);
|
int l = world.getData(i, j, k);
|
||||||
float f = 0.0F;
|
float f = 0.0F;
|
||||||
@ -96,11 +99,12 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
if (dispenseSlot > -1) {
|
if (dispenseSlot > -1) {
|
||||||
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
||||||
|
|
||||||
// Copy item stack, because we want it to have 1 item
|
// Copy item stack, because we want it to have 1 item
|
||||||
itemstack = new ItemStack(itemstack.id, 1, itemstack.damage);
|
itemstack = new ItemStack(itemstack.id, 1, itemstack.damage);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
double d0 = (double) i + (double) f * 0.5D + 0.5D;
|
double d0 = (double) i + (double) f * 0.5D + 0.5D;
|
||||||
double d1 = (double) j + 0.5D;
|
double d1 = (double) j + 0.5D;
|
||||||
double d2 = (double) k + (double) f1 * 0.5D + 0.5D;
|
double d2 = (double) k + (double) f1 * 0.5D + 0.5D;
|
||||||
@ -109,7 +113,7 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
world.makeSound((double) i, (double) j, (double) k, "random.click", 1.0F, 1.2F);
|
world.makeSound((double) i, (double) j, (double) k, "random.click", 1.0F, 1.2F);
|
||||||
} else {
|
} else {
|
||||||
double d3;
|
double d3;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
d3 = random.nextDouble() * 0.1D + 0.2D;
|
d3 = random.nextDouble() * 0.1D + 0.2D;
|
||||||
double motX = (double) f * d3;
|
double motX = (double) f * d3;
|
||||||
@ -125,20 +129,19 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
org.bukkit.inventory.ItemStack bukkitItem = (new CraftItemStack(itemstack)).clone();
|
org.bukkit.inventory.ItemStack bukkitItem = (new CraftItemStack(itemstack)).clone();
|
||||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
|
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actually remove the item
|
// Actually remove the item
|
||||||
tileentitydispenser.a(dispenseSlot, 1);
|
tileentitydispenser.a(dispenseSlot, 1);
|
||||||
|
|
||||||
motX = event.getVelocity().getX();
|
motX = event.getVelocity().getX();
|
||||||
motY = event.getVelocity().getY();
|
motY = event.getVelocity().getY();
|
||||||
motZ = event.getVelocity().getZ();
|
motZ = event.getVelocity().getZ();
|
||||||
|
|
||||||
itemstack = new ItemStack(event.getItem().getTypeId(),
|
itemstack = new ItemStack(event.getItem().getTypeId(), event.getItem().getAmount(), event.getItem().getDurability());
|
||||||
event.getItem().getAmount(), event.getItem().getDurability());
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (itemstack.id == Item.ARROW.id) {
|
if (itemstack.id == Item.ARROW.id) {
|
||||||
|
@ -174,7 +174,7 @@ public class BlockDoor extends Block {
|
|||||||
} else if (l > 0 && Block.byId[l].isPowerSource()) {
|
} else if (l > 0 && Block.byId[l].isPowerSource()) {
|
||||||
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
|
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||||
@ -187,7 +187,7 @@ public class BlockDoor extends Block {
|
|||||||
server.getPluginManager().callEvent(eventRedstone);
|
server.getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.setDoor(world, i, j, k, flag1);
|
this.setDoor(world, i, j, k, flag1);
|
||||||
}
|
}
|
||||||
|
@ -116,15 +116,15 @@ public class BlockFire extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 15) {
|
if (l == 15) {
|
||||||
this.a(world, i + 1, j, k, 1, random);
|
this.a(world, i + 1, j, k, 1, random);
|
||||||
this.a(world, i - 1, j, k, 1, random);
|
this.a(world, i - 1, j, k, 1, random);
|
||||||
this.a(world, i, j - 1, k, 1, random);
|
this.a(world, i, j - 1, k, 1, random);
|
||||||
this.a(world, i, j + 1, k, 1, random);
|
this.a(world, i, j + 1, k, 1, random);
|
||||||
this.a(world, i, j, k - 1, 1, random);
|
this.a(world, i, j, k - 1, 1, random);
|
||||||
this.a(world, i, j, k + 1, 1, random);
|
this.a(world, i, j, k + 1, 1, random);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit Start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class BlockPumpkin extends Block {
|
public class BlockPumpkin extends Block {
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ public class BlockPumpkin extends Block {
|
|||||||
world.setData(i, j, k, l);
|
world.setData(i, j, k, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||||
@ -63,5 +65,5 @@ public class BlockPumpkin extends Block {
|
|||||||
server.getPluginManager().callEvent(eventRedstone);
|
server.getPluginManager().callEvent(eventRedstone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
||||||
if (this.a(world, i, j, k, true)) {
|
if (this.a(world, i, j, k, true)) {
|
||||||
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||||
@ -140,6 +141,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ public class BlockRedstoneWire extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit private->public
|
// CraftBukkit - private -> public
|
||||||
public int getPower(World world, int i, int j, int k, int l) {
|
public int getPower(World world, int i, int j, int k, int l) {
|
||||||
if (world.getTypeId(i, j, k) != this.id) {
|
if (world.getTypeId(i, j, k) != this.id) {
|
||||||
return l;
|
return l;
|
||||||
@ -282,7 +282,7 @@ public class BlockRedstoneWire extends Block {
|
|||||||
this.a_(world, i, j, k, i1);
|
this.a_(world, i, j, k, i1);
|
||||||
world.setTypeId(i, j, k, 0);
|
world.setTypeId(i, j, k, 0);
|
||||||
} else {
|
} else {
|
||||||
// Craftbukkit
|
// CraftBukkit
|
||||||
if ((Block.byId[l] != null && Block.byId[l].isPowerSource()) || Block.DIODE_OFF.id == l || Block.DIODE_ON.id == l)
|
if ((Block.byId[l] != null && Block.byId[l].isPowerSource()) || Block.DIODE_OFF.id == l || Block.DIODE_ON.id == l)
|
||||||
this.g(world, i, j, k);
|
this.g(world, i, j, k);
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,11 @@ public class BlockSoil extends Block {
|
|||||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
||||||
((CraftServer)Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
((CraftServer)Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancellable.isCancelled()) {
|
if (cancellable.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeId(i, j, k, Block.DIRT.id);
|
world.setTypeId(i, j, k, Block.DIRT.id);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class BlockStationary extends BlockFluids {
|
|||||||
if (this.material == Material.LAVA) {
|
if (this.material == Material.LAVA) {
|
||||||
int l = random.nextInt(3);
|
int l = random.nextInt(3);
|
||||||
|
|
||||||
// CraftBukkit start: prevent lava putting something on fire.
|
// CraftBukkit start - prevent lava putting something on fire.
|
||||||
Server server = ((WorldServer) world).getServer();
|
Server server = ((WorldServer) world).getServer();
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class BlockStationary extends BlockFluids {
|
|||||||
|
|
||||||
if (j1 == 0) {
|
if (j1 == 0) {
|
||||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||||
// CraftBukkit start: prevent lava putting something on fire.
|
// CraftBukkit start - prevent lava putting something on fire.
|
||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||||
|
|
||||||
if (theBlock.getTypeId() != Block.FIRE.id) {
|
if (theBlock.getTypeId() != Block.FIRE.id) {
|
||||||
|
@ -51,9 +51,9 @@ public class Chunk {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld cw = ((WorldServer) world).getWorld();
|
CraftWorld cw = ((WorldServer) world).getWorld();
|
||||||
bukkitChunk = (cw == null) ? null : cw.popPreservedChunk( i, j );
|
bukkitChunk = (cw == null) ? null : cw.popPreservedChunk(i, j);
|
||||||
if (bukkitChunk == null) {
|
if (bukkitChunk == null) {
|
||||||
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
|
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,20 +476,20 @@ public class Chunk {
|
|||||||
this.world.c.removeAll(this.tileEntities.values());
|
this.world.c.removeAll(this.tileEntities.values());
|
||||||
|
|
||||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
Iterator<Object> iter = this.entitySlices[i].iterator();
|
Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Entity entity = (Entity) iter.next();
|
Entity entity = (Entity) iter.next();
|
||||||
int cx = Location.locToBlock(entity.locX) >> 4;
|
int cx = Location.locToBlock(entity.locX) >> 4;
|
||||||
int cz = Location.locToBlock(entity.locZ) >> 4;
|
int cz = Location.locToBlock(entity.locZ) >> 4;
|
||||||
|
|
||||||
if ((entity instanceof EntityPlayer) && ((cx != this.x) || (cz != this.z))) {
|
// Do not pass along players, as doing so can get them stuck outside of time.
|
||||||
EntityPlayer player = (EntityPlayer) entity;
|
// (which for example disables inventory icon updates and prevents block breaking)
|
||||||
iter.remove(); // Do not pass along players, as doing so can get them stuck outside of time.
|
if (entity instanceof EntityPlayer && (cx != this.x || cz != this.z)) {
|
||||||
// (which for example disables inventory icon updates and prevents block breaking)
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.world.b(this.entitySlices[i]);
|
this.world.b(this.entitySlices[i]);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk loadChunk(int i, int j) {// CraftBukkit - private->public
|
public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public
|
||||||
if (this.d == null) {
|
if (this.d == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -143,7 +143,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private->public
|
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public
|
||||||
if (this.d != null) {
|
if (this.d != null) {
|
||||||
try {
|
try {
|
||||||
this.d.b(this.world, chunk);
|
this.d.b(this.world, chunk);
|
||||||
@ -153,7 +153,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveChunk(Chunk chunk) { // CraftBukkit - private->public
|
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
|
||||||
if (this.d != null) {
|
if (this.d != null) {
|
||||||
try {
|
try {
|
||||||
chunk.r = this.world.getTime();
|
chunk.r = this.world.getTime();
|
||||||
@ -219,12 +219,12 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.world.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
|
this.world.getWorld().preserveChunk((CraftChunk) chunk.bukkitChunk);
|
||||||
|
|
||||||
chunk.removeEntities();
|
chunk.removeEntities();
|
||||||
this.saveChunk(chunk);
|
this.saveChunk(chunk);
|
||||||
this.saveChunkNOP(chunk);
|
this.saveChunkNOP(chunk);
|
||||||
//this.unloadQueue.remove(integer);
|
// this.unloadQueue.remove(integer);
|
||||||
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
||||||
this.chunkList.remove(chunk);
|
this.chunkList.remove(chunk);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class ConsoleCommandHandler {
|
|||||||
if (s.toLowerCase().startsWith("kick ")) {
|
if (s.toLowerCase().startsWith("kick ")) {
|
||||||
// CraftBukkit start - Add kick message compatibility
|
// CraftBukkit start - Add kick message compatibility
|
||||||
String[] parts = s.split(" ");
|
String[] parts = s.split(" ");
|
||||||
s2 = ( parts.length >= 2 ) ? parts[1] : "";
|
s2 = parts.length >= 2 ? parts[1] : "";
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
entityplayer = null;
|
entityplayer = null;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class ConsoleLogManager {
|
|||||||
|
|
||||||
public ConsoleLogManager() {}
|
public ConsoleLogManager() {}
|
||||||
|
|
||||||
// Craftbukkit - change of method signature!
|
// CraftBukkit - change of method signature!
|
||||||
public static void init(MinecraftServer server) {
|
public static void init(MinecraftServer server) {
|
||||||
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter();
|
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter();
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ public class ContainerPlayer extends Container {
|
|||||||
if (super.g.size() < 1) {
|
if (super.g.size() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -48,6 +48,7 @@ public class ContainerWorkbench extends Container {
|
|||||||
if (super.g.size() < 1) {
|
if (super.g.size() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -56,7 +56,7 @@ public abstract class Entity {
|
|||||||
public float width;
|
public float width;
|
||||||
public float bh;
|
public float bh;
|
||||||
public float bi;
|
public float bi;
|
||||||
public float fallDistance; // Craftbukkit made public
|
public float fallDistance; // CraftBukkit - private -> public
|
||||||
private int b;
|
private int b;
|
||||||
public double bk;
|
public double bk;
|
||||||
public double bl;
|
public double bl;
|
||||||
@ -69,7 +69,7 @@ public abstract class Entity {
|
|||||||
public int ticksLived;
|
public int ticksLived;
|
||||||
public int maxFireTicks;
|
public int maxFireTicks;
|
||||||
public int fireTicks;
|
public int fireTicks;
|
||||||
public int maxAirTicks; // CraftBukkit -- protected->public
|
public int maxAirTicks; // CraftBukkit - protected - >public
|
||||||
protected boolean bw;
|
protected boolean bw;
|
||||||
public int noDamageTicks;
|
public int noDamageTicks;
|
||||||
public int airTicks;
|
public int airTicks;
|
||||||
@ -146,9 +146,8 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void c(float f, float f1) {
|
protected void c(float f, float f1) {
|
||||||
// Craftbukkit start
|
// CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0.
|
||||||
if (Float.isNaN(f)) {
|
if (Float.isNaN(f)) {
|
||||||
// CraftBukkit - yaw was sometimes set to NaN, so we need to set it back to 0.
|
|
||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +159,8 @@ public abstract class Entity {
|
|||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pitch was sometimes set to NaN, so we need to set it back to 0.
|
||||||
if (Float.isNaN(f1)) {
|
if (Float.isNaN(f1)) {
|
||||||
// CraftBukkit - pitch was sometimes set to NaN, so we need to set it back to 0.
|
|
||||||
f1 = 0;
|
f1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +171,7 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
f1 = 0;
|
f1 = 0;
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.yaw = f % 360.0F;
|
this.yaw = f % 360.0F;
|
||||||
this.pitch = f1 % 360.0F;
|
this.pitch = f1 % 360.0F;
|
||||||
@ -291,7 +290,7 @@ public abstract class Entity {
|
|||||||
|
|
||||||
protected void X() {
|
protected void X() {
|
||||||
if (!this.bz) {
|
if (!this.bz) {
|
||||||
// CraftBukkit start -- TODO: this event spams!
|
// CraftBukkit start - TODO: this event spams!
|
||||||
if (this instanceof EntityLiving) {
|
if (this instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CraftServer server = ((WorldServer) this.world).getServer();
|
||||||
// TODO: shouldn't be sending null for the block.
|
// TODO: shouldn't be sending null for the block.
|
||||||
@ -882,8 +881,8 @@ public abstract class Entity {
|
|||||||
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
|
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
|
||||||
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
|
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
|
||||||
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
|
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
|
||||||
// CraftBukkit Start
|
|
||||||
//Exempt Vehicles from notch's sanity check
|
// CraftBukkit start - Exempt Vehicles from notch's sanity check
|
||||||
if (!(this.getBukkitEntity() instanceof CraftVehicle)) {
|
if (!(this.getBukkitEntity() instanceof CraftVehicle)) {
|
||||||
if (Math.abs(this.motX) > 10.0D) {
|
if (Math.abs(this.motX) > 10.0D) {
|
||||||
this.motX = 0.0D;
|
this.motX = 0.0D;
|
||||||
@ -897,7 +896,7 @@ public abstract class Entity {
|
|||||||
this.motZ = 0.0D;
|
this.motZ = 0.0D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit End
|
// CraftBukkit end
|
||||||
|
|
||||||
this.lastX = this.bk = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
this.lastX = this.bk = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
||||||
this.lastY = this.bl = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
this.lastY = this.bl = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
||||||
@ -1168,17 +1167,19 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(EntityWeatherStorm entityweatherstorm) {
|
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
int damage = 5;
|
int damage = 5;
|
||||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), getBukkitEntity(), DamageCause.LIGHTNING, damage);
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), getBukkitEntity(), DamageCause.LIGHTNING, damage);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
damage = event.getDamage();
|
damage = event.getDamage();
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a(damage);
|
this.a(damage);
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
++this.fireTicks;
|
++this.fireTicks;
|
||||||
if (this.fireTicks == 0) {
|
if (this.fireTicks == 0) {
|
||||||
this.fireTicks = 300;
|
this.fireTicks = 300;
|
||||||
|
@ -57,7 +57,7 @@ public class EntityCow extends EntityAnimal {
|
|||||||
|
|
||||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||||
itemstack = new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data );
|
itemstack = new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
|
||||||
|
|
||||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, itemstack);
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, itemstack);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -43,6 +43,7 @@ public class EntityCreature extends EntityLiving {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (this.target != null) {
|
if (this.target != null) {
|
||||||
this.pathEntity = this.world.findPath(this, this.target, f);
|
this.pathEntity = this.world.findPath(this, this.target, f);
|
||||||
}
|
}
|
||||||
@ -121,7 +122,7 @@ public class EntityCreature extends EntityLiving {
|
|||||||
double d1 = vec3d.a - this.locX;
|
double d1 = vec3d.a - this.locX;
|
||||||
double d2 = vec3d.c - this.locZ;
|
double d2 = vec3d.c - this.locZ;
|
||||||
double d3 = vec3d.b - (double) l1;
|
double d3 = vec3d.b - (double) l1;
|
||||||
// CraftBukkit -- Math -> TrigMath
|
// CraftBukkit - Math -> TrigMath
|
||||||
float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
|
float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||||
float f5 = f4 - this.yaw;
|
float f5 = f4 - this.yaw;
|
||||||
|
|
||||||
|
@ -262,9 +262,9 @@ public class EntityEgg extends Entity {
|
|||||||
entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
||||||
this.world.addEntity(entity);
|
this.world.addEntity(entity);
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
for (int l = 0; l < 8; ++l) {
|
for (int l = 0; l < 8; ++l) {
|
||||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||||
|
@ -40,7 +40,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
public boolean fauxSleeping;
|
public boolean fauxSleeping;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
private ChunkCoordinates a;
|
private ChunkCoordinates a;
|
||||||
public int sleepTicks; // CraftBukkit (public)
|
public int sleepTicks; // CraftBukkit - private -> public
|
||||||
public float A;
|
public float A;
|
||||||
public float B;
|
public float B;
|
||||||
private ChunkCoordinates c;
|
private ChunkCoordinates c;
|
||||||
@ -176,7 +176,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
this.n = this.o;
|
this.n = this.o;
|
||||||
super.u();
|
super.u();
|
||||||
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||||
// CraftBukkit -- Math -> TrigMath
|
// CraftBukkit - Math -> TrigMath
|
||||||
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
|
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
|
||||||
|
|
||||||
if (f > 0.1F) {
|
if (f > 0.1F) {
|
||||||
@ -679,12 +679,14 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
if (this.getBukkitEntity() instanceof Player) {
|
if (this.getBukkitEntity() instanceof Player) {
|
||||||
Player player = (Player) this.getBukkitEntity();
|
Player player = (Player) this.getBukkitEntity();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
|
|
||||||
org.bukkit.block.Block bed;
|
org.bukkit.block.Block bed;
|
||||||
if (chunkcoordinates != null) {
|
if (chunkcoordinates != null) {
|
||||||
bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
|
bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
|
||||||
} else {
|
} else {
|
||||||
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
|
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
protected double aq;
|
protected double aq;
|
||||||
protected double ar;
|
protected double ar;
|
||||||
float as = 0.0F;
|
float as = 0.0F;
|
||||||
public int lastDamage = 0; // CraftBukkit protected -> public
|
public int lastDamage = 0; // CraftBukkit - protected -> public
|
||||||
protected int au = 0;
|
protected int au = 0;
|
||||||
protected float av;
|
protected float av;
|
||||||
protected float aw;
|
protected float aw;
|
||||||
@ -241,7 +241,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
if (f > 0.05F) {
|
if (f > 0.05F) {
|
||||||
f3 = 1.0F;
|
f3 = 1.0F;
|
||||||
f2 = f * 3.0F;
|
f2 = f * 3.0F;
|
||||||
// CraftBukkit -- Math -> TrigMath
|
// CraftBukkit - Math -> TrigMath
|
||||||
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
|
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,6 +837,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
if (event.isCancelled() || event.getDamage() == 0) {
|
if (event.isCancelled() || event.getDamage() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
damageDone = event.getDamage();
|
damageDone = event.getDamage();
|
||||||
this.damageEntity((Entity) null, damageDone);
|
this.damageEntity((Entity) null, damageDone);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -123,11 +123,11 @@ public class EntityPainting extends Entity {
|
|||||||
if (this.f++ == 100 && !this.world.isStatic) {
|
if (this.f++ == 100 && !this.world.isStatic) {
|
||||||
this.f = 0;
|
this.f = 0;
|
||||||
if (!this.h()) {
|
if (!this.h()) {
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Painting painting = (Painting) getBukkitEntity();
|
Painting painting = (Painting) getBukkitEntity();
|
||||||
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent(painting);
|
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent(painting);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -203,11 +203,11 @@ public class EntityPainting extends Entity {
|
|||||||
|
|
||||||
public boolean damageEntity(Entity entity, int i) {
|
public boolean damageEntity(Entity entity, int i) {
|
||||||
if (!this.dead && !this.world.isStatic) {
|
if (!this.dead && !this.world.isStatic) {
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Painting painting = (Painting) getBukkitEntity();
|
Painting painting = (Painting) getBukkitEntity();
|
||||||
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent(painting, entity == null ? null : entity.getBukkitEntity());
|
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent(painting, entity == null ? null : entity.getBukkitEntity());
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
@ -42,8 +42,7 @@ public class EntityPig extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(EntityHuman entityhuman) {
|
public boolean a(EntityHuman entityhuman) {
|
||||||
if (this.x() && !this.world.isStatic
|
if (this.x() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
|
||||||
&& (this.passenger == null || this.passenger == entityhuman)) {
|
|
||||||
entityhuman.mount(this);
|
entityhuman.mount(this);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -69,8 +68,6 @@ public class EntityPig extends EntityAnimal {
|
|||||||
|
|
||||||
public void a(EntityWeatherStorm entityweatherstorm) {
|
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||||
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
||||||
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ,
|
|
||||||
this.yaw, this.pitch);
|
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CraftServer server = ((WorldServer) this.world).getServer();
|
||||||
@ -79,11 +76,14 @@ public class EntityPig extends EntityAnimal {
|
|||||||
PigZapEvent event = new PigZapEvent(entity, entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
PigZapEvent event = new PigZapEvent(entity, entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
this.world.addEntity(entitypigzombie);
|
return;
|
||||||
this.die();
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||||
|
this.world.addEntity(entitypigzombie);
|
||||||
|
this.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(float f) {
|
protected void a(float f) {
|
||||||
|
@ -131,7 +131,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
cworld.dropItemNaturally(craftEntity.getLocation(), stack);
|
cworld.dropItemNaturally(craftEntity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x();
|
this.x();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
if (this.bG > 0) {
|
if (this.bG > 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!this.world.pvpMode) { // CraftBukkit this.b.pvpMode -> this.world.pvpMode
|
if (!this.world.pvpMode) { // CraftBukkit
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -371,10 +371,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + "(" + name + " at " + locX + "," + locY + "," + locZ + ")";
|
return super.toString() + "(" + name + " at " + locX + "," + locY + "," + locZ + ")";
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
// CraftBukkit stop
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntitySpider extends EntityMonster {
|
public class EntitySpider extends EntityMonster {
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class EntityTracker {
|
|||||||
this.d = minecraftserver.serverConfigurationManager.a();
|
this.d = minecraftserver.serverConfigurationManager.a();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a(Entity entity) {
|
public synchronized void a(Entity entity) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
this.a(entity, 512, 2);
|
this.a(entity, 512, 2);
|
||||||
@ -62,7 +62,7 @@ public class EntityTracker {
|
|||||||
this.a(entity, i, j, false);
|
this.a(entity, i, j, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a(Entity entity, int i, int j, boolean flag) {
|
public synchronized void a(Entity entity, int i, int j, boolean flag) {
|
||||||
if (i > this.d) {
|
if (i > this.d) {
|
||||||
i = this.d;
|
i = this.d;
|
||||||
@ -70,7 +70,7 @@ public class EntityTracker {
|
|||||||
|
|
||||||
if (this.b.b(entity.id)) {
|
if (this.b.b(entity.id)) {
|
||||||
// CraftBukkit - removed exception throw as tracking an already tracked entity theoretically shouldn't cause any issues.
|
// CraftBukkit - removed exception throw as tracking an already tracked entity theoretically shouldn't cause any issues.
|
||||||
//throw new IllegalStateException("Entity is already tracked!");
|
// throw new IllegalStateException("Entity is already tracked!");
|
||||||
} else {
|
} else {
|
||||||
EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
|
EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void untrackEntity(Entity entity) {
|
public synchronized void untrackEntity(Entity entity) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||||
@ -102,7 +102,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a() {
|
public synchronized void a() {
|
||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
Iterator iterator = this.a.iterator();
|
Iterator iterator = this.a.iterator();
|
||||||
@ -131,7 +131,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a(Entity entity, Packet packet) {
|
public synchronized void a(Entity entity, Packet packet) {
|
||||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void b(Entity entity, Packet packet) {
|
public synchronized void b(Entity entity, Packet packet) {
|
||||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void trackPlayer(EntityPlayer entityplayer) {
|
public synchronized void trackPlayer(EntityPlayer entityplayer) {
|
||||||
Iterator iterator = this.a.iterator();
|
Iterator iterator = this.a.iterator();
|
||||||
|
|
||||||
|
@ -39,9 +39,8 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||||||
this.b = 2;
|
this.b = 2;
|
||||||
this.a = this.random.nextLong();
|
this.a = this.random.nextLong();
|
||||||
this.c = this.random.nextInt(3) + 1;
|
this.c = this.random.nextInt(3) + 1;
|
||||||
// CraftBukkit start
|
// CraftBukkit
|
||||||
if (!isEffect && world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
|
if (!isEffect && world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
|
||||||
// CraftBukkit end
|
|
||||||
int i = MathHelper.floor(d0);
|
int i = MathHelper.floor(d0);
|
||||||
int j = MathHelper.floor(d1);
|
int j = MathHelper.floor(d1);
|
||||||
int k = MathHelper.floor(d2);
|
int k = MathHelper.floor(d2);
|
||||||
@ -51,6 +50,7 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
world.setTypeId(i, j, k, Block.FIRE.id);
|
world.setTypeId(i, j, k, Block.FIRE.id);
|
||||||
}
|
}
|
||||||
@ -112,9 +112,7 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
if (this.b >= 0 && !isEffect) { // CraftBukkit
|
||||||
if (!isEffect && this.b >= 0) {
|
|
||||||
// CraftBukkit end
|
|
||||||
double d0 = 3.0D;
|
double d0 = 3.0D;
|
||||||
List list = this.world.b((Entity) this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
|
List list = this.world.b((Entity) this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ public class InventoryPlayer implements IInventory {
|
|||||||
public ItemStack[] items = new ItemStack[36];
|
public ItemStack[] items = new ItemStack[36];
|
||||||
public ItemStack[] armor = new ItemStack[4];
|
public ItemStack[] armor = new ItemStack[4];
|
||||||
public int itemInHandIndex = 0;
|
public int itemInHandIndex = 0;
|
||||||
public EntityHuman d; // CraftBukkit - private->public
|
public EntityHuman d; // CraftBukkit - private -> public
|
||||||
private ItemStack f;
|
private ItemStack f;
|
||||||
public boolean e = false;
|
public boolean e = false;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class ItemBed extends Item {
|
|||||||
if (l != 1) {
|
if (l != 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
++j;
|
++j;
|
||||||
BlockBed blockbed = (BlockBed) Block.BED;
|
BlockBed blockbed = (BlockBed) Block.BED;
|
||||||
|
@ -18,7 +18,7 @@ public class ItemBlock extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
||||||
l = 0;
|
l = 0;
|
||||||
@ -61,21 +61,19 @@ public class ItemBlock extends Item {
|
|||||||
replacedBlockState = CraftBlockState.getBlockState(world, i, j - 1, k);
|
replacedBlockState = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
|
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
|
||||||
*
|
*
|
||||||
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
|
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
|
||||||
* hook between the 'placement' and the informing to 'world' so we can
|
* hook between the 'placement' and the informing to 'world' so we can
|
||||||
* sanely undo this.
|
* sanely undo this.
|
||||||
*
|
*
|
||||||
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
|
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
|
||||||
* replace this with.
|
* replace this with.
|
||||||
*/
|
*/
|
||||||
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
|
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
|
||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
|
||||||
|
|
||||||
if (event.isCancelled() || !event.canBuild()) {
|
if (event.isCancelled() || !event.canBuild()) {
|
||||||
// CraftBukkit Undo!
|
|
||||||
|
|
||||||
if ((this.id == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
|
if ((this.id == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
|
||||||
// Half steps automatically set the block below to a double
|
// Half steps automatically set the block below to a double
|
||||||
world.setTypeId(i, j - 1, k, 44);
|
world.setTypeId(i, j - 1, k, 44);
|
||||||
|
@ -78,7 +78,7 @@ public class ItemBucket extends Item {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeId(i, j, k, 0);
|
world.setTypeId(i, j, k, 0);
|
||||||
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data ); // CraftBukkit
|
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data); // CraftBukkit
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.a < 0) {
|
if (this.a < 0) {
|
||||||
@ -91,10 +91,11 @@ public class ItemBucket extends Item {
|
|||||||
|
|
||||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||||
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data );
|
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
|
||||||
|
int clickedX = i, clickedY = j, clickedZ = k;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (movingobjectposition.face == 0) {
|
if (movingobjectposition.face == 0) {
|
||||||
--j;
|
--j;
|
||||||
@ -142,12 +143,13 @@ public class ItemBucket extends Item {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||||
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data );
|
|
||||||
|
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.a == 0 && movingobjectposition.entity instanceof EntityCow) {
|
} else if (this.a == 0 && movingobjectposition.entity instanceof EntityCow) {
|
||||||
// CraftBukkit start -- This codepath seems to be *NEVER* called
|
// CraftBukkit start - This codepath seems to be *NEVER* called
|
||||||
Location loc = movingobjectposition.entity.getBukkitEntity().getLocation();
|
Location loc = movingobjectposition.entity.getBukkitEntity().getLocation();
|
||||||
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
|
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
|
||||||
|
|
||||||
@ -157,7 +159,7 @@ public class ItemBucket extends Item {
|
|||||||
|
|
||||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||||
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data );
|
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class ItemDoor extends Item {
|
|||||||
if (l != 1) {
|
if (l != 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
++j;
|
++j;
|
||||||
Block block;
|
Block block;
|
||||||
|
@ -21,7 +21,7 @@ public class ItemFlintAndSteel extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
if (l == 0) {
|
if (l == 0) {
|
||||||
--j;
|
--j;
|
||||||
|
@ -34,6 +34,7 @@ public class ItemHoe extends Item {
|
|||||||
|
|
||||||
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
|
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
|
||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block);
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block);
|
||||||
|
|
||||||
if (event.isCancelled() || !event.canBuild()) {
|
if (event.isCancelled() || !event.canBuild()) {
|
||||||
event.getBlockPlaced().setTypeId(blockState.getTypeId());
|
event.getBlockPlaced().setTypeId(blockState.getTypeId());
|
||||||
return false;
|
return false;
|
||||||
|
@ -50,7 +50,7 @@ public class ItemInWorldManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit added face
|
// CraftBukkit - added face
|
||||||
public void dig(int i, int j, int k, int face) {
|
public void dig(int i, int j, int k, int face) {
|
||||||
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||||
int l = this.world.getTypeId(i, j, k);
|
int l = this.world.getTypeId(i, j, k);
|
||||||
@ -124,7 +124,7 @@ public class ItemInWorldManager {
|
|||||||
this.m = this.d;
|
this.m = this.d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit start -- force blockreset to client
|
// CraftBukkit start - force blockreset to client
|
||||||
} else {
|
} else {
|
||||||
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
|
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -224,6 +224,6 @@ public class ItemInWorldManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class ItemPainting extends Item {
|
|||||||
|
|
||||||
PaintingPlaceEvent event = new PaintingPlaceEvent(painting, who, blockClicked, blockFace);
|
PaintingPlaceEvent event = new PaintingPlaceEvent(painting, who, blockClicked, blockFace);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -14,53 +14,55 @@ public class ItemRedstone extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
if (l == 0) {
|
if (world.getTypeId(i, j, k) != Block.SNOW.id) {
|
||||||
--j;
|
if (l == 0) {
|
||||||
}
|
--j;
|
||||||
|
|
||||||
if (l == 1) {
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 2) {
|
|
||||||
--k;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 3) {
|
|
||||||
++k;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 4) {
|
|
||||||
--i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 5) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!world.isEmpty(i, j, k)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
|
|
||||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
|
||||||
|
|
||||||
world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
|
|
||||||
|
|
||||||
// CraftBukkit start - redstone
|
|
||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.REDSTONE_WIRE);
|
|
||||||
|
|
||||||
if (event.isCancelled() || !event.canBuild()) {
|
|
||||||
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
--itemstack.count; // CraftBukkit -- ORDER MATTERS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (l == 1) {
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l == 2) {
|
||||||
|
--k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l == 3) {
|
||||||
|
++k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l == 4) {
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l == 5) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!world.isEmpty(i, j, k)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
|
||||||
|
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||||
|
|
||||||
|
world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
|
||||||
|
|
||||||
|
// CraftBukkit start - redstone
|
||||||
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.REDSTONE_WIRE);
|
||||||
|
|
||||||
|
if (event.isCancelled() || !event.canBuild()) {
|
||||||
|
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
--itemstack.count; // CraftBukkit - ORDER MATTERS
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class ItemReed extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
||||||
l = 0;
|
l = 0;
|
||||||
@ -57,7 +57,7 @@ public class ItemReed extends Item {
|
|||||||
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||||
/**
|
/**
|
||||||
* @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
|
* @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
|
||||||
*
|
*
|
||||||
* This replaces world.setTypeId(IIII), we're doing this because we need to
|
* This replaces world.setTypeId(IIII), we're doing this because we need to
|
||||||
* hook between the 'placement' and the informing to 'world' so we can
|
* hook between the 'placement' and the informing to 'world' so we can
|
||||||
* sanely undo this.
|
* sanely undo this.
|
||||||
@ -69,7 +69,7 @@ public class ItemReed extends Item {
|
|||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
|
||||||
|
|
||||||
if (event.isCancelled() || !event.canBuild()) {
|
if (event.isCancelled() || !event.canBuild()) {
|
||||||
// CraftBukkit Undo -- this only has reed, repeater and pie blocks
|
// CraftBukkit - undo; this only has reed, repeater and pie blocks
|
||||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
||||||
} else {
|
} else {
|
||||||
world.update(i, j, k, this.id); // <-- world.setTypeId does this on success (tell the world)
|
world.update(i, j, k, this.id); // <-- world.setTypeId does this on success (tell the world)
|
||||||
|
@ -20,7 +20,7 @@ public class ItemSign extends Item {
|
|||||||
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit;
|
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||||
|
|
||||||
if (l == 1) {
|
if (l == 1) {
|
||||||
++j;
|
++j;
|
||||||
|
@ -5,7 +5,7 @@ public final class ItemStack {
|
|||||||
public int count;
|
public int count;
|
||||||
public int b;
|
public int b;
|
||||||
public int id;
|
public int id;
|
||||||
public int damage; // CraftBukkit - private->public
|
public int damage; // CraftBukkit - private -> public
|
||||||
|
|
||||||
public ItemStack(Block block) {
|
public ItemStack(Block block) {
|
||||||
this(block, 1);
|
this(block, 1);
|
||||||
|
@ -56,7 +56,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
public ColouredConsoleSender console;
|
public ColouredConsoleSender console;
|
||||||
public ConsoleReader reader;
|
public ConsoleReader reader;
|
||||||
public static int currentTick;
|
public static int currentTick;
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
|
public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
|
||||||
new ThreadSleepForever(this);
|
new ThreadSleepForever(this);
|
||||||
@ -78,7 +78,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
threadcommandreader.setDaemon(true);
|
threadcommandreader.setDaemon(true);
|
||||||
threadcommandreader.start();
|
threadcommandreader.start();
|
||||||
ConsoleLogManager.init(this); // Craftbukkit
|
ConsoleLogManager.init(this); // CraftBukkit
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
|
System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
|
||||||
@ -99,7 +99,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
||||||
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
|
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
|
||||||
this.o = this.propertyManager.getBoolean("allow-flight", false);
|
this.o = this.propertyManager.getBoolean("allow-flight", false);
|
||||||
this.spawnProtection = this.propertyManager.getInt("spawn-protection", 16); // CraftBukkit Configurable spawn protection start
|
this.spawnProtection = this.propertyManager.getInt("spawn-protection", 16); // CraftBukkit - Configurable spawn protection start
|
||||||
InetAddress inetaddress = null;
|
InetAddress inetaddress = null;
|
||||||
|
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
@ -146,7 +146,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
long elapsed = System.nanoTime() - j;
|
long elapsed = System.nanoTime() - j;
|
||||||
String time = String.format( "%.3fs", elapsed / 10000000000.0D );
|
String time = String.format("%.3fs", elapsed / 10000000000.0D);
|
||||||
log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
|
log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -226,15 +226,15 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
world.save(true, (IProgressUpdate) null);
|
world.save(true, (IProgressUpdate) null);
|
||||||
world.saveLevel();
|
world.saveLevel();
|
||||||
|
|
||||||
WorldSaveEvent event = new WorldSaveEvent( world.getWorld() );
|
WorldSaveEvent event = new WorldSaveEvent(world.getWorld());
|
||||||
server.getPluginManager().callEvent( event );
|
server.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serverConfigurationManager.savePlayers(); // CraftBukkit - player data should be saved whenever a save happens.
|
this.serverConfigurationManager.savePlayers(); // CraftBukkit - player data should be saved whenever a save happens.
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() { // Craftbukkit: private -> public
|
public void stop() { // CraftBukkit - private -> public
|
||||||
log.info("Stopping server");
|
log.info("Stopping server");
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
|
@ -82,7 +82,7 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name);
|
EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name);
|
||||||
|
|
||||||
if (entityplayer != null) {
|
if (entityplayer != null) {
|
||||||
a.info(this.b() + " logged in with entity id " + entityplayer.id);
|
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
|
||||||
ChunkCoordinates chunkcoordinates = entityplayer.world.getSpawn(); // CraftBukkit
|
ChunkCoordinates chunkcoordinates = entityplayer.world.getSpawn(); // CraftBukkit
|
||||||
NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
|
NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
|
||||||
|
|
||||||
@ -91,6 +91,7 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
if (((WorldServer) entityplayer.world).v()) { // CraftBukkit
|
if (((WorldServer) entityplayer.world).v()) { // CraftBukkit
|
||||||
netserverhandler.sendPacket(new Packet70Bed(1));
|
netserverhandler.sendPacket(new Packet70Bed(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
|
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
|
||||||
this.server.serverConfigurationManager.a(entityplayer);
|
this.server.serverConfigurationManager.a(entityplayer);
|
||||||
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
||||||
|
@ -23,12 +23,11 @@ import org.bukkit.event.player.*;
|
|||||||
|
|
||||||
public class NetServerHandler extends NetHandler implements ICommandListener {
|
public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
|
|
||||||
private static final int PLACE_DISTANCE_SQUARED = 6 * 6; // CraftBukkit here for now
|
|
||||||
public static Logger a = Logger.getLogger("Minecraft");
|
public static Logger a = Logger.getLogger("Minecraft");
|
||||||
public NetworkManager networkManager;
|
public NetworkManager networkManager;
|
||||||
public boolean disconnected = false;
|
public boolean disconnected = false;
|
||||||
private MinecraftServer minecraftServer;
|
private MinecraftServer minecraftServer;
|
||||||
public EntityPlayer player; // CraftBukkit - private->public
|
public EntityPlayer player; // CraftBukkit - private -> public
|
||||||
private int f;
|
private int f;
|
||||||
private int g;
|
private int g;
|
||||||
private int h;
|
private int h;
|
||||||
@ -38,7 +37,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
private double z;
|
private double z;
|
||||||
private boolean m = true;
|
private boolean m = true;
|
||||||
private Map n = new HashMap();
|
private Map n = new HashMap();
|
||||||
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
|
|
||||||
|
|
||||||
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||||
this.minecraftServer = minecraftserver;
|
this.minecraftServer = minecraftserver;
|
||||||
@ -51,6 +49,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
server = minecraftserver.server;
|
server = minecraftserver.server;
|
||||||
}
|
}
|
||||||
private final CraftServer server;
|
private final CraftServer server;
|
||||||
|
private int lastTick = MinecraftServer.currentTick;
|
||||||
|
private static final int PLACE_DISTANCE_SQUARED = 6 * 6;
|
||||||
|
|
||||||
// Get position of last block hit for BlockDamageLevel.STOPPED
|
// Get position of last block hit for BlockDamageLevel.STOPPED
|
||||||
private double lastPosX = Double.MAX_VALUE;
|
private double lastPosX = Double.MAX_VALUE;
|
||||||
@ -88,7 +88,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Send the possibly modified leave message
|
// Send the possibly modified leave message
|
||||||
this.sendPacket(new Packet255KickDisconnect( event.getReason() ));
|
this.sendPacket(new Packet255KickDisconnect(event.getReason()));
|
||||||
this.networkManager.c();
|
this.networkManager.c();
|
||||||
leaveMessage = event.getLeaveMessage();
|
leaveMessage = event.getLeaveMessage();
|
||||||
if (leaveMessage != null) {
|
if (leaveMessage != null) {
|
||||||
@ -121,7 +121,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
Location to = player.getLocation();
|
Location to = player.getLocation();
|
||||||
|
|
||||||
// Prevent 40 event-calls for less than a single pixel of movement >.>
|
// Prevent 40 event-calls for less than a single pixel of movement >.>
|
||||||
double delta = Math.pow( this.lastPosX - this.x, 2) + Math.pow( this.lastPosY - this.y, 2) + Math.pow( this.lastPosZ - this.z, 2);
|
double delta = Math.pow(this.lastPosX - this.x, 2) + Math.pow(this.lastPosY - this.y, 2) + Math.pow(this.lastPosZ - this.z, 2);
|
||||||
float deltaAngle = Math.abs(this.lastYaw - this.player.yaw) + Math.abs(this.lastPitch - this.player.pitch);
|
float deltaAngle = Math.abs(this.lastYaw - this.player.yaw) + Math.abs(this.lastPitch - this.player.pitch);
|
||||||
|
|
||||||
if (delta > 1f/256 || deltaAngle > 10f) {
|
if (delta > 1f/256 || deltaAngle > 10f) {
|
||||||
@ -336,7 +336,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.player.onGround = packet10flying.g;
|
this.player.onGround = packet10flying.g;
|
||||||
|
|
||||||
this.minecraftServer.serverConfigurationManager.b(this.player);
|
this.minecraftServer.serverConfigurationManager.b(this.player);
|
||||||
this.player.b(this.player.locY - d0, packet10flying.g);
|
this.player.b(this.player.locY - d0, packet10flying.g);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -344,7 +343,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||||
// CraftBukkit start -- Delegate to teleport(Location)
|
// CraftBukkit start - Delegate to teleport(Location)
|
||||||
teleport(new Location(getPlayer().getWorld(), d0, d1, d2, f, f1));
|
teleport(new Location(getPlayer().getWorld(), d0, d1, d2, f, f1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +386,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.setLocation(d0, d1, d2, f, f1);
|
this.player.setLocation(d0, d1, d2, f, f1);
|
||||||
this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
|
this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
|
||||||
|
|
||||||
// CraftBukkit -- Returns TRUE if the teleport was successful
|
// CraftBukkit - Returns TRUE if the teleport was successful
|
||||||
return !event.isCancelled();
|
return !event.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +439,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
if (packet14blockdig.e == 0) {
|
if (packet14blockdig.e == 0) {
|
||||||
// CraftBukkit
|
// CraftBukkit
|
||||||
if (i1 > this.minecraftServer.spawnProtection || flag) {
|
if (i1 > this.minecraftServer.spawnProtection || flag) {
|
||||||
// CraftBukkit add face argument
|
// CraftBukkit - add face argument
|
||||||
this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
|
this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
|
||||||
}
|
}
|
||||||
} else if (packet14blockdig.e == 2) {
|
} else if (packet14blockdig.e == 2) {
|
||||||
@ -486,7 +485,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
lastPacket = packet15place.timestamp;
|
lastPacket = packet15place.timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit if rightclick decremented the item, always send the update packet.
|
// CraftBukkit - if rightclick decremented the item, always send the update packet.
|
||||||
// this is not here for CraftBukkit's own functionality; rather it is to fix
|
// this is not here for CraftBukkit's own functionality; rather it is to fix
|
||||||
// a notch bug where the item doesn't update correctly.
|
// a notch bug where the item doesn't update correctly.
|
||||||
boolean always = false;
|
boolean always = false;
|
||||||
@ -508,7 +507,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.itemInWorldManager.useItem(this.player, this.player.world, itemstack);
|
this.player.itemInWorldManager.useItem(this.player, this.player.world, itemstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit notch decrements the counter by 1 in the above method with food,
|
// CraftBukkit - notch decrements the counter by 1 in the above method with food,
|
||||||
// snowballs and so forth, but he does it in a place that doesn't cause the
|
// snowballs and so forth, but he does it in a place that doesn't cause the
|
||||||
// inventory update packet to get sent
|
// inventory update packet to get sent
|
||||||
always = (itemstack.count != itemstackAmount);
|
always = (itemstack.count != itemstackAmount);
|
||||||
@ -575,7 +574,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
this.player.activeContainer.a();
|
this.player.activeContainer.a();
|
||||||
this.player.h = false;
|
this.player.h = false;
|
||||||
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) { // CraftBukkit
|
// CraftBukkit
|
||||||
|
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
|
||||||
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.f, slot.a, this.player.inventory.getItemInHand()));
|
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.f, slot.a, this.player.inventory.getItemInHand()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(String s, Object[] aobject) {
|
public void a(String s, Object[] aobject) {
|
||||||
if (this.disconnected) return; // CraftBukkit -- rarely it would send a disconnect line twice
|
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice
|
||||||
|
|
||||||
a.info(this.player.name + " lost connection: " + s);
|
a.info(this.player.name + " lost connection: " + s);
|
||||||
// CraftBukkit start - we need to handle custom quit messages
|
// CraftBukkit start - we need to handle custom quit messages
|
||||||
@ -602,7 +602,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(Packet packet) {
|
public void sendPacket(Packet packet) {
|
||||||
// CraftBukkit
|
// CraftBukkit start
|
||||||
if (packet instanceof Packet6SpawnPosition) {
|
if (packet instanceof Packet6SpawnPosition) {
|
||||||
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
||||||
this.player.compassTarget = new Location(getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
this.player.compassTarget = new Location(getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||||
@ -614,7 +614,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
packet = null;
|
packet = null;
|
||||||
}
|
}
|
||||||
if (packet != null) this.networkManager.a(packet);
|
if (packet != null) this.networkManager.a(packet);
|
||||||
// CraftBukkit
|
// CraftBukkit end
|
||||||
|
|
||||||
this.g = this.f;
|
this.g = this.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,6 +631,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
|
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
|
||||||
} else {
|
} else {
|
||||||
a.warning(this.player.name + " tried to set an invalid carried item");
|
a.warning(this.player.name + " tried to set an invalid carried item");
|
||||||
@ -680,8 +682,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
private void handleCommand(String s) {
|
private void handleCommand(String s) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -698,7 +700,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
try {
|
try {
|
||||||
targetPluginFound = server.dispatchCommand(player, s.substring(1));
|
targetPluginFound = server.dispatchCommand(player, s.substring(1));
|
||||||
} catch (CommandException ex) {
|
} catch (CommandException ex) {
|
||||||
player.sendMessage(ChatColor.RED + "An internal error occured while attempting to perform this command");
|
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
|
||||||
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -706,8 +708,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
if (targetPluginFound) {
|
if (targetPluginFound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
// CraftBukkit stop
|
|
||||||
|
|
||||||
if (s.toLowerCase().startsWith("/me ")) {
|
if (s.toLowerCase().startsWith("/me ")) {
|
||||||
s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
|
s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
|
||||||
@ -749,7 +750,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (packet18armanimation.b == 1) {
|
if (packet18armanimation.b == 1) {
|
||||||
// CraftBukkit -- raytrace to look for 'rogue armswings'
|
// CraftBukkit start - raytrace to look for 'rogue armswings'
|
||||||
float f = 1.0F;
|
float f = 1.0F;
|
||||||
float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
|
float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
|
||||||
float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
|
float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
|
||||||
@ -880,6 +881,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
if (this.player.activeContainer.f == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
if (this.player.activeContainer.f == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
||||||
ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player);
|
ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player);
|
||||||
|
|
||||||
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
|
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
|
||||||
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
|
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
|
||||||
this.player.h = true;
|
this.player.h = true;
|
||||||
@ -923,59 +925,66 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
if (((WorldServer) this.player.world).isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
|
if (((WorldServer) this.player.world).isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
|
||||||
TileEntity tileentity = ((WorldServer) this.player.world).getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z);
|
TileEntity tileentity = ((WorldServer) this.player.world).getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z);
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (tileentity instanceof TileEntitySign) {
|
if (tileentity instanceof TileEntitySign) {
|
||||||
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
|
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
|
||||||
|
|
||||||
if (!tileentitysign.a()) {
|
if (!tileentitysign.a()) {
|
||||||
this.minecraftServer.c("Player " + this.player.name + " just tried to change non-editable sign");
|
this.minecraftServer.c("Player " + this.player.name + " just tried to change non-editable sign");
|
||||||
|
// CraftBukkit
|
||||||
this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines));
|
this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < 4; ++j) {
|
for (j = 0; j < 4; ++j) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
||||||
if (packet130updatesign.lines[j].length() > 15) {
|
if (packet130updatesign.lines[j].length() > 15) {
|
||||||
flag = false;
|
flag = false;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
|
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
|
||||||
if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
|
if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flag) {
|
|
||||||
packet130updatesign.lines[j] = "!?";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileentity instanceof TileEntitySign) {
|
if (!flag) {
|
||||||
j = packet130updatesign.x;
|
packet130updatesign.lines[j] = "!?";
|
||||||
int k = packet130updatesign.y;
|
|
||||||
i = packet130updatesign.z;
|
|
||||||
|
|
||||||
Player player = server.getPlayer(this.player);
|
|
||||||
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
|
||||||
for (int l = 0; l < 4; ++l) {
|
|
||||||
tileentitysign.lines[l] = event.getLine(l);
|
|
||||||
}
|
|
||||||
tileentitysign.setEditable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tileentitysign.update();
|
|
||||||
((WorldServer) this.player.world).notify(j, k, i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tileentity instanceof TileEntitySign) {
|
||||||
|
j = packet130updatesign.x;
|
||||||
|
int k = packet130updatesign.y;
|
||||||
|
|
||||||
|
i = packet130updatesign.z;
|
||||||
|
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
Player player = server.getPlayer(this.player);
|
||||||
|
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
for (int l = 0; l < 4; ++l) {
|
||||||
|
tileentitysign1.lines[l] = event.getLine(l);
|
||||||
|
}
|
||||||
|
tileentitysign1.setEditable(false);
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
tileentitysign1.update();
|
||||||
|
|
||||||
|
// CraftBukkit
|
||||||
|
((WorldServer) this.player.world).notify(j, k, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean c() {
|
public boolean c() {
|
||||||
|
@ -6,7 +6,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.io.IOException; // CraftBukkit -- instead of SocketException
|
import java.io.IOException; // CraftBukkit - instead of SocketException
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -17,7 +17,7 @@ public class NetworkManager {
|
|||||||
public static int b;
|
public static int b;
|
||||||
public static int c;
|
public static int c;
|
||||||
private Object e = new Object();
|
private Object e = new Object();
|
||||||
public Socket socket; // CraftBukkit -- private->public
|
public Socket socket; // CraftBukkit - private -> public
|
||||||
private final SocketAddress g;
|
private final SocketAddress g;
|
||||||
private DataInputStream input;
|
private DataInputStream input;
|
||||||
private DataOutputStream output;
|
private DataOutputStream output;
|
||||||
@ -46,7 +46,7 @@ public class NetworkManager {
|
|||||||
socket.setSoTimeout(30000);
|
socket.setSoTimeout(30000);
|
||||||
socket.setTrafficClass(24);
|
socket.setTrafficClass(24);
|
||||||
|
|
||||||
// CraftBukkit start -- cant compile these outside the try
|
// CraftBukkit start - cant compile these outside the try
|
||||||
this.input = new DataInputStream(socket.getInputStream());
|
this.input = new DataInputStream(socket.getInputStream());
|
||||||
this.output = new DataOutputStream(socket.getOutputStream());
|
this.output = new DataOutputStream(socket.getOutputStream());
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -115,13 +115,13 @@ public abstract class Packet {
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - throws IOException
|
// CraftBukkit - throws IOException
|
||||||
public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException {
|
public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException {
|
||||||
dataoutputstream.write(packet.b());
|
dataoutputstream.write(packet.b());
|
||||||
packet.a(dataoutputstream);
|
packet.a(dataoutputstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - throws IOException
|
// CraftBukkit - throws IOException
|
||||||
public static void a(String s, DataOutputStream dataoutputstream) throws IOException {
|
public static void a(String s, DataOutputStream dataoutputstream) throws IOException {
|
||||||
if (s.length() > 32767) {
|
if (s.length() > 32767) {
|
||||||
throw new IOException("String too big");
|
throw new IOException("String too big");
|
||||||
@ -131,7 +131,7 @@ public abstract class Packet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - throws IOException
|
// CraftBukkit - throws IOException
|
||||||
public static String a(DataInputStream datainputstream, int i) throws IOException {
|
public static String a(DataInputStream datainputstream, int i) throws IOException {
|
||||||
short short1 = datainputstream.readShort();
|
short short1 = datainputstream.readShort();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException; // CraftBukkit
|
||||||
|
|
||||||
public class Packet3Chat extends Packet {
|
public class Packet3Chat extends Packet {
|
||||||
|
|
||||||
@ -11,11 +11,11 @@ public class Packet3Chat extends Packet {
|
|||||||
public Packet3Chat() {}
|
public Packet3Chat() {}
|
||||||
|
|
||||||
public Packet3Chat(String s) {
|
public Packet3Chat(String s) {
|
||||||
// CraftBukkit start - handle this later
|
/* CraftBukkit start - handle this later
|
||||||
//if (s.length() > 119) {
|
if (s.length() > 119) {
|
||||||
// s = s.substring(0, 119);
|
s = s.substring(0, 119);
|
||||||
//}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end */
|
||||||
|
|
||||||
this.a = s;
|
this.a = s;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ class PlayerInstance {
|
|||||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.e.x, this.e.z, true));
|
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.e.x, this.e.z, true));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.b.add(entityplayer);
|
this.b.add(entityplayer);
|
||||||
entityplayer.f.add(this.e);
|
entityplayer.f.add(this.e);
|
||||||
}
|
}
|
||||||
@ -50,7 +51,7 @@ class PlayerInstance {
|
|||||||
public void b(EntityPlayer entityplayer) {
|
public void b(EntityPlayer entityplayer) {
|
||||||
if (!this.b.contains(entityplayer)) {
|
if (!this.b.contains(entityplayer)) {
|
||||||
// CraftBukkit - reduce console spam under certain conditions
|
// CraftBukkit - reduce console spam under certain conditions
|
||||||
//(new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.chunkX + ", " + this.chunkZ)).printStackTrace();
|
// (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.chunkX + ", " + this.chunkZ)).printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
this.b.remove(entityplayer);
|
this.b.remove(entityplayer);
|
||||||
if (this.b.size() == 0) {
|
if (this.b.size() == 0) {
|
||||||
@ -66,7 +67,8 @@ class PlayerInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entityplayer.f.remove(this.e);
|
entityplayer.f.remove(this.e);
|
||||||
if (entityplayer.g.remove(this.e)) { // CraftBukkit - contains -> remove
|
// CraftBukkit - contains -> remove
|
||||||
|
if (entityplayer.g.remove(this.e)) {
|
||||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
|
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,9 +175,10 @@ class PlayerInstance {
|
|||||||
j = this.chunkX * 16 + (this.dirtyCount >> 12 & 15);
|
j = this.chunkX * 16 + (this.dirtyCount >> 12 & 15);
|
||||||
k = this.dirtyCount & 255;
|
k = this.dirtyCount & 255;
|
||||||
l = this.chunkZ * 16 + (this.dirtyCount >> 8 & 15);
|
l = this.chunkZ * 16 + (this.dirtyCount >> 8 & 15);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (Block.isTileEntity[this.playerManager.world.getTypeId(j, k, l)]) {
|
if (Block.isTileEntity[this.playerManager.world.getTypeId(j, k, l)]) {
|
||||||
//System.out.println("Sending!"); // CraftBukkit
|
// System.out.println("Sending!"); // CraftBukkit
|
||||||
this.sendTileEntity(this.playerManager.world.getTileEntity(j, k, l));
|
this.sendTileEntity(this.playerManager.world.getTileEntity(j, k, l));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -126,13 +126,13 @@ public class PlayerManager {
|
|||||||
int i1 = i - k;
|
int i1 = i - k;
|
||||||
int j1 = j - l;
|
int j1 = j - l;
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
if (i1 > 10 || i1 < -10 || j1 > 10 || j1 < -10) {
|
if (i1 > 10 || i1 < -10 || j1 > 10 || j1 < -10) {
|
||||||
this.removePlayer(entityplayer);
|
this.removePlayer(entityplayer);
|
||||||
this.addPlayer(entityplayer);
|
this.addPlayer(entityplayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (i1 != 0 || j1 != 0) {
|
if (i1 != 0 || j1 != 0) {
|
||||||
for (int k1 = i - 10; k1 <= i + 10; ++k1) {
|
for (int k1 = i - 10; k1 <= i + 10; ++k1) {
|
||||||
|
@ -28,9 +28,9 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
public static Logger a = Logger.getLogger("Minecraft");
|
public static Logger a = Logger.getLogger("Minecraft");
|
||||||
public List players = new ArrayList();
|
public List players = new ArrayList();
|
||||||
public MinecraftServer server; // CraftBukkit - private->public
|
public MinecraftServer server; // CraftBukkit - private -> public
|
||||||
// public PlayerManager d; // CraftBukkit - removed!
|
// public PlayerManager d; // CraftBukkit - removed!
|
||||||
public int maxPlayers; // CraftBukkit - private->public
|
public int maxPlayers; // CraftBukkit - private -> public
|
||||||
private Set banByName = new HashSet();
|
private Set banByName = new HashSet();
|
||||||
private Set banByIP = new HashSet();
|
private Set banByIP = new HashSet();
|
||||||
private Set h = new HashSet();
|
private Set h = new HashSet();
|
||||||
@ -39,7 +39,7 @@ public class ServerConfigurationManager {
|
|||||||
private File k;
|
private File k;
|
||||||
private File l;
|
private File l;
|
||||||
private File m;
|
private File m;
|
||||||
public PlayerFileData playerFileData; // CraftBukkit private->public
|
public PlayerFileData playerFileData; // CraftBukkit - private - >public
|
||||||
private boolean o;
|
private boolean o;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -120,7 +120,6 @@ public class ServerConfigurationManager {
|
|||||||
this.players.remove(entityplayer);
|
this.players.remove(entityplayer);
|
||||||
|
|
||||||
return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayer a(NetLoginHandler netloginhandler, String s) {
|
public EntityPlayer a(NetLoginHandler netloginhandler, String s) {
|
||||||
@ -139,6 +138,7 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
if (this.banByName.contains(s.trim().toLowerCase())) {
|
if (this.banByName.contains(s.trim().toLowerCase())) {
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
|
||||||
|
// return null // CraftBukkit
|
||||||
} else if (!this.isWhitelisted(s)) {
|
} else if (!this.isWhitelisted(s)) {
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
|
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
|
||||||
} else if (this.banByIP.contains(s2)) {
|
} else if (this.banByIP.contains(s2)) {
|
||||||
@ -168,22 +168,28 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayer d(EntityPlayer entityplayer) {
|
public EntityPlayer d(EntityPlayer entityplayer) {
|
||||||
// CraftBukkit start - every reference to this.minecraftServer.worldServer should be entityplayer.world
|
|
||||||
this.server.tracker.trackPlayer(entityplayer);
|
this.server.tracker.trackPlayer(entityplayer);
|
||||||
this.server.tracker.untrackEntity(entityplayer);
|
this.server.tracker.untrackEntity(entityplayer);
|
||||||
|
// CraftBukkit
|
||||||
((WorldServer) entityplayer.world).manager.removePlayer(entityplayer);
|
((WorldServer) entityplayer.world).manager.removePlayer(entityplayer);
|
||||||
this.players.remove(entityplayer);
|
this.players.remove(entityplayer);
|
||||||
|
// CraftBukkit
|
||||||
entityplayer.world.removeEntity(entityplayer);
|
entityplayer.world.removeEntity(entityplayer);
|
||||||
ChunkCoordinates chunkcoordinates = entityplayer.K();
|
ChunkCoordinates chunkcoordinates = entityplayer.K();
|
||||||
|
// CraftBukkit
|
||||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
|
EntityPlayer entityplayer1 = new EntityPlayer(this.server, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
|
||||||
|
|
||||||
entityplayer1.id = entityplayer.id;
|
entityplayer1.id = entityplayer.id;
|
||||||
entityplayer1.netServerHandler = entityplayer.netServerHandler;
|
entityplayer1.netServerHandler = entityplayer.netServerHandler;
|
||||||
entityplayer1.displayName = entityplayer.displayName; // CraftBukkit
|
|
||||||
entityplayer1.compassTarget = entityplayer.compassTarget; // CraftBukkit
|
// CraftBukkit start - transfer internal variables
|
||||||
entityplayer1.fauxSleeping = entityplayer.fauxSleeping; // CraftBukkit
|
entityplayer1.displayName = entityplayer.displayName;
|
||||||
|
entityplayer1.compassTarget = entityplayer.compassTarget;
|
||||||
|
entityplayer1.fauxSleeping = entityplayer.fauxSleeping;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (chunkcoordinates != null) {
|
if (chunkcoordinates != null) {
|
||||||
|
// CraftBukkit
|
||||||
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(entityplayer.world, chunkcoordinates);
|
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(entityplayer.world, chunkcoordinates);
|
||||||
|
|
||||||
if (chunkcoordinates1 != null) {
|
if (chunkcoordinates1 != null) {
|
||||||
@ -194,8 +200,10 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit
|
||||||
((WorldServer) entityplayer.world).chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
((WorldServer) entityplayer.world).chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||||
|
|
||||||
|
// CraftBukkit
|
||||||
while (entityplayer.world.getEntities(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
while (entityplayer.world.getEntities(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
||||||
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
||||||
}
|
}
|
||||||
@ -204,7 +212,7 @@ public class ServerConfigurationManager {
|
|||||||
Player respawnPlayer = cserver.getPlayer(entityplayer);
|
Player respawnPlayer = cserver.getPlayer(entityplayer);
|
||||||
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
|
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
|
||||||
|
|
||||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, respawnLocation );
|
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, respawnLocation);
|
||||||
cserver.getPluginManager().callEvent(respawnEvent);
|
cserver.getPluginManager().callEvent(respawnEvent);
|
||||||
|
|
||||||
entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();
|
entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();
|
||||||
@ -374,7 +382,8 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
bufferedreader.close();
|
bufferedreader.close();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
a.warning("Failed to load ops: " + exception); // CraftBukkit corrected text
|
// CraftBukkit - corrected text
|
||||||
|
a.warning("Failed to load ops: " + exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +400,8 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
printwriter.close();
|
printwriter.close();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
a.warning("Failed to save ops: " + exception); // CraftBukkit corrected text
|
// CraftBukkit - corrected text
|
||||||
|
a.warning("Failed to save ops: " + exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
public class Slot {
|
public class Slot {
|
||||||
|
|
||||||
public final int index; // CraftBukkit: private -> public
|
public final int index; // CraftBukkit - private -> public
|
||||||
public final IInventory inventory; // CraftBukkit: private -> public
|
public final IInventory inventory; // CraftBukkit - private -> public
|
||||||
public int a;
|
public int a;
|
||||||
public int b;
|
public int b;
|
||||||
public int c;
|
public int c;
|
||||||
|
@ -53,7 +53,7 @@ public class StatisticList {
|
|||||||
F = b(F, "stat.breakItem", 16973824, 0, Block.byId.length);
|
F = b(F, "stat.breakItem", 16973824, 0, Block.byId.length);
|
||||||
G = true;
|
G = true;
|
||||||
d();
|
d();
|
||||||
//System.out.println(E); // CraftBukkit
|
// System.out.println(E); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void c() {
|
public static void c() {
|
||||||
@ -61,7 +61,7 @@ public class StatisticList {
|
|||||||
F = b(F, "stat.breakItem", 16973824, Block.byId.length, 32000);
|
F = b(F, "stat.breakItem", 16973824, Block.byId.length, 32000);
|
||||||
H = true;
|
H = true;
|
||||||
d();
|
d();
|
||||||
//System.out.println(E); // CraftBukkit
|
// System.out.println(E); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void d() {
|
public static void d() {
|
||||||
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import jline.ConsoleReader;
|
import jline.ConsoleReader;
|
||||||
@ -20,17 +19,18 @@ public class ThreadCommandReader extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
// Craftbukkit start - whole method, nuked to oblivion! :o
|
// CraftBukkit
|
||||||
|
ConsoleReader bufferedreader = this.server.reader;
|
||||||
|
String s = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ConsoleReader reader = this.server.reader;
|
// CraftBukkit
|
||||||
String line = null;
|
while (!this.server.isStopped && MinecraftServer.isRunning(this.server) && ((s = bufferedreader.readLine(">", null)) != null)) {
|
||||||
while ((!this.server.isStopped) && (MinecraftServer.isRunning(this.server)) && ((line = reader.readLine(">", null)) != null)) {
|
this.server.issueCommand(s, this.server);
|
||||||
this.server.issueCommand(line, (ICommandListener) this.server);
|
|
||||||
}
|
}
|
||||||
} catch (IOException ioexception) {
|
} catch (IOException ioexception) {
|
||||||
|
// CraftBukkit
|
||||||
Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
|
Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ class ThreadLoginVerifier extends Thread {
|
|||||||
ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login, CraftServer server) {
|
ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login, CraftServer server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.netLoginHandler = netloginhandler;
|
this.netLoginHandler = netloginhandler;
|
||||||
this.loginPacket = packet1login;
|
this.loginPacket = packet1login;
|
||||||
}
|
}
|
||||||
|
@ -46,24 +46,26 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit - change signature
|
||||||
public int findDispenseSlot() {
|
public int findDispenseSlot() {
|
||||||
int i = -1;
|
int i = -1;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
|
|
||||||
for (int k = 0; k < this.items.length; ++k) {
|
for (int k = 0; k < this.items.length; ++k) {
|
||||||
if (this.items[k] != null && this.items[k].count != 0 && this.b.nextInt(j) == 0) {
|
if (this.items[k] != null && this.b.nextInt(j) == 0) {
|
||||||
|
if (this.items[k].count != 0) continue; // CraftBukkit
|
||||||
i = k;
|
i = k;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack b() {
|
public ItemStack b() {
|
||||||
int i = findDispenseSlot();
|
int i = findDispenseSlot();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
return this.a(i, 1);
|
return this.a(i, 1);
|
||||||
|
@ -163,8 +163,12 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
|
|
||||||
if (this.items[2] == null) {
|
if (this.items[2] == null) {
|
||||||
this.items[2] = itemstack.j();
|
this.items[2] = itemstack.j();
|
||||||
} else if (this.items[2].id == itemstack.id && this.items[2].damage == itemstack.damage) { // CraftBukkit - compare damage too
|
} else if (this.items[2].id == itemstack.id) {
|
||||||
this.items[2].count += itemstack.count; // CraftBukkit - increment by count instead of 1
|
// CraftBukkit start - compare damage too
|
||||||
|
if (this.items[2].damage == itemstack.damage) {
|
||||||
|
this.items[2].count += itemstack.count;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
--this.items[0].count;
|
--this.items[0].count;
|
||||||
|
@ -3,7 +3,7 @@ package net.minecraft.server;
|
|||||||
public class TileEntityMobSpawner extends TileEntity {
|
public class TileEntityMobSpawner extends TileEntity {
|
||||||
|
|
||||||
public int spawnDelay = -1;
|
public int spawnDelay = -1;
|
||||||
public String mobName = "Pig"; // CraftBukkit private -> public
|
public String mobName = "Pig"; // CraftBukkit - private -> public
|
||||||
public double b;
|
public double b;
|
||||||
public double c = 0.0D;
|
public double c = 0.0D;
|
||||||
|
|
||||||
|
@ -49,15 +49,15 @@ public class World implements IBlockAccess {
|
|||||||
public boolean n = false;
|
public boolean n = false;
|
||||||
public final WorldProvider worldProvider;
|
public final WorldProvider worldProvider;
|
||||||
protected List p = new ArrayList();
|
protected List p = new ArrayList();
|
||||||
public IChunkProvider chunkProvider; // CraftBukkit protected->public
|
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
|
||||||
protected final IDataManager r;
|
protected final IDataManager r;
|
||||||
public WorldData worldData; // CraftBukkit protected->public
|
public WorldData worldData; // CraftBukkit - protected -> public
|
||||||
public boolean isLoading;
|
public boolean isLoading;
|
||||||
private boolean H;
|
private boolean H;
|
||||||
private ArrayList I = new ArrayList();
|
private ArrayList I = new ArrayList();
|
||||||
private int J = 0;
|
private int J = 0;
|
||||||
public boolean allowMonsters = true; // CraftBukkit private->public
|
public boolean allowMonsters = true; // CraftBukkit - private -> public
|
||||||
public boolean allowAnimals = true; // CraftBukkit private->public
|
public boolean allowAnimals = true; // CraftBukkit - private -> public
|
||||||
public boolean pvpMode; // CraftBukkit
|
public boolean pvpMode; // CraftBukkit
|
||||||
static int u = 0;
|
static int u = 0;
|
||||||
private Set M = new HashSet();
|
private Set M = new HashSet();
|
||||||
@ -302,7 +302,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setTypeId(int i, int j, int k, int l) {
|
public boolean setTypeId(int i, int j, int k, int l) {
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
int old = this.getTypeId(i, j, k);
|
int old = this.getTypeId(i, j, k);
|
||||||
if (this.setRawTypeId(i, j, k, l)) {
|
if (this.setRawTypeId(i, j, k, l)) {
|
||||||
this.update(i, j, k, l == 0 ? old : l);
|
this.update(i, j, k, l == 0 ? old : l);
|
||||||
@ -310,11 +310,11 @@ public class World implements IBlockAccess {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
|
public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
int old = this.getTypeId(i, j, k);
|
int old = this.getTypeId(i, j, k);
|
||||||
if (this.setRawTypeIdAndData(i, j, k, l, i1)) {
|
if (this.setRawTypeIdAndData(i, j, k, l, i1)) {
|
||||||
this.update(i, j, k, l == 0 ? old : l);
|
this.update(i, j, k, l == 0 ? old : l);
|
||||||
@ -322,7 +322,7 @@ public class World implements IBlockAccess {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notify(int i, int j, int k) {
|
public void notify(int i, int j, int k) {
|
||||||
@ -383,7 +383,7 @@ public class World implements IBlockAccess {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit stop
|
// CraftBukkit end
|
||||||
|
|
||||||
block.doPhysics(this, i, j, k, l);
|
block.doPhysics(this, i, j, k, l);
|
||||||
}
|
}
|
||||||
@ -1441,7 +1441,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals
|
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
|
||||||
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().players.size() > 0)) {
|
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().players.size() > 0)) {
|
||||||
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals);
|
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals);
|
||||||
}
|
}
|
||||||
@ -1580,7 +1580,7 @@ public class World implements IBlockAccess {
|
|||||||
this.worldData.b(0);
|
this.worldData.b(0);
|
||||||
this.worldData.a(false);
|
this.worldData.a(false);
|
||||||
}
|
}
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void j() {
|
protected void j() {
|
||||||
@ -1667,6 +1667,7 @@ public class World implements IBlockAccess {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
SnowFormEvent snow = new SnowFormEvent(((WorldServer)this).getWorld().getBlockAt(l + i, k1, j1 + j));
|
SnowFormEvent snow = new SnowFormEvent(((WorldServer)this).getWorld().getBlockAt(l + i, k1, j1 + j));
|
||||||
((WorldServer)this).getServer().getPluginManager().callEvent(snow);
|
((WorldServer)this).getServer().getPluginManager().callEvent(snow);
|
||||||
|
|
||||||
if (!snow.isCancelled()) {
|
if (!snow.isCancelled()) {
|
||||||
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
|
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
|
||||||
this.setData(l + i, k1, j1 + j, snow.getData());
|
this.setData(l + i, k1, j1 + j, snow.getData());
|
||||||
@ -1793,7 +1794,7 @@ public class World implements IBlockAccess {
|
|||||||
Entity entity = null;
|
Entity entity = null;
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
entity = (Entity) list.get(i);
|
entity = (Entity) list.get(i);
|
||||||
// CraftBukkit start
|
|
||||||
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
|
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
|
||||||
CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity);
|
CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@ -1803,6 +1804,7 @@ public class World implements IBlockAccess {
|
|||||||
|
|
||||||
this.entityList.add(entity);
|
this.entityList.add(entity);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.c((Entity) list.get(i));
|
this.c((Entity) list.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1821,13 +1823,22 @@ public class World implements IBlockAccess {
|
|||||||
axisalignedbb = null;
|
axisalignedbb = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - We dont want to allow the user to override the bounding box check
|
// CraftBukkit - store the default action
|
||||||
boolean defaultReturn = axisalignedbb != null && !this.containsEntity(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.canPlace(this, j, k, l) : true);
|
boolean defaultReturn;
|
||||||
|
|
||||||
if (axisalignedbb != null && !this.containsEntity(axisalignedbb)) {
|
if (axisalignedbb != null && !this.containsEntity(axisalignedbb)) {
|
||||||
return false;
|
// CraftBukkit
|
||||||
|
defaultReturn = false;
|
||||||
|
} else {
|
||||||
|
if (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block == Block.SNOW) {
|
||||||
|
block = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftBukkit
|
||||||
|
defaultReturn = i > 0 && block == null && block1.canPlace(this, j, k, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
BlockCanBuildEvent event = new BlockCanBuildEvent(((WorldServer) this).getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
BlockCanBuildEvent event = new BlockCanBuildEvent(((WorldServer) this).getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
||||||
((WorldServer) this).getServer().getPluginManager().callEvent(event);
|
((WorldServer) this).getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@ -2061,20 +2072,19 @@ public class World implements IBlockAccess {
|
|||||||
if (this.H && !this.isStatic) {
|
if (this.H && !this.isStatic) {
|
||||||
Iterator iterator = this.players.iterator();
|
Iterator iterator = this.players.iterator();
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
|
||||||
boolean foundActualSleepers = false;
|
boolean foundActualSleepers = false;
|
||||||
|
|
||||||
// This allows us to assume that some people are in bed
|
|
||||||
// but not really, allowing time to pass in spite of AFKers
|
|
||||||
|
|
||||||
EntityHuman entityhuman;
|
EntityHuman entityhuman;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!iterator.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
|
// CraftBukkit
|
||||||
return foundActualSleepers;
|
return foundActualSleepers;
|
||||||
}
|
}
|
||||||
|
|
||||||
entityhuman = (EntityHuman) iterator.next();
|
entityhuman = (EntityHuman) iterator.next();
|
||||||
|
// CraftBukkit start
|
||||||
if (entityhuman.isDeeplySleeping()) {
|
if (entityhuman.isDeeplySleeping()) {
|
||||||
foundActualSleepers = true;
|
foundActualSleepers = true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class WorldData {
|
|||||||
private long g;
|
private long g;
|
||||||
private NBTTagCompound h;
|
private NBTTagCompound h;
|
||||||
private int i;
|
private int i;
|
||||||
public String name; // CraftBukkit private->public
|
public String name; // CraftBukkit - private -> public
|
||||||
private int k;
|
private int k;
|
||||||
private boolean l;
|
private boolean l;
|
||||||
private int m;
|
private int m;
|
||||||
|
@ -2,8 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||||
import org.bukkit.BlockChangeDelegate;
|
|
||||||
|
|
||||||
public class WorldGenBigTree extends WorldGenerator {
|
public class WorldGenBigTree extends WorldGenerator {
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||||
import org.bukkit.BlockChangeDelegate;
|
|
||||||
|
|
||||||
public class WorldGenForest extends WorldGenerator {
|
public class WorldGenForest extends WorldGenerator {
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||||
import org.bukkit.BlockChangeDelegate;
|
|
||||||
|
|
||||||
public class WorldGenTaiga1 extends WorldGenerator {
|
public class WorldGenTaiga1 extends WorldGenerator {
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||||
import org.bukkit.BlockChangeDelegate;
|
|
||||||
|
|
||||||
public class WorldGenTaiga2 extends WorldGenerator {
|
public class WorldGenTaiga2 extends WorldGenerator {
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||||
import org.bukkit.BlockChangeDelegate;
|
|
||||||
|
|
||||||
public class WorldGenTrees extends WorldGenerator {
|
public class WorldGenTrees extends WorldGenerator {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class WorldManager implements IWorldAccess {
|
|||||||
public void a() {}
|
public void a() {}
|
||||||
|
|
||||||
public void a(int i, int j, int k) {
|
public void a(int i, int j, int k) {
|
||||||
// CraftBukkit -- add world argument
|
// CraftBukkit - add world argument
|
||||||
this.server.serverConfigurationManager.flagDirty(i, j, k, world);
|
this.server.serverConfigurationManager.flagDirty(i, j, k, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public void entityJoinedWorld(Entity entity, boolean flag) {
|
public void entityJoinedWorld(Entity entity, boolean flag) {
|
||||||
// CraftBukkit start -- We prevent spawning in general, so this butchering is not needed
|
/* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
|
||||||
//if (!this.server.spawnAnimals && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
if (!this.server.spawnAnimals && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||||
// entity.die();
|
entity.die();
|
||||||
//}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end */
|
||||||
|
|
||||||
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
|
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
|
||||||
super.entityJoinedWorld(entity, flag);
|
super.entityJoinedWorld(entity, flag);
|
||||||
@ -87,7 +87,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
i1 = l;
|
i1 = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit -- Configurable spawn protection
|
// CraftBukkit - Configurable spawn protection
|
||||||
return i1 > this.server.spawnProtection || this.server.serverConfigurationManager.isOp(entityhuman.name);
|
return i1 > this.server.spawnProtection || this.server.serverConfigurationManager.isOp(entityhuman.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,15 +107,17 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
|
|
||||||
public boolean a(Entity entity) {
|
public boolean a(Entity entity) {
|
||||||
if (super.a(entity)) {
|
if (super.a(entity)) {
|
||||||
CraftServer server = cserver;
|
// CraftBukkit start
|
||||||
|
|
||||||
LightningStrikeEvent lightning = new LightningStrikeEvent((org.bukkit.World) world, (org.bukkit.entity.LightningStrike) entity.getBukkitEntity());
|
LightningStrikeEvent lightning = new LightningStrikeEvent((org.bukkit.World) world, (org.bukkit.entity.LightningStrike) entity.getBukkitEntity());
|
||||||
server.getPluginManager().callEvent(lightning);
|
this.cserver.getPluginManager().callEvent(lightning);
|
||||||
if (!lightning.isCancelled()) {
|
|
||||||
this.server.serverConfigurationManager.a(entity.locX, entity.locY, entity.locZ, 512.0D, new Packet71Weather(entity));
|
if (lightning.isCancelled()) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
// CraftBukkit end
|
||||||
|
|
||||||
|
this.server.serverConfigurationManager.a(entity.locX, entity.locY, entity.locZ, 512.0D, new Packet71Weather(entity));
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -128,9 +130,9 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
||||||
|
// CraftBukkit start
|
||||||
Explosion explosion = super.createExplosion(entity, d0, d1, d2, f, flag);
|
Explosion explosion = super.createExplosion(entity, d0, d1, d2, f, flag);
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
if (explosion.wasCanceled) {
|
if (explosion.wasCanceled) {
|
||||||
return explosion;
|
return explosion;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class CraftChunk implements Chunk {
|
|||||||
|
|
||||||
void breakLink() {
|
void breakLink() {
|
||||||
weakChunk.clear();
|
weakChunk.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return x;
|
return x;
|
||||||
@ -60,15 +60,15 @@ public class CraftChunk implements Chunk {
|
|||||||
|
|
||||||
public Block getBlock(int x, int y, int z) {
|
public Block getBlock(int x, int y, int z) {
|
||||||
int pos = (x & 0xF) << 11 | (z & 0xF) << 7 | (y & 0x7F);
|
int pos = (x & 0xF) << 11 | (z & 0xF) << 7 | (y & 0x7F);
|
||||||
Block block = this.cache.get( pos );
|
Block block = this.cache.get(pos);
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
Block newBlock = new CraftBlock( this, (getX() << 4) | (x & 0xF), y & 0x7F, (getZ() << 4) | (z & 0xF) );
|
Block newBlock = new CraftBlock(this, (getX() << 4) | (x & 0xF), y & 0x7F, (getZ() << 4) | (z & 0xF));
|
||||||
Block oldBlock = this.cache.put( pos, newBlock );
|
Block oldBlock = this.cache.put(pos, newBlock);
|
||||||
if(oldBlock == null) {
|
if(oldBlock == null) {
|
||||||
block = newBlock;
|
block = newBlock;
|
||||||
} else {
|
} else {
|
||||||
block = oldBlock;
|
block = oldBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ public final class CraftServer implements Server {
|
|||||||
|
|
||||||
// NOTE: Should only be called from MinecraftServer.b()
|
// NOTE: Should only be called from MinecraftServer.b()
|
||||||
public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) {
|
public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) {
|
||||||
if ( commandMap.dispatch(sender, serverCommand.command) ) {
|
if (commandMap.dispatch(sender, serverCommand.command)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return console.consoleCommandHandler.handle(serverCommand);
|
return console.consoleCommandHandler.handle(serverCommand);
|
||||||
@ -279,7 +279,7 @@ public final class CraftServer implements Server {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! sender.isOp() ) {
|
if (!sender.isOp()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ public final class CraftServer implements Server {
|
|||||||
private final String prefix;
|
private final String prefix;
|
||||||
CommandListener(CommandSender commandSender) {
|
CommandListener(CommandSender commandSender) {
|
||||||
this.commandSender = commandSender;
|
this.commandSender = commandSender;
|
||||||
String[] parts = commandSender.getClass().getName().split( "\\." );
|
String[] parts = commandSender.getClass().getName().split("\\.");
|
||||||
this.prefix = parts[parts.length-1];
|
this.prefix = parts[parts.length-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ public class CraftWorld implements World {
|
|||||||
server.addWorld(this);
|
server.addWorld(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preserveChunk( CraftChunk chunk ) {
|
public void preserveChunk(CraftChunk chunk) {
|
||||||
chunk.breakLink();
|
chunk.breakLink();
|
||||||
unloadedChunks.put( (chunk.getX() << 16) + chunk.getZ(), chunk );
|
unloadedChunks.put((chunk.getX() << 16) + chunk.getZ(), chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk popPreservedChunk( int x, int z ) {
|
public Chunk popPreservedChunk(int x, int z) {
|
||||||
return unloadedChunks.remove( (x << 16) + z );
|
return unloadedChunks.remove((x << 16) + z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlockAt(int x, int y, int z) {
|
public Block getBlockAt(int x, int y, int z) {
|
||||||
@ -97,7 +97,7 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChunkLoaded(int x, int z) {
|
public boolean isChunkLoaded(int x, int z) {
|
||||||
return provider.isChunkLoaded( x, z );
|
return provider.isChunkLoaded(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk[] getLoadedChunks() {
|
public Chunk[] getLoadedChunks() {
|
||||||
@ -285,7 +285,7 @@ public class CraftWorld implements World {
|
|||||||
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
|
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
|
||||||
entity.pickupDelay = 10;
|
entity.pickupDelay = 10;
|
||||||
world.addEntity(entity);
|
world.addEntity(entity);
|
||||||
//TODO this is inconsistent with how Entity.getBukkitEntity() works.
|
// TODO this is inconsistent with how Entity.getBukkitEntity() works.
|
||||||
// However, this entity is not at the moment backed by a server entity class so it may be left.
|
// However, this entity is not at the moment backed by a server entity class so it may be left.
|
||||||
return new CraftItem(world.getServer(), entity);
|
return new CraftItem(world.getServer(), entity);
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ public class CraftWorld implements World {
|
|||||||
public void setFullTime(long time) {
|
public void setFullTime(long time) {
|
||||||
world.setTime(time);
|
world.setTime(time);
|
||||||
|
|
||||||
//Forces the client to update to the new time immediately
|
// Forces the client to update to the new time immediately
|
||||||
for (Player p: getPlayers()) {
|
for (Player p: getPlayers()) {
|
||||||
CraftPlayer cp = (CraftPlayer) p;
|
CraftPlayer cp = (CraftPlayer) p;
|
||||||
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(time));
|
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(time));
|
||||||
|
@ -245,11 +245,10 @@ public class CraftBlock implements Block {
|
|||||||
BlockFace[] values = BlockFace.values();
|
BlockFace[] values = BlockFace.values();
|
||||||
|
|
||||||
for (BlockFace face : values) {
|
for (BlockFace face : values) {
|
||||||
if (
|
if ((this.getX() + face.getModX() == block.getX()) &&
|
||||||
(this.getX() + face.getModX() == block.getX()) &&
|
(this.getY() + face.getModY() == block.getY()) &&
|
||||||
(this.getY() + face.getModY() == block.getY()) &&
|
(this.getZ() + face.getModZ() == block.getZ())
|
||||||
(this.getZ() + face.getModZ() == block.getZ())
|
) {
|
||||||
) {
|
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,7 +285,7 @@ public class CraftBlock implements Block {
|
|||||||
return BlockFace.SELF;
|
return BlockFace.SELF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int blockFaceToNotch(BlockFace face) {
|
public static int blockFaceToNotch(BlockFace face) {
|
||||||
switch(face) {
|
switch(face) {
|
||||||
case DOWN:
|
case DOWN:
|
||||||
@ -302,7 +301,7 @@ public class CraftBlock implements Block {
|
|||||||
case SOUTH:
|
case SOUTH:
|
||||||
return 5;
|
return 5;
|
||||||
default:
|
default:
|
||||||
return 7; //Good as anything here, but technically invalid
|
return 7; // Good as anything here, but technically invalid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +370,7 @@ public class CraftBlock implements Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals( Object o ) {
|
public boolean equals(Object o) {
|
||||||
return this == o;
|
return this == o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ public class CraftBlockState implements BlockState {
|
|||||||
createData(block.getData());
|
createData(block.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState getBlockState( net.minecraft.server.World world, int x, int y, int z) {
|
public static BlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
|
||||||
return new CraftBlockState( ((WorldServer) world).getWorld().getBlockAt(x, y, z) );
|
return new CraftBlockState(((WorldServer) world).getWorld().getBlockAt(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a chest.
|
* Represents a chest.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftChest extends CraftBlockState implements Chest {
|
public class CraftChest extends CraftBlockState implements Chest {
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a furnace.
|
* Represents a furnace.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||||
|
@ -20,62 +20,62 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CraftEntity getEntity( CraftServer server, Entity entity) {
|
public static CraftEntity getEntity(CraftServer server, Entity entity) {
|
||||||
/**
|
/**
|
||||||
* Order is *EXTREMELY* important -- keep it right! =D
|
* Order is *EXTREMELY* important -- keep it right! =D
|
||||||
*/
|
*/
|
||||||
if (entity instanceof EntityLiving) {
|
if (entity instanceof EntityLiving) {
|
||||||
// Players
|
// Players
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
if (entity instanceof EntityPlayer) { return new CraftPlayer( server, (EntityPlayer) entity); }
|
if (entity instanceof EntityPlayer) { return new CraftPlayer(server, (EntityPlayer) entity); }
|
||||||
else { return new CraftHumanEntity( server, (EntityHuman) entity); }
|
else { return new CraftHumanEntity(server, (EntityHuman) entity); }
|
||||||
}
|
}
|
||||||
else if (entity instanceof EntityCreature) {
|
else if (entity instanceof EntityCreature) {
|
||||||
// Animals
|
// Animals
|
||||||
if (entity instanceof EntityAnimal) {
|
if (entity instanceof EntityAnimal) {
|
||||||
if (entity instanceof EntityChicken) { return new CraftChicken( server, (EntityChicken) entity); }
|
if (entity instanceof EntityChicken) { return new CraftChicken(server, (EntityChicken) entity); }
|
||||||
else if (entity instanceof EntityCow) { return new CraftCow( server, (EntityCow) entity); }
|
else if (entity instanceof EntityCow) { return new CraftCow(server, (EntityCow) entity); }
|
||||||
else if (entity instanceof EntityPig) { return new CraftPig( server, (EntityPig) entity); }
|
else if (entity instanceof EntityPig) { return new CraftPig(server, (EntityPig) entity); }
|
||||||
else if (entity instanceof EntityWolf) { return new CraftWolf( server, (EntityWolf) entity); }
|
else if (entity instanceof EntityWolf) { return new CraftWolf(server, (EntityWolf) entity); }
|
||||||
else if (entity instanceof EntitySheep) { return new CraftSheep( server, (EntitySheep) entity); }
|
else if (entity instanceof EntitySheep) { return new CraftSheep(server, (EntitySheep) entity); }
|
||||||
else { return new CraftAnimals( server, (EntityAnimal) entity); }
|
else { return new CraftAnimals(server, (EntityAnimal) entity); }
|
||||||
}
|
}
|
||||||
// Monsters
|
// Monsters
|
||||||
else if (entity instanceof EntityMonster) {
|
else if (entity instanceof EntityMonster) {
|
||||||
if (entity instanceof EntityZombie) {
|
if (entity instanceof EntityZombie) {
|
||||||
if (entity instanceof EntityPigZombie) { return new CraftPigZombie( server, (EntityPigZombie) entity); }
|
if (entity instanceof EntityPigZombie) { return new CraftPigZombie(server, (EntityPigZombie) entity); }
|
||||||
else { return new CraftZombie( server, (EntityZombie) entity); }
|
else { return new CraftZombie(server, (EntityZombie) entity); }
|
||||||
}
|
}
|
||||||
else if (entity instanceof EntityCreeper) { return new CraftCreeper( server, (EntityCreeper) entity); }
|
else if (entity instanceof EntityCreeper) { return new CraftCreeper(server, (EntityCreeper) entity); }
|
||||||
else if (entity instanceof EntityGiantZombie) { return new CraftGiant( server, (EntityGiantZombie) entity); }
|
else if (entity instanceof EntityGiantZombie) { return new CraftGiant(server, (EntityGiantZombie) entity); }
|
||||||
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton( server, (EntitySkeleton) entity); }
|
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton(server, (EntitySkeleton) entity); }
|
||||||
else if (entity instanceof EntitySpider) { return new CraftSpider( server, (EntitySpider) entity); }
|
else if (entity instanceof EntitySpider) { return new CraftSpider(server, (EntitySpider) entity); }
|
||||||
|
|
||||||
else { return new CraftMonster( server, (EntityMonster) entity); }
|
else { return new CraftMonster(server, (EntityMonster) entity); }
|
||||||
}
|
}
|
||||||
// Water Animals
|
// Water Animals
|
||||||
else if (entity instanceof EntityWaterAnimal) {
|
else if (entity instanceof EntityWaterAnimal) {
|
||||||
if (entity instanceof EntitySquid) { return new CraftSquid( server, (EntitySquid) entity); }
|
if (entity instanceof EntitySquid) { return new CraftSquid(server, (EntitySquid) entity); }
|
||||||
else { return new CraftWaterMob( server, (EntityWaterAnimal) entity); }
|
else { return new CraftWaterMob(server, (EntityWaterAnimal) entity); }
|
||||||
}
|
}
|
||||||
else { return new CraftCreature( server, (EntityCreature) entity); }
|
else { return new CraftCreature(server, (EntityCreature) entity); }
|
||||||
}
|
}
|
||||||
// Slimes are a special (and broken) case
|
// Slimes are a special (and broken) case
|
||||||
else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); }
|
else if (entity instanceof EntitySlime) { return new CraftSlime(server, (EntitySlime) entity); }
|
||||||
// Flying
|
// Flying
|
||||||
else if (entity instanceof EntityFlying) {
|
else if (entity instanceof EntityFlying) {
|
||||||
if (entity instanceof EntityGhast) { return new CraftGhast( server, (EntityGhast) entity); }
|
if (entity instanceof EntityGhast) { return new CraftGhast(server, (EntityGhast) entity); }
|
||||||
else { return new CraftFlying( server, (EntityFlying) entity); }
|
else { return new CraftFlying(server, (EntityFlying) entity); }
|
||||||
}
|
}
|
||||||
else { return new CraftLivingEntity(server, (EntityLiving) entity); }
|
else { return new CraftLivingEntity(server, (EntityLiving) entity); }
|
||||||
}
|
}
|
||||||
else if (entity instanceof EntityArrow) { return new CraftArrow( server, (EntityArrow) entity); }
|
else if (entity instanceof EntityArrow) { return new CraftArrow(server, (EntityArrow) entity); }
|
||||||
else if (entity instanceof EntityBoat) { return new CraftBoat( server, (EntityBoat) entity); }
|
else if (entity instanceof EntityBoat) { return new CraftBoat(server, (EntityBoat) entity); }
|
||||||
else if (entity instanceof EntityEgg) { return new CraftEgg( server, (EntityEgg) entity); }
|
else if (entity instanceof EntityEgg) { return new CraftEgg(server, (EntityEgg) entity); }
|
||||||
else if (entity instanceof EntityFallingSand) { return new CraftFallingSand( server, (EntityFallingSand) entity); }
|
else if (entity instanceof EntityFallingSand) { return new CraftFallingSand(server, (EntityFallingSand) entity); }
|
||||||
else if (entity instanceof EntityFireball) { return new CraftFireball( server, (EntityFireball) entity); }
|
else if (entity instanceof EntityFireball) { return new CraftFireball(server, (EntityFireball) entity); }
|
||||||
else if (entity instanceof EntityFish) { return new CraftFish( server, (EntityFish) entity); }
|
else if (entity instanceof EntityFish) { return new CraftFish(server, (EntityFish) entity); }
|
||||||
else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); }
|
else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); }
|
||||||
else if (entity instanceof EntityWeather) {
|
else if (entity instanceof EntityWeather) {
|
||||||
if (entity instanceof EntityWeatherStorm) {
|
if (entity instanceof EntityWeatherStorm) {
|
||||||
return new CraftLightningStrike(server, (EntityWeatherStorm)entity);
|
return new CraftLightningStrike(server, (EntityWeatherStorm)entity);
|
||||||
@ -93,10 +93,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return new CraftMinecart(server, mc);
|
return new CraftMinecart(server, mc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entity instanceof EntityPainting) { return new CraftPainting( server, (EntityPainting) entity); }
|
else if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); }
|
||||||
else if (entity instanceof EntitySnowball) { return new CraftSnowball( server, (EntitySnowball) entity); }
|
else if (entity instanceof EntitySnowball) { return new CraftSnowball(server, (EntitySnowball) entity); }
|
||||||
else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed( server, (EntityTNTPrimed) entity); }
|
else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed(server, (EntityTNTPrimed) entity); }
|
||||||
else throw new IllegalArgumentException( "Unknown entity" );
|
else throw new IllegalArgumentException("Unknown entity");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
|
@ -13,7 +13,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
|
|
||||||
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
|
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
this.inventory = new CraftInventoryPlayer( entity.inventory );
|
this.inventory = new CraftInventoryPlayer(entity.inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -28,7 +28,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
public void setHandle(final EntityHuman entity) {
|
public void setHandle(final EntityHuman entity) {
|
||||||
super.setHandle((EntityHuman)entity);
|
super.setHandle((EntityHuman)entity);
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
this.inventory = new CraftInventoryPlayer( entity.inventory );
|
this.inventory = new CraftInventoryPlayer(entity.inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerInventory getInventory() {
|
public PlayerInventory getInventory() {
|
||||||
|
@ -197,8 +197,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
manager.server.tracker.untrackEntity(entity);
|
manager.server.tracker.untrackEntity(entity);
|
||||||
int cx = (int) location.getBlockX() >> 4;
|
int cx = (int) location.getBlockX() >> 4;
|
||||||
int cz = (int) location.getBlockZ() >> 4;
|
int cz = (int) location.getBlockZ() >> 4;
|
||||||
for (int x = -10 ; x <= 10 ; x++ ) {
|
for (int x = -10 ; x <= 10 ; x++) {
|
||||||
for (int z = -10 ; z <= 10 ; z++ ) {
|
for (int z = -10 ; z <= 10 ; z++) {
|
||||||
ChunkCoordIntPair chunkPosition = new ChunkCoordIntPair(cx + x, cz + z);
|
ChunkCoordIntPair chunkPosition = new ChunkCoordIntPair(cx + x, cz + z);
|
||||||
if (entity.g.remove(chunkPosition)) {
|
if (entity.g.remove(chunkPosition)) {
|
||||||
newEntity.g.add(chunkPosition);
|
newEntity.g.add(chunkPosition);
|
||||||
|
@ -17,7 +17,7 @@ public class CraftStorageMinecart extends CraftMinecart implements StorageMineca
|
|||||||
|
|
||||||
public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
|
public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
inventory = new CraftInventory( entity );
|
inventory = new CraftInventory(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
|
@ -30,7 +30,7 @@ public class CraftWolf extends CraftAnimals implements Wolf {
|
|||||||
public void setSitting(boolean sitting) {
|
public void setSitting(boolean sitting) {
|
||||||
getHandle().setSitting(sitting);
|
getHandle().setSitting(sitting);
|
||||||
// TODO determine what the following would do - it is affected every time a player makes their wolf sit or stand
|
// TODO determine what the following would do - it is affected every time a player makes their wolf sit or stand
|
||||||
//getHandle().ay = false;
|
// getHandle().ay = false;
|
||||||
setPath((PathEntity) null);
|
setPath((PathEntity) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ public class CraftWolf extends CraftAnimals implements Wolf {
|
|||||||
/* Set owner */
|
/* Set owner */
|
||||||
// TODO persist owner to the persistence store
|
// TODO persist owner to the persistence store
|
||||||
if (owner instanceof Player) {
|
if (owner instanceof Player) {
|
||||||
setOwnerName(((Player) owner).getName());
|
setOwnerName(((Player) owner).getName());
|
||||||
} else {
|
} else {
|
||||||
setOwnerName("");
|
setOwnerName("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setTamed(false); /* Make him not tame */
|
setTamed(false); /* Make him not tame */
|
||||||
|
@ -125,7 +125,7 @@ public class CraftEventFactory {
|
|||||||
/**
|
/**
|
||||||
* Player Interact event
|
* Player Interact event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
||||||
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -34,7 +34,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
ItemStack[] items = new ItemStack[getSize()];
|
ItemStack[] items = new ItemStack[getSize()];
|
||||||
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
||||||
|
|
||||||
for (int i = 0; i < mcItems.length; i++ ) {
|
for (int i = 0; i < mcItems.length; i++) {
|
||||||
items[i] = mcItems[i] == null ? null : new CraftItemStack(mcItems[i]);
|
items[i] = mcItems[i] == null ? null : new CraftItemStack(mcItems[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,18 +48,18 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
|
|
||||||
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
||||||
|
|
||||||
for (int i = 0; i < items.length; i++ ) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
ItemStack item = items[i];
|
ItemStack item = items[i];
|
||||||
if (item == null || item.getTypeId() <= 0) {
|
if (item == null || item.getTypeId() <= 0) {
|
||||||
mcItems[i] = null;
|
mcItems[i] = null;
|
||||||
} else {
|
} else {
|
||||||
mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability());
|
mcItems[i] = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(int index, ItemStack item) {
|
public void setItem(int index, ItemStack item) {
|
||||||
getInventory().setItem(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability())));
|
getInventory().setItem(index, (item == null ? null : new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(int materialId) {
|
public boolean contains(int materialId) {
|
||||||
@ -121,7 +121,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
ItemStack item = inventory[i];
|
ItemStack item = inventory[i];
|
||||||
if (item != null && item.getTypeId() == materialId) {
|
if (item != null && item.getTypeId() == materialId) {
|
||||||
slots.put( i, item );
|
slots.put(i, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return slots;
|
return slots;
|
||||||
@ -137,7 +137,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
ItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
if (item.equals(inventory[i])) {
|
if (item.equals(inventory[i])) {
|
||||||
slots.put( i, inventory[i] );
|
slots.put(i, inventory[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,11 +238,11 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
} else {
|
} else {
|
||||||
// More than a single stack!
|
// More than a single stack!
|
||||||
if (item.getAmount() > getMaxItemStack()) {
|
if (item.getAmount() > getMaxItemStack()) {
|
||||||
setItem( firstFree, new CraftItemStack(item.getTypeId(), getMaxItemStack(), item.getDurability()));
|
setItem(firstFree, new CraftItemStack(item.getTypeId(), getMaxItemStack(), item.getDurability()));
|
||||||
item.setAmount(item.getAmount() - getMaxItemStack());
|
item.setAmount(item.getAmount() - getMaxItemStack());
|
||||||
} else {
|
} else {
|
||||||
// Just store it
|
// Just store it
|
||||||
setItem( firstFree, item );
|
setItem(firstFree, item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,13 +256,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
|
|
||||||
// Check if it fully fits
|
// Check if it fully fits
|
||||||
if (amount + partialAmount <= maxAmount) {
|
if (amount + partialAmount <= maxAmount) {
|
||||||
partialItem.setAmount( amount + partialAmount );
|
partialItem.setAmount(amount + partialAmount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It fits partially
|
// It fits partially
|
||||||
partialItem.setAmount( maxAmount );
|
partialItem.setAmount(maxAmount);
|
||||||
item.setAmount( amount + partialAmount - maxAmount );
|
item.setAmount(amount + partialAmount - maxAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
|
|
||||||
// Drat! we don't have this type in the inventory
|
// Drat! we don't have this type in the inventory
|
||||||
if (first == -1) {
|
if (first == -1) {
|
||||||
item.setAmount( toDelete );
|
item.setAmount(toDelete);
|
||||||
leftover.put(i, item);
|
leftover.put(i, item);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -293,11 +293,11 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
if (amount <= toDelete) {
|
if (amount <= toDelete) {
|
||||||
toDelete -= amount;
|
toDelete -= amount;
|
||||||
// clear the slot, all used up
|
// clear the slot, all used up
|
||||||
clear( first );
|
clear(first);
|
||||||
} else {
|
} else {
|
||||||
// split the stack and store
|
// split the stack and store
|
||||||
itemStack.setAmount( amount - toDelete );
|
itemStack.setAmount(amount - toDelete);
|
||||||
setItem( first, itemStack );
|
setItem(first, itemStack);
|
||||||
toDelete = 0;
|
toDelete = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemInHand() {
|
public ItemStack getItemInHand() {
|
||||||
return new CraftItemStack( getInventory().getItemInHand() );
|
return new CraftItemStack(getInventory().getItemInHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemInHand(ItemStack stack) {
|
public void setItemInHand(ItemStack stack) {
|
||||||
setItem( getHeldItemSlot(), stack );
|
setItem(getHeldItemSlot(), stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeldItemSlot() {
|
public int getHeldItemSlot() {
|
||||||
@ -31,42 +31,42 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getHelmet() {
|
public ItemStack getHelmet() {
|
||||||
return getItem( getSize() + 3 );
|
return getItem(getSize() + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getChestplate() {
|
public ItemStack getChestplate() {
|
||||||
return getItem( getSize() + 2 );
|
return getItem(getSize() + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getLeggings() {
|
public ItemStack getLeggings() {
|
||||||
return getItem( getSize() + 1 );
|
return getItem(getSize() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getBoots() {
|
public ItemStack getBoots() {
|
||||||
return getItem( getSize() + 0 );
|
return getItem(getSize() + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHelmet(ItemStack helmet) {
|
public void setHelmet(ItemStack helmet) {
|
||||||
setItem( getSize() + 3, helmet );
|
setItem(getSize() + 3, helmet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChestplate(ItemStack chestplate) {
|
public void setChestplate(ItemStack chestplate) {
|
||||||
setItem( getSize() + 2, chestplate );
|
setItem(getSize() + 2, chestplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeggings(ItemStack leggings) {
|
public void setLeggings(ItemStack leggings) {
|
||||||
setItem( getSize() + 1, leggings );
|
setItem(getSize() + 1, leggings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBoots(ItemStack boots) {
|
public void setBoots(ItemStack boots) {
|
||||||
setItem( getSize() + 0, boots );
|
setItem(getSize() + 0, boots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftItemStack[] getArmorContents() {
|
public CraftItemStack[] getArmorContents() {
|
||||||
net.minecraft.server.ItemStack[] mcItems = getInventory().getArmorContents();
|
net.minecraft.server.ItemStack[] mcItems = getInventory().getArmorContents();
|
||||||
CraftItemStack[] ret = new CraftItemStack[mcItems.length];
|
CraftItemStack[] ret = new CraftItemStack[mcItems.length];
|
||||||
|
|
||||||
for (int i = 0; i < mcItems.length; i++ ) {
|
for (int i = 0; i < mcItems.length; i++) {
|
||||||
ret[i] = new CraftItemStack(mcItems[i]);
|
ret[i] = new CraftItemStack(mcItems[i]);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -12,7 +12,7 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return new CraftInventory( slot.inventory );
|
return new CraftInventory(slot.inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIndex() {
|
public int getIndex() {
|
||||||
@ -20,6 +20,6 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return new CraftItemStack( slot.getItem() );
|
return new CraftItemStack(slot.getItem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
|
|||||||
|
|
||||||
firstTick = first.getExecutionTick();
|
firstTick = first.getExecutionTick();
|
||||||
|
|
||||||
if (currentTick >= firstTick ) {
|
if (currentTick >= firstTick) {
|
||||||
schedulerQueue.remove(first);
|
schedulerQueue.remove(first);
|
||||||
processTask(first);
|
processTask(first);
|
||||||
if (first.getPeriod()>=0) {
|
if (first.getPeriod()>=0) {
|
||||||
|
@ -91,7 +91,7 @@ public class CraftTask implements Comparable<Object>, BukkitTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals( Object other ) {
|
public boolean equals(Object other) {
|
||||||
|
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,7 +74,7 @@ public class CraftWorker implements Runnable, BukkitWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals( Object other ) {
|
public boolean equals(Object other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class Java15Compat {
|
|||||||
if (original.length >= start && 0 <= start) {
|
if (original.length >= start && 0 <= start) {
|
||||||
if (start <= end) {
|
if (start <= end) {
|
||||||
int length = end - start;
|
int length = end - start;
|
||||||
int copyLength = Math.min( length, original.length - start);
|
int copyLength = Math.min(length, original.length - start);
|
||||||
long[] copy = (long[]) Array.newInstance(original.getClass().getComponentType(), length);
|
long[] copy = (long[]) Array.newInstance(original.getClass().getComponentType(), length);
|
||||||
System.arraycopy(original, start, copy, 0, copyLength);
|
System.arraycopy(original, start, copy, 0, copyLength);
|
||||||
return copy;
|
return copy;
|
||||||
|
@ -55,5 +55,5 @@ public class ShortConsoleLogFormatter extends Formatter {
|
|||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren