3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 05:20:05 +01:00

N.M.S cleanup in preparation for update

Dieser Commit ist enthalten in:
Dinnerbone 2011-02-21 22:30:01 +00:00
Ursprung 67cf646014
Commit f659231e34
33 geänderte Dateien mit 105 neuen und 150 gelöschten Zeilen

Datei anzeigen

@ -3,11 +3,9 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
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;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
@ -167,12 +165,16 @@ public class BlockButton extends Block {
if (j1 == 0) { if (j1 == 0) {
return true; return true;
} else { } else {
//Allow the button to change the current // Craftbukkit start
int old = (j1 != 8) ? 1 : 0; int old = (j1 != 8) ? 1 : 0;
int current = (j1 == 8) ? 1 : 0; int current = (j1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
server.getPluginManager().callEvent(eventRedstone); server.getPluginManager().callEvent(eventRedstone);
if ((eventRedstone.getNewCurrent() > 0) == (j1 == 8)) { if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
return true;
}
// Craftbukkit end
world.c(i, j, k, i1 + j1); world.c(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
@ -188,8 +190,8 @@ public class BlockButton extends Block {
} else { } else {
world.h(i, j - 1, k, this.id); world.h(i, j - 1, k, this.id);
} }
world.i(i, j, k, this.id); world.i(i, j, k, this.id);
}
return true; return true;
} }
} }

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.Random;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.Random;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
@ -88,7 +87,7 @@ public class BlockDoor extends Block {
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// CraftBukkit the client updates the doors before the server does it's thing. // The client updates the doors before the server does it's thing.
// Forcibly send correct data. // Forcibly send correct data.
if (event.isCancelled()) { if (event.isCancelled()) {
((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world)); ((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));

Datei anzeigen

@ -137,7 +137,11 @@ public class BlockFire extends Block {
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k)); org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
BlockBurnEvent event = new BlockBurnEvent(theBlock); BlockBurnEvent event = new BlockBurnEvent(theBlock);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if(event.isCancelled()) {
return;
}
// CraftBukkit end
if (random.nextInt(2) == 0) { if (random.nextInt(2) == 0) {
world.e(i, j, k, this.id); world.e(i, j, k, this.id);
} else { } else {
@ -148,8 +152,6 @@ public class BlockFire extends Block {
Block.TNT.a(world, i, j, k, 0); Block.TNT.a(world, i, j, k, 0);
} }
} }
// CraftBukkit end
}
} }
// CraftBukkit start -- fix cast to IBlockAccess // CraftBukkit start -- fix cast to IBlockAccess

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.Random;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;

Datei anzeigen

@ -4,7 +4,6 @@ package net.minecraft.server;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;

Datei anzeigen

@ -1,11 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
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;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;
@ -152,7 +150,7 @@ public class BlockLever extends Block {
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// CraftBukkit the client updates the doors before the server does it's thing. // The client updates the doors before the server does it's thing.
// Forcibly send correct data. // Forcibly send correct data.
if (event.isCancelled()) { if (event.isCancelled()) {
((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world)); ((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
@ -170,7 +168,9 @@ public class BlockLever extends Block {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
server.getPluginManager().callEvent(eventRedstone); server.getPluginManager().callEvent(eventRedstone);
if ((eventRedstone.getNewCurrent() > 0) == (j1 == 8)) { if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
return true;
}
// CraftBukkit end // CraftBukkit end
world.c(i, j, k, i1 + j1); world.c(i, j, k, i1 + j1);
@ -188,7 +188,7 @@ public class BlockLever extends Block {
} else { } else {
world.h(i, j - 1, k, this.id); world.h(i, j - 1, k, this.id);
} }
} // CraftBukkit
return true; return true;
} }
} }

Datei anzeigen

@ -4,12 +4,9 @@ import java.util.List;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
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;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent; import org.bukkit.event.block.BlockInteractEvent;

Datei anzeigen

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockRedstoneEvent;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.Random;
import java.util.Set; import java.util.Set;
// CraftBukkit start // CraftBukkit start
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockRedstoneEvent;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -9,11 +9,9 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
@ -35,11 +33,9 @@ public class ChunkProviderServer implements IChunkProvider {
this.c = ichunkprovider; this.c = ichunkprovider;
} }
// CraftBukkit start
public boolean a(int i, int j) { public boolean a(int i, int j) {
return this.e.containsKey(i, j); return this.e.containsKey(i, j); // Craftbukkit - entire method removed
} }
// CraftBukkit end
public void c(int i, int j) { public void c(int i, int j) {
int k = i * 16 + 8 - this.g.spawnX; int k = i * 16 + 8 - this.g.spawnX;

Datei anzeigen

@ -1,6 +1,15 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List;
import java.util.Random;
// CraftBukkit start // CraftBukkit start
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftVehicle;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
@ -9,16 +18,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
// CraftBukkit end // CraftBukkit end
import java.util.List;
import java.util.Random;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftVehicle;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleCollisionEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
public abstract class Entity { public abstract class Entity {
private static int entityCount = 0; private static int entityCount = 0;

Datei anzeigen

@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftArrow;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;

Datei anzeigen

@ -1,13 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftMonster;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.TrigMath; import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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 end // CraftBukkit end
@ -119,7 +115,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;
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; // Craftbukkit
float f5 = f4 - this.yaw; float f5 = f4 - this.yaw;
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) { for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) {

Datei anzeigen

@ -1,7 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
//CraftBukkit start //CraftBukkit start
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent; import org.bukkit.event.entity.ExplosionPrimedEvent;

Datei anzeigen

@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.MobType; import org.bukkit.entity.MobType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -184,7 +183,6 @@ public class EntityEgg extends Entity {
} }
} }
// CraftBukkit start
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0; boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0;
byte numHatching = (this.random.nextInt(32) == 0) ? (byte) 4 : (byte) 1; byte numHatching = (this.random.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
if (!hatching) { if (!hatching) {

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ExplosionPrimedEvent; import org.bukkit.event.entity.ExplosionPrimedEvent;
// CraftBukkit end // CraftBukkit end
@ -149,9 +148,7 @@ public class EntityFireball extends Entity {
; ;
} }
} }
// CraftBukkit end
// Craftbukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false); ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);

Datei anzeigen

@ -4,12 +4,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.TrigMath; import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -237,7 +235,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;
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit
} }
if (this.aY > 0.0F) { if (this.aY > 0.0F) {

Datei anzeigen

@ -327,9 +327,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.a(this.locX, this.locY + (double) aint[1][1], this.locZ); this.a(this.locX, this.locY + (double) aint[1][1], this.locZ);
} }
// CraftBukkit start if (this.passenger != null || !slowWhenEmpty) { // Craftbukkit
if (this.passenger != null || !slowWhenEmpty) {
// CraftBukkit end
this.motX *= 0.996999979019165D; this.motX *= 0.996999979019165D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.996999979019165D; this.motZ *= 0.996999979019165D;

Datei anzeigen

@ -175,8 +175,8 @@ public class EntitySnowball extends Entity {
if (stick) { if (stick) {
; ;
} }
// CraftBukkit end
} }
// CraftBukkit end
for (int k = 0; k < 8; ++k) { for (int k = 0; k < 8; ++k) {
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);

Datei anzeigen

@ -1,7 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
//CraftBukkit start //CraftBukkit start
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent; import org.bukkit.event.entity.ExplosionPrimedEvent;

Datei anzeigen

@ -28,7 +28,6 @@ public class ItemBlock extends Item {
return false; return false;
} }
// CraftBukkit store info of the clicked block
CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockFace faceClicked = CraftBlock.notchToBlockFace(l); BlockFace faceClicked = CraftBlock.notchToBlockFace(l);
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -4,7 +4,6 @@ package net.minecraft.server;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

Datei anzeigen

@ -26,7 +26,6 @@ public class ItemMinecart extends Item {
if (i1 == Block.RAILS.id) { if (i1 == Block.RAILS.id) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start - Minecarts // CraftBukkit start - Minecarts
CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer craftServer = ((WorldServer) world).getServer(); CraftServer craftServer = ((WorldServer) world).getServer();

Datei anzeigen

@ -6,7 +6,6 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;

Datei anzeigen

@ -6,7 +6,6 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;

Datei anzeigen

@ -30,7 +30,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
public static HashMap b = new HashMap(); public static HashMap b = new HashMap();
public NetworkListenThread c; public NetworkListenThread c;
public PropertyManager d; public PropertyManager d;
//public WorldServer e; //public WorldServer e; // Craftbukkit - removed
public ServerConfigurationManager f; public ServerConfigurationManager f;
private boolean o = true; private boolean o = true;
public boolean g = false; public boolean g = false;
@ -43,21 +43,21 @@ public class MinecraftServer implements ICommandListener, Runnable {
public boolean l; public boolean l;
public boolean m; public boolean m;
public boolean n; public boolean n;
public int spawnProtection; // CraftBukkit Configurable spawn protection start
public List<WorldServer> worlds = new ArrayList<WorldServer>();
// Craftbukkit start - adds argument OptionSet // Craftbukkit start
public MinecraftServer(OptionSet options) { public int spawnProtection;
new ThreadSleepForever(this); public List<WorldServer> worlds = new ArrayList<WorldServer>();
// CraftBukkit start
this.options = options;
}
public CraftServer server; public CraftServer server;
public OptionSet options; public OptionSet options;
public ConsoleCommandSender console = new ConsoleCommandSender(); public ConsoleCommandSender console = new ConsoleCommandSender();
// Craftbukkit end
private boolean d() throws UnknownHostException { public MinecraftServer(OptionSet options) { // Craftbukkit - adds argument OptionSet
// CraftBukkit end -- added throws UnknownHostException new ThreadSleepForever(this);
this.options = options; // CraftBukkit
}
private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this); ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
threadcommandreader.setDaemon(true); threadcommandreader.setDaemon(true);
@ -95,8 +95,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
try { try {
this.c = new NetworkListenThread(this, inetaddress, i); this.c = new NetworkListenThread(this, inetaddress, i);
// CraftBukkit: Be more generic; IOException -> Throwable } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
} catch (Throwable ioexception) {
a.warning("**** FAILED TO BIND TO PORT!"); a.warning("**** FAILED TO BIND TO PORT!");
a.log(Level.WARNING, "The exception was: " + ioexception.toString()); a.log(Level.WARNING, "The exception was: " + ioexception.toString());
a.warning("Perhaps a server is already running on that port?"); a.warning("Perhaps a server is already running on that port?");
@ -194,10 +193,11 @@ public class MinecraftServer implements ICommandListener, Runnable {
private void g() { private void g() {
a.info("Stopping server"); a.info("Stopping server");
// CraftBukkit // CraftBukkit start
if(server != null) { if(server != null) {
server.disablePlugins(); server.disablePlugins();
} }
// Craftbukkit end
if (this.f != null) { if (this.f != null) {
this.f.d(); this.f.d();
@ -570,8 +570,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
this.p.add(iupdateplayerlistbox); this.p.add(iupdateplayerlistbox);
} }
// Craftbukkit start - replaces main(String args[]) public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[])
public static void main(final OptionSet options) {
try { try {
MinecraftServer minecraftserver = new MinecraftServer(options); MinecraftServer minecraftserver = new MinecraftServer(options);

Datei anzeigen

@ -16,22 +16,11 @@ import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.TextWrapper; import org.bukkit.craftbukkit.TextWrapper;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.*;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.player.*;
import org.bukkit.event.block.BlockRightClickEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerItemEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.Plugin;
// CraftBukkit end // CraftBukkit end
public class NetServerHandler extends NetHandler implements ICommandListener { public class NetServerHandler extends NetHandler implements ICommandListener {
@ -500,9 +489,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
this.e.c.a(this.e, this.e.world, itemstack, i, j, k, l); this.e.c.a(this.e, this.e.world, itemstack, i, j, k, l);
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
// CraftBukkit end // CraftBukkit end
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
if (l == 0) { if (l == 0) {
--j; --j;
} }
@ -527,7 +516,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
++i; ++i;
} }
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); // Craftbukkit
} }
if (itemstack != null && itemstack.count == 0) { if (itemstack != null && itemstack.count == 0) {
@ -541,8 +530,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.activeContainer.a(); this.e.activeContainer.a();
this.e.am = false; this.e.am = false;
// CraftBukkit - Boolean flag if (!ItemStack.a(this.e.inventory.e(), packet15place.e) || always) { // CraftBukkit
if (!ItemStack.a(this.e.inventory.e(), packet15place.e) || always) {
this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.c, this.e.inventory.e()))); this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.c, this.e.inventory.e())));
} }
@ -589,9 +577,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
// CraftBukkit start chat(s); // CraftBukkit
chat(s);
// CraftBukkit end
} }
} }

Datei anzeigen

@ -29,9 +29,7 @@ class PlayerInstance {
this.d = j; this.d = j;
this.e = new ChunkCoordIntPair(i, j); this.e = new ChunkCoordIntPair(i, j);
// Craftbukkit start playermanager.world.A.d(i, j); // Craftbukkit
playermanager.world.A.d(i, j);
// Craftbukkit end
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
@ -133,10 +131,13 @@ class PlayerInstance {
i = this.c * 16 + this.h; i = this.c * 16 + this.h;
j = this.j; j = this.j;
k = this.d * 16 + this.l; k = this.d * 16 + this.l;
this.a((Packet) (new Packet53BlockChange(i, j, k, a.world))); // Craftbukkit
if (Block.p[a.world.getTypeId(i, j, k)]) { // Craftbukkit // Craftbukkit start
this.a(a.world.getTileEntity(i, j, k)); // Craftbukkit this.a((Packet) (new Packet53BlockChange(i, j, k, a.world)));
if (Block.p[a.world.getTypeId(i, j, k)]) {
this.a(a.world.getTileEntity(i, j, k));
} }
// Craftbukkit end
} else { } else {
int l; int l;

Datei anzeigen

@ -106,7 +106,7 @@ public class PlayerManager {
for (int k = i - 10; k <= i + 10; ++k) { for (int k = i - 10; k <= i + 10; ++k) {
for (int l = j - 10; l <= j + 10; ++l) { for (int l = j - 10; l <= j + 10; ++l) {
PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world)); PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world)); // Craftbukkit
if (playerinstance != null) { if (playerinstance != null) {
playerinstance.b(entityplayer); playerinstance.b(entityplayer);
@ -141,11 +141,11 @@ public class PlayerManager {
for (int k1 = i - 10; k1 <= i + 10; ++k1) { for (int k1 = i - 10; k1 <= i + 10; ++k1) {
for (int l1 = j - 10; l1 <= j + 10; ++l1) { for (int l1 = j - 10; l1 <= j + 10; ++l1) {
if (!this.a(k1, l1, k, l)) { if (!this.a(k1, l1, k, l)) {
this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer); this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit
} }
if (!this.a(k1 - i1, l1 - j1, i, j)) { if (!this.a(k1 - i1, l1 - j1, i, j)) {
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world)); PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world)); // Craftbukkit
if (playerinstance != null) { if (playerinstance != null) {
playerinstance.b(entityplayer); playerinstance.b(entityplayer);

Datei anzeigen

@ -13,7 +13,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
public TileEntityChest() {} public TileEntityChest() {}
public int h_() { public int h_() {
return this.e.length; return this.e.length; // Craftbukkit
} }
public ItemStack a(int i) { public ItemStack a(int i) {

Datei anzeigen

@ -8,7 +8,7 @@ public class WorldManager implements IWorldAccess {
// Craftbukkit - changed signature // Craftbukkit - changed signature
public WorldManager(MinecraftServer minecraftserver, WorldServer world) { public WorldManager(MinecraftServer minecraftserver, WorldServer world) {
this.a = minecraftserver; this.a = minecraftserver;
this.world = world; this.world = world; // Craftbukkit
} }
public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {} public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {}

Datei anzeigen

@ -16,7 +16,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
public ChunkProviderServer A; public ChunkProviderServer A;
public boolean B = false; public boolean B = false;
public boolean C; public boolean C;
public final MinecraftServer D; public final MinecraftServer D; // Craftbukkit
private EntityList E = new EntityList(); private EntityList E = new EntityList();
public PlayerManager manager; // Craftbukkit public PlayerManager manager; // Craftbukkit