geforkt von Mirrors/Paper
Events should be present tense, not paste tense.
Dieser Commit ist enthalten in:
Ursprung
2184d240db
Commit
8c8f53fd44
@ -6,8 +6,8 @@ import org.bukkit.craftbukkit.CraftBlock;
|
||||
import org.bukkit.craftbukkit.CraftEntity;
|
||||
import org.bukkit.craftbukkit.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamagedEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.Random;
|
||||
@ -104,7 +104,7 @@ public class BlockCactus extends Block {
|
||||
}
|
||||
|
||||
if(toPassIn != null) {
|
||||
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1);
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamageEvent.DamageCause.CONTACT, 1);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(edbbe);
|
||||
|
||||
if (edbbe.isCancelled())
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.world.ChunkLoadedEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
@ -79,7 +79,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
*/
|
||||
CraftWorld world = g.getWorld();
|
||||
CraftChunk cchunk = world.updateChunk(i, j);
|
||||
server.getPluginManager().callEvent(new ChunkLoadedEvent(Type.CHUNK_LOADED, cchunk));
|
||||
server.getPluginManager().callEvent(new ChunkLoadEvent(Type.CHUNK_LOADED, cchunk));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftEntity;
|
||||
import org.bukkit.craftbukkit.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamagedEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.List;
|
||||
@ -476,7 +476,7 @@ public abstract class Entity {
|
||||
defender = new CraftLivingEntity(server, (EntityLiving)this);
|
||||
}
|
||||
|
||||
EntityDamagedEvent ede = new EntityDamagedEvent(defender, EntityDamagedEvent.DamageCause.FIRE, i1);
|
||||
EntityDamageEvent ede = new EntityDamageEvent(defender, EntityDamageEvent.DamageCause.FIRE, i1);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) return;
|
||||
|
@ -5,9 +5,9 @@ import org.bukkit.craftbukkit.CraftEntity;
|
||||
import org.bukkit.craftbukkit.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamagedEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.*;
|
||||
@ -123,7 +123,7 @@ public class Explosion {
|
||||
|
||||
if (e == null) { // Block explosion
|
||||
// Craftbukkit TODO: get the x/y/z of the tnt block?
|
||||
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(null, damagee, EntityDamagedEvent.DamageCause.BLOCK_EXPLOSION, damage);
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damage);
|
||||
servr.getPluginManager().callEvent(edbbe);
|
||||
if(!edbbe.isCancelled()) entity.a(e, damage);
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ public class Explosion {
|
||||
} else if (e instanceof EntityLiving) {
|
||||
damager = new CraftLivingEntity(servr, (EntityLiving) e);
|
||||
}
|
||||
EntityDamagedByEntityEvent edbbe = new EntityDamagedByEntityEvent(damager, damagee, EntityDamagedEvent.DamageCause.ENTITY_EXPLOSION, damage);
|
||||
EntityDamageByEntityEvent edbbe = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage);
|
||||
servr.getPluginManager().callEvent(edbbe);
|
||||
|
||||
if (!edbbe.isCancelled()) {
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.CraftBlock;
|
||||
import org.bukkit.craftbukkit.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.BlockPlacedEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ItemBlock extends Item {
|
||||
@ -81,7 +81,7 @@ public class ItemBlock extends Item {
|
||||
// CraftBukkit hardcoded Spawn distance for now
|
||||
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();
|
||||
|
||||
BlockPlacedEvent bpe = new BlockPlacedEvent(Type.BLOCK_PLACED, placedBlock, blockClicked, itemInHand, thePlayer, canBuild);
|
||||
BlockPlaceEvent bpe = new BlockPlaceEvent(Type.BLOCK_PLACED, placedBlock, blockClicked, itemInHand, thePlayer, canBuild);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(bpe);
|
||||
|
||||
if (bpe.isCancelled() || !bpe.canBuild()) {
|
||||
|
@ -13,8 +13,8 @@ import org.bukkit.craftbukkit.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.BlockDamagedEvent;
|
||||
import org.bukkit.event.block.BlockRightClickedEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockRightClickEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerItemEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -291,13 +291,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (packet14blockdig.e == 0) {
|
||||
if (i2 > 16 || flag) {
|
||||
if(blockId > 0) {
|
||||
BlockDamagedEvent event;
|
||||
BlockDamageEvent event;
|
||||
// If the amount of damage that the player is going to do to the block
|
||||
// is >= 1, then the block is going to break (eg, flowers, torches)
|
||||
if (damage >= 1.0F) {
|
||||
event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
||||
} else {
|
||||
event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STARTED, player);
|
||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STARTED, player);
|
||||
}
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
@ -309,7 +309,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit start - Get last block that the player hit
|
||||
// Otherwise the block is a Bedrock @(0,0,0)
|
||||
block = (CraftBlock) player.getWorld().getBlockAt(lastX, lastY, lastZ);
|
||||
BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
|
||||
BlockDamageEvent event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
e.c.a();
|
||||
@ -318,13 +318,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
} else if (packet14blockdig.e == 1) {
|
||||
if (i2 > 16 || flag) {
|
||||
// CraftBukkit start
|
||||
BlockDamagedEvent event;
|
||||
BlockDamageEvent event;
|
||||
// If the amount of damage going to the block plus the current amount
|
||||
// of damage is greater than 1, the block is going to break.
|
||||
if (e.c.d + damage >= 1.0F) {
|
||||
event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
||||
} else {
|
||||
event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
|
||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
|
||||
}
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
@ -439,7 +439,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit start - spawn proection moved to ItemBlock!!!
|
||||
CraftItemStack craftItem = new CraftItemStack(itemstack);
|
||||
CraftPlayer player = new CraftPlayer(server, e);
|
||||
BlockRightClickedEvent brce = new BlockRightClickedEvent(Type.BLOCK_RIGHTCLICKED, blockClicked, blockFace, craftItem, player);
|
||||
BlockRightClickEvent brce = new BlockRightClickEvent(Type.BLOCK_RIGHTCLICKED, blockClicked, blockFace, craftItem, player);
|
||||
server.getPluginManager().callEvent(brce);
|
||||
|
||||
e.c.a(((EntityPlayer) (e)), ((World) (d.e)), itemstack, l, i1, j1, k1);
|
||||
|
0
src/main/java/org/bukkit/craftbukkit/CraftWorld.java
Ausführbare Datei → Normale Datei
0
src/main/java/org/bukkit/craftbukkit/CraftWorld.java
Ausführbare Datei → Normale Datei
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren