Archiviert
13
0

Updated for the cleanups done in Bukkit

Dieser Commit ist enthalten in:
Erik Broes 2011-03-26 22:32:56 +01:00
Ursprung 47497aa3f9
Commit e24b10dfd9
23 geänderte Dateien mit 49 neuen und 94 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,6 @@ import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockFromToEvent;
public class BlockFlowing extends BlockFluids {
@ -99,7 +98,7 @@ public class BlockFlowing extends BlockFluids {
if (this.l(world, i, j - 1, k)) {
// CraftBukkit start - send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FROMTO, source, BlockFace.DOWN);
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
server.getPluginManager().callEvent(event);
}
@ -129,7 +128,7 @@ public class BlockFlowing extends BlockFluids {
int index = 0;
for (BlockFace currentFace: faces) {
if (aboolean[index]) {
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FROMTO, source, currentFace);
BlockFromToEvent event = new BlockFromToEvent(source, currentFace);
if (server != null) {
server.getPluginManager().callEvent(event);

Datei anzeigen

@ -5,7 +5,6 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.LeavesDecayEvent;
// CraftBukkit end
@ -127,7 +126,7 @@ public class BlockLeaves extends BlockLeavesBase {
// CraftBukkit start
CraftServer server = ((WorldServer) world).getServer();
CraftWorld cworld = ((WorldServer) world).getWorld();
LeavesDecayEvent event = new LeavesDecayEvent(Type.LEAVES_DECAY, cworld.getBlockAt(i, j, k));
LeavesDecayEvent event = new LeavesDecayEvent(cworld.getBlockAt(i, j, k));
server.getPluginManager().callEvent(event);
if (event.isCancelled()) return;

Datei anzeigen

@ -14,7 +14,6 @@ import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.util.LongHashset;
import org.bukkit.craftbukkit.util.LongHashtable;
import org.bukkit.event.Event.Type;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
// CraftBukkit end
@ -81,7 +80,7 @@ public class ChunkProviderServer implements IChunkProvider {
* the World constructor. We can't reliably alter that, so we have
* no way of creating a CraftWorld/CraftServer at that point.
*/
server.getPluginManager().callEvent(new ChunkLoadEvent(Type.CHUNK_LOAD, chunk.bukkitChunk));
server.getPluginManager().callEvent(new ChunkLoadEvent(chunk.bukkitChunk));
}
// CraftBukkit end
@ -212,7 +211,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = e.get(chunkcoordinates);
if (chunk == null) continue;
ChunkUnloadEvent event = new ChunkUnloadEvent(Type.CHUNK_UNLOAD, chunk.bukkitChunk);
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );

Datei anzeigen

@ -11,7 +11,6 @@ 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.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@ -282,8 +281,7 @@ public abstract class Entity {
if (this.fireTicks <= 0) {
// not on fire yet
Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent combustEvent = new EntityCombustEvent(eventType, damagee);
EntityCombustEvent combustEvent = new EntityCombustEvent(damagee);
server.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) {
this.fireTicks = 600;
@ -492,7 +490,7 @@ public abstract class Entity {
block = block.getFace(BlockFace.EAST);
}
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block);
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -551,9 +549,8 @@ public abstract class Entity {
// not on fire yet
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent event = new EntityCombustEvent(eventType, damagee);
EntityCombustEvent event = new EntityCombustEvent(damagee);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@ -1037,7 +1034,7 @@ public abstract class Entity {
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
LivingEntity living = (LivingEntity) getBukkitEntity();
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -1053,7 +1050,7 @@ public abstract class Entity {
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
LivingEntity living = (LivingEntity) getBukkitEntity();
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
// CraftBukkit end

Datei anzeigen

@ -7,14 +7,13 @@ import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Event.Type;
import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.event.vehicle.VehicleEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent;
// CraftBukkit end
import org.bukkit.event.vehicle.VehicleUpdateEvent;
public class EntityBoat extends Entity {
@ -32,11 +31,10 @@ public class EntityBoat extends Entity {
// CraftBukkit start
public void h(Entity entity) {
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent(vehicle, hitEntity);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -84,9 +82,8 @@ public class EntityBoat extends Entity {
// CraftBukkit start
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.VEHICLE_CREATE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
server.getPluginManager().callEvent(event);
// CraftBukkit end
}
@ -98,12 +95,11 @@ public class EntityBoat extends Entity {
public boolean a(Entity entity, int i) {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Type eventType = Type.VEHICLE_DAMAGE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity();
int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, attacker, damage);
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, damage);
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -327,10 +323,10 @@ public class EntityBoat extends Entity {
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
VehicleMoveEvent event = new VehicleMoveEvent(vehicle, from, to);
server.getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -373,11 +369,10 @@ public class EntityBoat extends Entity {
if (!this.world.isStatic) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.VEHICLE_ENTER;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity player = entityhuman.getBukkitEntity();
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -85,9 +85,8 @@ public class EntityCreeper extends EntityMonster {
if (this.a >= 30) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimeEvent.Type.EXPLOSION_PRIME;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(eventType, CraftEntity.getEntity(server, this), 3.0F, false);
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), 3.0F, false);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -193,10 +192,9 @@ public class EntityEgg extends Entity {
if (this.g instanceof EntityPlayer) {
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.PLAYER_EGG_THROW;
Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
server.getPluginManager().callEvent(event);
hatching = event.isHatching();

Datei anzeigen

@ -149,9 +149,8 @@ public class EntityFireball extends Entity {
}
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimeEvent.Type.EXPLOSION_PRIME;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), 1.0F, false);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
// give 'this' instead of (Entity) null so we know what causes the damage

Datei anzeigen

@ -9,7 +9,6 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -461,7 +460,7 @@ public abstract class EntityLiving extends Entity {
}
CraftEntity entity = (CraftEntity) getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
CraftWorld cworld = ((WorldServer) world).getWorld();
Server server = ((WorldServer) world).getServer();
server.getPluginManager().callEvent(event);

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Event.Type;
import org.bukkit.event.vehicle.*;
// CraftBukkit end
@ -85,10 +84,9 @@ public class EntityMinecart extends Entity implements IInventory {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.VEHICLE_CREATE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
server.getPluginManager().callEvent(event);
// CraftBukkit end
}
@ -100,12 +98,11 @@ public class EntityMinecart extends Entity implements IInventory {
public boolean a(Entity entity, int i) {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Type eventType = Type.VEHICLE_DAMAGE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (entity == null) ? null : entity.getBukkitEntity();
int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, passenger, damage);
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, damage);
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -469,10 +466,10 @@ public class EntityMinecart extends Entity implements IInventory {
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
VehicleMoveEvent event = new VehicleMoveEvent(vehicle, from, to);
server.getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -614,11 +611,10 @@ public class EntityMinecart extends Entity implements IInventory {
if (entity != this.passenger) {
// CraftBukkit start
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
server.getPluginManager().callEvent(collsionEvent);
if (collsionEvent.isCancelled()) {
@ -627,9 +623,8 @@ public class EntityMinecart extends Entity implements IInventory {
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && this.d == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
if (!collsionEvent.isPickupCancelled()) {
eventType = Type.VEHICLE_ENTER;
VehicleEnterEvent enterEvent = new VehicleEnterEvent(eventType, vehicle, hitEntity);
VehicleEnterEvent enterEvent = new VehicleEnterEvent(vehicle, hitEntity);
server.getPluginManager().callEvent(enterEvent);
if (!enterEvent.isCancelled()) {
@ -752,11 +747,10 @@ public class EntityMinecart extends Entity implements IInventory {
if (!this.world.isStatic) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.VEHICLE_ENTER;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity player = (entityhuman == null) ? null : entityhuman.getBukkitEntity();
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -13,7 +13,6 @@ import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.Event;
import org.bukkit.event.entity.EntityDeathEvent;
// CraftBukkit end
@ -118,7 +117,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
CraftWorld cworld = ((WorldServer) world).getWorld();
Server server = ((WorldServer) world).getServer();
EntityDeathEvent event = new EntityDeathEvent(Event.Type.ENTITY_DEATH, craftEntity, loot);
EntityDeathEvent event = new EntityDeathEvent(craftEntity, loot);
server.getPluginManager().callEvent(event);
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDeathEvent;
// CraftBukkit end
@ -40,10 +39,9 @@ public class EntitySkeleton extends EntityMonster {
if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.ENTITY_COMBUST;
org.bukkit.entity.Entity entity = this.getBukkitEntity();
EntityCombustEvent event = new EntityCombustEvent(eventType, entity);
EntityCombustEvent event = new EntityCombustEvent(entity);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@ -109,7 +107,7 @@ public class EntitySkeleton extends EntityMonster {
Server server = ((WorldServer) world).getServer();
CraftEntity entity = (CraftEntity) getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
server.getPluginManager().callEvent(event);
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {

Datei anzeigen

@ -69,9 +69,8 @@ public class EntityTNTPrimed extends Entity {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimeEvent.Type.EXPLOSION_PRIME;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(eventType, CraftEntity.getEntity(server, this), f, false);
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), f, false);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {

Datei anzeigen

@ -2,7 +2,6 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
// CraftBukkit end
@ -22,7 +21,7 @@ public class EntityZombie extends EntityMonster {
if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {

Datei anzeigen

@ -201,8 +201,7 @@ public class Explosion {
}
}
org.bukkit.event.Event.Type eventType = EntityExplodeEvent.Type.ENTITY_EXPLODE;
EntityExplodeEvent event = new EntityExplodeEvent(eventType, explode, location, blockList);
EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -8,17 +8,14 @@ import java.util.logging.Logger;
// CraftBukkit start
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.block.BlockFace;
import org.bukkit.Location;
import org.bukkit.command.CommandException;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.player.*;
// CraftBukkit end
@ -81,7 +78,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s) {
// CraftBukkit start
String leaveMessage = "\u00A7e" + this.e.name + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(org.bukkit.event.Event.Type.PLAYER_KICK, server.getPlayer(this.e), s, leaveMessage);
PlayerKickEvent event = new PlayerKickEvent(server.getPlayer(this.e), s, leaveMessage);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
// Do not kick the player
@ -127,7 +124,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (delta > 1f/256 || deltaAngle > 10f) {
// Skip the first time we do this
if (lastPosX != Double.MAX_VALUE) {
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to);
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
server.getPluginManager().callEvent(event);
from = event.getFrom();
@ -284,7 +281,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Player player = getPlayer();
Location from = player.getLocation();
Location to = dest.clone();
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_TELEPORT, player, from, to);
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
server.getPluginManager().callEvent(event);
from = event.getFrom();
@ -538,7 +535,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
PlayerItemHeldEvent event = new PlayerItemHeldEvent(Type.PLAYER_ITEM_HELD, getPlayer(), e.inventory.c, packet16blockitemswitch.a);
PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), e.inventory.c, packet16blockitemswitch.a);
server.getPluginManager().callEvent(event);
// CraftBukkit end
@ -572,7 +569,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} else {
// CraftBukkit start
Player player = getPlayer();
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_CHAT, player, msg);
PlayerChatEvent event = new PlayerChatEvent(player, msg);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -595,7 +592,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
CraftPlayer player = getPlayer();
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_COMMAND_PREPROCESS, player, s);
PlayerChatEvent event = new PlayerChatEvent(player, s);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
@ -676,7 +673,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Arm swing animation
Player player = getPlayer();
PlayerAnimationEvent event = new PlayerAnimationEvent(Type.PLAYER_ANIMATION, player);
PlayerAnimationEvent event = new PlayerAnimationEvent(player);
server.getPluginManager().callEvent(event);
// CraftBukkit end
@ -688,7 +685,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit: Toggle Sneak
if (packet19entityaction.b == 1 || packet19entityaction.b == 2) {
Player player = getPlayer();
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(Type.PLAYER_TOGGLE_SNEAK, player);
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(player);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
@ -832,7 +829,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start - SIGN_CHANGE hook
Player player = server.getPlayer(this.e);
SignChangeEvent event = new SignChangeEvent(org.bukkit.event.Event.Type.SIGN_CHANGE, (CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -18,8 +18,6 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
@ -95,7 +93,7 @@ public class ServerConfigurationManager {
entityplayer.world.a(entityplayer);
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
server.getPluginManager().callEvent(playerJoinEvent);
@ -131,7 +129,7 @@ public class ServerConfigurationManager {
// depending on the outcome. Also change any reference to this.e.c to entity.world
EntityPlayer entity = new EntityPlayer(c, c.worlds.get(0), s, new ItemInWorldManager(c.worlds.get(0)));
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(Type.PLAYER_LOGIN, player);
PlayerLoginEvent event = new PlayerLoginEvent(player);
String s2 = netloginhandler.b.b().toString();
@ -191,7 +189,7 @@ public class ServerConfigurationManager {
Player respawnPlayer = server.getPlayer(entityplayer);
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(Event.Type.PLAYER_RESPAWN, respawnPlayer, respawnLocation );
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, respawnLocation );
server.getPluginManager().callEvent(respawnEvent);
entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();

Datei anzeigen

@ -9,13 +9,8 @@ import java.util.Set;
import java.util.TreeSet;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.entity.CreatureType;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
@ -364,7 +359,7 @@ public class World implements IBlockAccess {
// CraftBukkit start
CraftWorld world = ((WorldServer) this).getWorld();
if (world != null) {
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
((WorldServer) this).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -1613,7 +1608,7 @@ public class World implements IBlockAccess {
return false;
}
BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, ((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);
return event.isBuildable();

Datei anzeigen

@ -2,7 +2,6 @@
package org.bukkit.craftbukkit;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import net.minecraft.server.ChunkPosition;
import net.minecraft.server.WorldServer;

Datei anzeigen

@ -2,8 +2,6 @@ package org.bukkit.craftbukkit;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;

Datei anzeigen

@ -21,7 +21,6 @@ import net.minecraft.server.ItemStack;
import net.minecraft.server.World;
import net.minecraft.server.WorldServer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -31,7 +30,6 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.Action;
@ -80,7 +78,7 @@ public class CraftEventFactory {
boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ());
BlockPlaceEvent event = new BlockPlaceEvent(Type.BLOCK_PLACE, placedBlock, replacedBlockState, blockClicked, itemInHand, player, canBuild);
BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, itemInHand, player, canBuild);
craftServer.getPluginManager().callEvent(event);
return event;

Datei anzeigen

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.util;
import java.util.Map;
import java.util.AbstractMap;
import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Set;

Datei anzeigen

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.util;
import java.util.ArrayList;
import java.util.Arrays;
import net.minecraft.server.Chunk;
import net.minecraft.server.MinecraftServer;
import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf;