SPIGOT-6508: Rename conflicted getServer

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-06-11 21:33:49 +10:00
parent dd358f1352
commit 536256d6ff
95 changed files with 211 additions and 211 deletions

View file

@ -68,7 +68,7 @@
+ }
+
+ // Handle vanilla commands;
+ if (sender.getWorld().getServer().getCommandBlockOverride(args[0])) {
+ if (sender.getWorld().getCraftServer().getCommandBlockOverride(args[0])) {
+ args[0] = "minecraft:" + args[0];
+ }
+

View file

@ -34,7 +34,7 @@
+ // CraftBukkit start
+ public boolean hasPermission(int i, String bukkitPermission) {
+ // World is null when loading functions
+ return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || getBukkitSender().hasPermission(bukkitPermission);
+ return ((getWorld() == null || !getWorld().getCraftServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || getBukkitSender().hasPermission(bukkitPermission);
+ }
+ // CraftBukkit end
+

View file

@ -25,7 +25,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -46,7 +46,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), CraftVector.toBukkit(entityitem.getMot()));
+ if (!BlockDispenser.eventFired) {
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -27,7 +27,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -23,7 +23,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -22,7 +22,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ if (!BlockDispenser.eventFired) {
+ isourceblock.getWorld().getServer().getPluginManager().callEvent(event);
+ isourceblock.getWorld().getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -78,7 +78,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -123,7 +123,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -165,7 +165,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(enumdirection.getAdjacentX(), enumdirection.getAdjacentY(), enumdirection.getAdjacentZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -213,7 +213,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -258,7 +258,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -315,7 +315,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -348,7 +348,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -393,7 +393,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -460,7 +460,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -500,7 +500,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -531,7 +531,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -562,7 +562,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -17,7 +17,7 @@
this.progressChanged.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {
+ this.player.level.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
+ this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
advancement.d().a(this.player);
if (advancement.c() != null && advancement.c().i() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
this.playerList.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);

View file

@ -30,7 +30,7 @@
+ // CraftBukkit start - Teleport event
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -183,7 +183,7 @@
+ this.unsetRemoved();
+ Vec3D position = null;
+ if (this.respawnDimension != null) {
+ world = this.getWorldServer().getServer().getHandle().getServer().getWorldServer(this.respawnDimension);
+ world = this.getWorldServer().getCraftServer().getHandle().getServer().getWorldServer(this.respawnDimension);
+ if (world != null && this.getSpawn() != null) {
+ position = EntityHuman.getBed((WorldServer) world, this.getSpawn(), this.getSpawnAngle(), false, false).orElse(null);
+ }
@ -246,7 +246,7 @@
+ }
+
+ if (this.oldLevel != this.experienceLevel) {
+ CraftEventFactory.callPlayerLevelChangeEvent(this.level.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.experienceLevel);
+ CraftEventFactory.callPlayerLevelChangeEvent(this.level.getCraftServer().getPlayer((EntityPlayer) this), this.oldLevel, this.experienceLevel);
+ this.oldLevel = this.experienceLevel;
+ }
+ // CraftBukkit end
@ -259,7 +259,7 @@
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
- this.getScoreboard().getObjectivesForCriteria(iscoreboardcriteria, this.getName(), (scoreboardscore) -> {
+ // CraftBukkit - Use our scores instead
+ this.level.getServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getName(), (scoreboardscore) -> {
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getName(), (scoreboardscore) -> {
scoreboardscore.setScore(i);
});
}
@ -331,7 +331,7 @@
+ // CraftBukkit end
+
+ // CraftBukkit - Get our scores instead
+ this.level.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
EntityLiving entityliving = this.getKillingEntity();
if (entityliving != null) {
@ -341,12 +341,12 @@
- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::incrementScore);
+ // CraftBukkit - Get our scores instead
+ this.level.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::incrementScore);
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::incrementScore);
if (entity instanceof EntityHuman) {
this.a(StatisticList.PLAYER_KILLS);
- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::incrementScore);
+ // CraftBukkit - Get our scores instead
+ this.level.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::incrementScore);
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::incrementScore);
} else {
this.a(StatisticList.MOB_KILLS);
}
@ -356,7 +356,7 @@
if (i >= 0 && i < aiscoreboardcriteria.length) {
- this.getScoreboard().getObjectivesForCriteria(aiscoreboardcriteria[i], s, ScoreboardScore::incrementScore);
+ // CraftBukkit - Get our scores instead
+ this.level.getServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::incrementScore);
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::incrementScore);
}
}
@ -483,7 +483,7 @@
+
+ // CraftBukkit start
+ PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
+ this.level.getServer().getPluginManager().callEvent(changeEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
+ // CraftBukkit end
}
@ -635,7 +635,7 @@
+ }
+
+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, true);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
@ -733,7 +733,7 @@
public void a(Statistic<?> statistic, int i) {
this.stats.b(this, statistic, i);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), (scoreboardscore) -> {
+ this.level.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
scoreboardscore.addScore(i);
});
}
@ -742,7 +742,7 @@
public void a(Statistic<?> statistic) {
this.stats.setStatistic(this, statistic, 0);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), ScoreboardScore::c);
+ this.level.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), ScoreboardScore::c); // CraftBukkit - Get our scores instead
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), ScoreboardScore::c); // CraftBukkit - Get our scores instead
}
@Override
@ -792,7 +792,7 @@
} else {
+ // CraftBukkit start
+ PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(getBukkitEntity(), GameMode.getByValue(enumgamemode.getId()));
+ level.getServer().getPluginManager().callEvent(event);
+ level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }

View file

@ -102,7 +102,7 @@
+ org.bukkit.util.Vector velocity = player.getVelocity();
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ this.entity.level.getServer().getPluginManager().callEvent(event);
+ this.entity.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;

View file

@ -86,7 +86,7 @@
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
+ worldserver.b(EntityTypes.a(list, (World) worldserver).filter((entity) -> {
+ boolean needsRemoval = false;
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getServer().getServer();
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getCraftServer().getServer();
+ if (!server.getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
+ entity.die();
+ needsRemoval = true;

View file

@ -173,7 +173,7 @@
+ }
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.level, blockposition, (EntityHuman) this.player)) {
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ if (isSwordNoBreak) {

View file

@ -107,7 +107,7 @@
}
this.sleepStatus = new SleepStatus();
+ this.getServer().addWorld(this.getWorld()); // CraftBukkit
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ }
+
+ // CraftBukkit start
@ -130,7 +130,7 @@
+ }
+
+ private TileEntity fixTileEntity(BlockPosition pos, IBlockData type, TileEntity found) {
+ this.getServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". "
+ this.getCraftServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". "
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found});
+
+ if (type instanceof ITileEntity) {
@ -188,7 +188,7 @@
+ TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
- long l = this.levelData.getDayTime() + 24000L;
+ getServer().getPluginManager().callEvent(event);
+ getCraftServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ this.setDayTime(this.getDayTime() + event.getSkipAmount());
+ }
@ -632,7 +632,7 @@
+ org.bukkit.World bworld = worldserver.getWorld();
+ org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((List<org.bukkit.block.BlockState>) (List) blockList.getList(), bworld, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM);
+
+ worldserver.getServer().getPluginManager().callEvent(portalEvent);
+ worldserver.getCraftServer().getPluginManager().callEvent(portalEvent);
+ if (!portalEvent.isCancelled()) {
+ blockList.updateList();
+ }

View file

@ -45,7 +45,7 @@
+
+ public CraftEntity getBukkitEntity() {
+ if (bukkitEntity == null) {
+ bukkitEntity = CraftEntity.getEntity(level.getServer(), this);
+ bukkitEntity = CraftEntity.getEntity(level.getCraftServer(), this);
+ }
+ return bukkitEntity;
+ }
@ -89,7 +89,7 @@
+ if (entitypose == this.getPose()) {
+ return;
+ }
+ this.level.getServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[entitypose.ordinal()]));
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[entitypose.ordinal()]));
+ // CraftBukkit end
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@ -105,7 +105,7 @@
+
+ if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) {
+ if (this instanceof EntityPlayer) {
+ this.level.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw");
+ this.level.getCraftServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)");
+ }
+ f = 0;
@ -118,7 +118,7 @@
+
+ if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) {
+ if (this instanceof EntityPlayer) {
+ this.level.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch");
+ this.level.getCraftServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)");
+ }
+ f1 = 0;
@ -165,7 +165,7 @@
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
+ this.level.getServer().getPluginManager().callEvent(combustEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ this.setOnFire(combustEvent.getDuration(), false);
@ -189,7 +189,7 @@
+ public void setOnFire(int i, boolean callEvent) {
+ if (callEvent) {
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -222,7 +222,7 @@
+
+ if (!bl.getType().isAir()) {
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
+ level.getServer().getPluginManager().callEvent(event);
+ level.getCraftServer().getPluginManager().callEvent(event);
+ }
+ }
+ // CraftBukkit end

View file

@ -15,7 +15,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
@ -23,7 +23,7 @@
this.y(f);
if (f > 10.0F) {
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
this.goalSelector.a(PathfinderGoal.Type.MOVE);
} else if (f > 6.0F) {

View file

@ -54,14 +54,14 @@
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
+ }
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN) {
+ level.getServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
+ level.getCraftServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
+ }
+ CraftLivingEntity ctarget = null;
+ if (entityliving != null) {
+ ctarget = (CraftLivingEntity) entityliving.getBukkitEntity();
+ }
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
+ level.getServer().getPluginManager().callEvent(event);
+ level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }
@ -263,7 +263,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
this.unleash(true, true);
}
@ -281,7 +281,7 @@
boolean flag1 = super.a(entity, flag);
if (flag1 && this.isLeashed()) {
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, true);
}
@ -305,7 +305,7 @@
@Override
protected void cc() {
super.cc();
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, false);
this.by().forEach((itemstack) -> {
- itemstack.setCount(0);

View file

@ -325,7 +325,7 @@
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
+ // Suppress during worldgen
+ if (this.valid) {
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (!event.isCancelled()) {
@ -464,7 +464,7 @@
- if (this instanceof EntityPlayer) {
+ EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity());
+ event.setCancelled(itemstack == null);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ if (!itemstack1.isEmpty()) {
@ -856,7 +856,7 @@
+ if (this instanceof EntityPlayer) {
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
+ level.getServer().getPluginManager().callEvent(event);
+ level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ // Update client
@ -905,7 +905,7 @@
+ if (flag1) {
+ if (!(this instanceof EntityPlayer)) {
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level.getWorld(), d3, d4, d5), new Location(this.level.getWorld(), d0, d6, d2));
+ this.level.getServer().getPluginManager().callEvent(teleport);
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
+ if (!teleport.isCancelled()) {
+ Location to = teleport.getTo();
+ this.enderTeleportTo(to.getX(), to.getY(), to.getZ());

View file

@ -6,7 +6,7 @@
if (!blockdoor.h(iblockdata)) {
+ // CraftBukkit start - entities opening doors
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
+ entityliving.level.getServer().getPluginManager().callEvent(event);
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
@ -20,7 +20,7 @@
if (!blockdoor1.h(iblockdata1)) {
+ // CraftBukkit start - entities opening doors
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
+ entityliving.level.getServer().getPluginManager().callEvent(event);
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -39,7 +39,7 @@
entityitem.defaultPickupDelay();
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ entityitem.level.getServer().getPluginManager().callEvent(event);
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -22,7 +22,7 @@
+ CraftEntity entity = this.tamable.getBukkitEntity();
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
+ this.tamable.level.getServer().getPluginManager().callEvent(event);
+ this.tamable.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }

View file

@ -18,7 +18,7 @@
if (this.ticksSinceReachedGoal > 60) {
+ // CraftBukkit start - Step on eggs
+ EntityInteractEvent event = new EntityInteractEvent(this.removerMob.getBukkitEntity(), CraftBlock.at(world, blockposition1));
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) event);
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) event);
+
+ if (event.isCancelled()) {
+ return;

View file

@ -35,7 +35,7 @@
+ // CraftBukkit start
+ EntityItem entityitem = new EntityItem(this.cat.level, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ entityitem.level.getServer().getPluginManager().callEvent(event);
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ continue;
+ }

View file

@ -49,7 +49,7 @@
public void blockEaten() {
+ // CraftBukkit start
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) return;
+ // CraftBukkit end

View file

@ -39,7 +39,7 @@
- this.level.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ this.unsetRemoved();
+ return false;

View file

@ -43,7 +43,7 @@
- this.setHealth(this.getHealth() + 1.0F);
+ // CraftBukkit start
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0F, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.setHealth((float) (this.getHealth() + event.getAmount()));

View file

@ -22,7 +22,7 @@
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getControllerPhase()),
+ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
+ );
+ this.dragon.level.getServer().getPluginManager().callEvent(event);
+ this.dragon.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -25,7 +25,7 @@
+ // CraftBukkit start
+ // this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.level.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
@ -37,7 +37,7 @@
- this.level.b(1023, this.getChunkCoordinates(), 0);
+ // CraftBukkit start - Use relative location for far away sounds
+ // this.world.b(1023, new BlockPosition(this), 0);
+ int viewDistance = ((WorldServer) this.level).getServer().getViewDistance() * 16;
+ int viewDistance = ((WorldServer) this.level).getCraftServer().getViewDistance() * 16;
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ double deltaX = this.locX() - player.locX();
+ double deltaZ = this.locZ() - player.locZ();

View file

@ -67,7 +67,7 @@
+
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.level.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(armorStandManipulateEvent);
+
+ if (armorStandManipulateEvent.isCancelled()) {
+ return true;

View file

@ -97,7 +97,7 @@
+ }
+
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), cause);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (this.isRemoved() || event.isCancelled()) {
+ return;
@ -119,7 +119,7 @@
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT);
+ }
+
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (this.isRemoved() || event.isCancelled()) {
+ return true;
@ -138,7 +138,7 @@
+ // CraftBukkit start - fire break events
+ // TODO - Does this need its own cause? Seems to only be triggered by pistons
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (this.isRemoved() || event.isCancelled()) {
+ return;

View file

@ -100,7 +100,7 @@
+ // Call legacy event
+ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems());
+ this.level.getServer().getPluginManager().callEvent(playerEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerEvent);
+ if (playerEvent.isCancelled()) {
+ itemstack.setCount(i); // SPIGOT-5294 - restore count
+ return;
@ -109,7 +109,7 @@
+ // Call newer event afterwards
+ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems());
+ this.level.getServer().getPluginManager().callEvent(entityEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(entityEvent);
+ if (entityEvent.isCancelled()) {
+ itemstack.setCount(i); // SPIGOT-5294 - restore count
+ return;

View file

@ -42,7 +42,7 @@
- this.level.explode(this, this.locX(), this.e(0.0625D), this.locZ(), 4.0F, Explosion.Effect.BREAK);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.level.createExplosion(this, this.locX(), this.e(0.0625D), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);

View file

@ -44,7 +44,7 @@
- this.createEffectCloud();
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ this.dead = true;
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);

View file

@ -41,7 +41,7 @@
+ // CraftBukkit start
+ Entity entity = ((WorldServer) this.level).getEntity(getAngerTarget());
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.PERSISTENT_ANGER_TIME.a(this.random));
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ this.setAngerTarget(null);
+ return;

View file

@ -28,7 +28,7 @@
if (enumdirection != null) {
+ // CraftBukkit start
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), new Location(this.level.getWorld(), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
+ this.level.getServer().getPluginManager().callEvent(teleport);
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
+ if (!teleport.isCancelled()) {
+ Location to = teleport.getTo();
+ blockposition1 = new BlockPosition(to.getX(), to.getY(), to.getZ());

View file

@ -30,7 +30,7 @@
+ // CraftBukkit start
+ SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), k);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled() && event.getCount() > 0) {
+ k = event.getCount();

View file

@ -88,7 +88,7 @@
- entity.setOnFire(2 * (int) f);
+ // CraftBukkit start
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setOnFire(event.getDuration(), false);

View file

@ -97,7 +97,7 @@
+ Item drop = (Item) entityitem.getBukkitEntity();
+
+ PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ org.bukkit.inventory.ItemStack cur = player.getInventory().getItemInHand();
@ -171,8 +171,8 @@
+ }
+ } else {
+ // This should never be called, but is implemented anyway
+ org.bukkit.OfflinePlayer thisPlayer = entityhuman.level.getServer().getOfflinePlayer(entityhuman.getName());
+ team = entityhuman.level.getServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
+ org.bukkit.OfflinePlayer thisPlayer = entityhuman.level.getCraftServer().getOfflinePlayer(entityhuman.getName());
+ team = entityhuman.level.getCraftServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
+ if (team == null || team.allowFriendlyFire()) {
+ return true;
+ }
@ -182,7 +182,7 @@
+ if (this instanceof EntityPlayer) {
+ return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
+ }
+ return !team.hasPlayer(this.level.getServer().getOfflinePlayer(this.getName()));
+ return !team.hasPlayer(this.level.getCraftServer().getOfflinePlayer(this.getName()));
+ // CraftBukkit end
}
@ -269,7 +269,7 @@
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ level.getServer().getPluginManager().callEvent(event);
+ level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;

View file

@ -46,9 +46,9 @@
+ ItemStack itemstack = this.getItemStack();
+ if (this.pickup == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.getInventory().canHold(itemstack) > 0) {
+ EntityItem item = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), itemstack);
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level.getCraftServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;

View file

@ -40,7 +40,7 @@
+ Entity shooter = this.getShooter();
+ if (shooter instanceof EntityPlayer) {
+ PlayerEggThrowEvent event = new PlayerEggThrowEvent((Player) shooter.getBukkitEntity(), (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, b0, hatchingType);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ b0 = event.getNumHatches();
+ hatching = event.isHatching();

View file

@ -41,7 +41,7 @@
this.getDataWatcher().set(EntityFishingHook.DATA_BITING, false);
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+ // CraftBukkit end
}
} else {
@ -52,7 +52,7 @@
} else {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.BITE);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+ if (playerFishEvent.isCancelled()) {
+ return;
+ }
@ -79,7 +79,7 @@
if (this.hookedIn != null) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ return 0;
@ -95,7 +95,7 @@
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ return 0;
@ -123,7 +123,7 @@
if (this.onGround) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ return 0;
@ -134,7 +134,7 @@
+ // CraftBukkit start
+ if (i == 0) {
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.REEL_IN);
+ this.level.getServer().getPluginManager().callEvent(playerFishEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+ if (playerFishEvent.isCancelled()) {
+ return 0;
+ }

View file

@ -29,7 +29,7 @@
- this.level.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.explosionPower, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ // CraftBukkit start - fire ExplosionPrimeEvent
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ // give 'this' instead of (Entity) null so we know what causes the damage

View file

@ -28,7 +28,7 @@
- entity.setOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ entity.level.getServer().getPluginManager().callEvent(event);
+ entity.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setOnFire(event.getDuration(), false);

View file

@ -35,7 +35,7 @@
+ // CraftBukkit start
+ // this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);

View file

@ -40,7 +40,7 @@
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
@ -57,7 +57,7 @@
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level.getServer().getPluginManager().callEvent(destroyEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
@ -74,7 +74,7 @@
+ // CraftBukkit start
+ if (!this.isSameVehicle(entity)) {
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -87,7 +87,7 @@
+ // CraftBukkit start
+ if (!this.isSameVehicle(entity)) {
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -110,7 +110,7 @@
}
+ // CraftBukkit start
+ org.bukkit.Server server = this.level.getServer();
+ org.bukkit.Server server = this.level.getCraftServer();
+ org.bukkit.World bworld = this.level.getWorld();
+
+ Location to = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.getYRot(), this.getXRot());
@ -135,7 +135,7 @@
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
+ this.level.getServer().getPluginManager().callEvent(destroyEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(destroyEvent);
+ if (!destroyEvent.isCancelled()) {
this.killEntity();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {

View file

@ -52,7 +52,7 @@
+ org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
@ -69,7 +69,7 @@
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
+ this.level.getServer().getPluginManager().callEvent(destroyEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
@ -113,10 +113,10 @@
+ Location to = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.getYRot(), this.getXRot());
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+
+ this.level.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
+ this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
+
+ if (!from.equals(to)) {
+ this.level.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
+ this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
+ }
+ // CraftBukkit end
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getMot().i() > 0.01D) {
@ -128,7 +128,7 @@
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
+ // CraftBukkit start
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(collisionEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
+
+ if (collisionEvent.isCancelled()) {
+ continue;
@ -139,7 +139,7 @@
+ // CraftBukkit start
+ if (!this.isSameVehicle(entity)) {
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(collisionEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
+
+ if (collisionEvent.isCancelled()) {
+ continue;
@ -155,7 +155,7 @@
if (!this.u(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
+ // CraftBukkit start
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity1.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(collisionEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
+
+ if (collisionEvent.isCancelled()) {
+ continue;
@ -207,7 +207,7 @@
if (!this.u(entity)) {
+ // CraftBukkit start
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
+ this.level.getServer().getPluginManager().callEvent(collisionEvent);
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
+
+ if (collisionEvent.isCancelled()) {
+ return;

View file

@ -106,7 +106,7 @@
+ this.setCarried(CraftItemStack.asNMSCopy(newcursor));
+
+ InventoryDragEvent event = new InventoryDragEvent(view, (newcursor.getType() != org.bukkit.Material.AIR ? newcursor : null), CraftItemStack.asBukkitCopy(oldCursor), this.quickcraftType == 1, eventmap);
+ entityhuman.level.getServer().getPluginManager().callEvent(event);
+ entityhuman.level.getCraftServer().getPluginManager().callEvent(event);
+
+ // Whether or not a change was made to the inventory that requires an update.
+ boolean needsUpdate = event.getResult() != Result.DEFAULT;

View file

@ -80,7 +80,7 @@
+
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), access.getLocation().getBlock(), item, offers, i);
+ event.setCancelled(!itemstack.canEnchant());
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ for (j = 0; j < 3; ++j) {
@ -126,7 +126,7 @@
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
+
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {

View file

@ -23,7 +23,7 @@
+
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity());
+ if (!BlockDispenser.eventFired) {
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -98,7 +98,7 @@
+ org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null;
+
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
+ blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event);
+ blockactioncontext.getWorld().getCraftServer().getPluginManager().callEvent(event);
- return (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision);
+ return event.isBuildable();

View file

@ -17,7 +17,7 @@
+ // CraftBukkit start
+ byte bColor = (byte) this.dyeColor.getColorIndex();
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));
+ entitysheep.level.getServer().getPluginManager().callEvent(event);
+ entitysheep.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return EnumInteractionResult.PASS;

View file

@ -23,7 +23,7 @@
+ // CraftBukkit start
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, j, i);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
+ world.getServer().getPluginManager().callEvent(playerFishEvent);
+ world.getCraftServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ entityhuman.fishing = null;

View file

@ -22,7 +22,7 @@
+ org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection);
+
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) ((EntityHanging) object).getBukkitEntity(), who, blockClicked, blockFace);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return EnumInteractionResult.FAIL;

View file

@ -16,7 +16,7 @@
+
+ // CraftBukkit start - fire HangingPlaceEvent
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleash.getBukkitEntity(), entityhuman != null ? (org.bukkit.entity.Player) entityhuman.getBukkitEntity() : null, world.getWorld().getBlockAt(i, j, k), org.bukkit.block.BlockFace.SELF);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ entityleash.die();

View file

@ -25,7 +25,7 @@
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {

View file

@ -95,13 +95,13 @@
+
+ if (explode != null) {
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList();
+ yield = event.getYield();
+ } else {
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F);
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList();
+ yield = event.getYield();

View file

@ -57,7 +57,7 @@
+ return this.world;
+ }
+
+ public CraftServer getServer() {
+ public CraftServer getCraftServer() {
+ return (CraftServer) Bukkit.getServer();
+ }
+
@ -68,12 +68,12 @@
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, env);
+ this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
+ this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
+ this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns(); // CraftBukkit
+ this.ticksPerWaterAmbientSpawns = this.getServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
+ this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns(); // CraftBukkit
+ this.typeKey = (ResourceKey) this.getServer().getHandle().getServer().registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).c(dimensionmanager).orElseThrow(() -> {
+ this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
+ this.ticksPerMonsterSpawns = this.getCraftServer().getTicksPerMonsterSpawns(); // CraftBukkit
+ this.ticksPerWaterSpawns = this.getCraftServer().getTicksPerWaterSpawns(); // CraftBukkit
+ this.ticksPerWaterAmbientSpawns = this.getCraftServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
+ this.ticksPerAmbientSpawns = this.getCraftServer().getTicksPerAmbientSpawns(); // CraftBukkit
+ this.typeKey = (ResourceKey) this.getCraftServer().getHandle().getServer().registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).c(dimensionmanager).orElseThrow(() -> {
+ return new IllegalStateException("Unregistered dimension type: " + dimensionmanager);
+ });
+ // CraftBukkit end
@ -104,23 +104,23 @@
+ // From PlayerList.setPlayerFileData
+ getWorldBorder().a(new IWorldBorderListener() {
+ public void a(WorldBorder worldborder, double d0) {
+ getServer().getHandle().sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world);
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world);
+ }
+
+ public void a(WorldBorder worldborder, double d0, double d1, long i) {
+ getServer().getHandle().sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world);
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world);
+ }
+
+ public void a(WorldBorder worldborder, double d0, double d1) {
+ getServer().getHandle().sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world);
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world);
+ }
+
+ public void a(WorldBorder worldborder, int i) {
+ getServer().getHandle().sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world);
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world);
+ }
+
+ public void b(WorldBorder worldborder, int i) {
+ getServer().getHandle().sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world);
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world);
+ }
+
+ public void b(WorldBorder worldborder, double d0) {}
@ -230,7 +230,7 @@
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
+ this.getServer().getPluginManager().callEvent(event);
+ this.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -257,7 +257,7 @@
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
+ this.getServer().getPluginManager().callEvent(event);
+ this.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -328,7 +328,7 @@
protected void a(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), new Location(this.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (entity == null) ? null : entity.getBukkitEntity(), i);
+ getServer().getPluginManager().callEvent(event);
+ getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -23,7 +23,7 @@
+ int current = (!powered) ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
+ return EnumInteractionResult.SUCCESS;
@ -40,7 +40,7 @@
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ worldserver.getServer().getPluginManager().callEvent(eventRedstone);
+ worldserver.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
@ -62,7 +62,7 @@
+ for (Object object : list) {
+ if (object != null) {
+ EntityInteractEvent event = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ allowed = true;
@ -85,7 +85,7 @@
+ int current = (!powered) ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((flag && eventRedstone.getNewCurrent() <= 0) || (!flag && eventRedstone.getNewCurrent() > 0)) {
+ return;

View file

@ -19,7 +19,7 @@
+ int current = flag1 ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end

View file

@ -62,7 +62,7 @@
+ blockState.setData(this.concrete);
+
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ ((World) generatoraccess).getServer().getPluginManager().callEvent(event);
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();

View file

@ -28,7 +28,7 @@
+
+ if (oldPower == 0 ^ power == 0) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
- if (!this.getBlockData().a(block) && flag1 != (Boolean) iblockdata.get(BlockDoor.POWERED)) {
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;

View file

@ -31,7 +31,7 @@
+ }
+
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

View file

@ -29,7 +29,7 @@
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof EntityPlayer) {
+ ((EntityPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);

View file

@ -11,7 +11,7 @@
+ int oldPower = oldPowered ? 15 : 0;
+ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition);
+ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, newPower);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ }
+ // CraftBukkit end

View file

@ -29,7 +29,7 @@
+ blockState.setData(Blocks.AIR.getBlockData());
+
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ ((World) generatoraccess).getServer().getPluginManager().callEvent(event);
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
@ -129,7 +129,7 @@
+ org.bukkit.block.Block sourceBlock = world.getWorld().getBlockAt(sourceposition.getX(), sourceposition.getY(), sourceposition.getZ());
+
+ BlockBurnEvent event = new BlockBurnEvent(theBlock, sourceBlock);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;

View file

@ -7,7 +7,7 @@
- entity.setOnFire(8);
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setOnFire(event.getDuration(), false);

View file

@ -15,7 +15,7 @@
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || worldserver.getType(blockposition).getBlock() != this) {
+ return;

View file

@ -20,7 +20,7 @@
+ int current = (!powered) ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
+ return EnumInteractionResult.SUCCESS;

View file

@ -18,7 +18,7 @@
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ }

View file

@ -27,7 +27,7 @@
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
entity.d(blockposition);
}

View file

@ -15,7 +15,7 @@
+ // CraftBukkit start - Interact Pressure Plate
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
+
+ if (flag != flag1) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);

View file

@ -16,7 +16,7 @@
+ // CraftBukkit start - Call interact event when turning on a pressure plate
+ if (this.getPower(world.getType(blockposition)) == 0) {
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
+ org.bukkit.event.Cancellable cancellable;
+
+ if (entity instanceof EntityHuman) {

View file

@ -28,7 +28,7 @@
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ // We only want to block turning the plate on if all events are cancelled

View file

@ -36,7 +36,7 @@
+ }
+ } else {
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ interact(world.getType(blockposition), world, blockposition, entity); // add entity
+ super.stepOn(world, blockposition, iblockdata, entity);

View file

@ -14,7 +14,7 @@
}
+ // CraftBukkit start
+ org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager();
+ org.bukkit.plugin.PluginManager manager = worldserver.getCraftServer().getPluginManager();
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
+

View file

@ -27,7 +27,7 @@
+ int oldPower = (Integer) iblockdata.get(BlockRedstoneWire.POWER);
+ if (oldPower != i) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ i = event.getNewCurrent();
+ }

View file

@ -38,7 +38,7 @@
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable.isCancelled()) {

View file

@ -71,7 +71,7 @@
+ final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List<org.bukkit.block.BlockState>) (List) blocks);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;

View file

@ -22,7 +22,7 @@
+
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().isPowerSource()) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ }
+ // CraftBukkit end

View file

@ -16,7 +16,7 @@
+ // CraftBukkit start - Call interact even when triggering connected tripwire
+ if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) {
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
+ org.bukkit.block.Block block = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ boolean allowed = false;
+

View file

@ -17,7 +17,7 @@
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;

View file

@ -23,7 +23,7 @@
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable.isCancelled()) {

View file

@ -53,7 +53,7 @@
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
+ (entity == null) ? null : entity.getBukkitEntity(), reason, newState
+ );
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }

View file

@ -22,7 +22,7 @@
+ int current = (!powered) ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() <= 0) {
+ return;

View file

@ -24,7 +24,7 @@
public static void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ // CraftBukkit start
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), iblockdata.get(SculkSensorBlock.POWER), 0);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ world.setTypeAndData(blockposition, iblockdata.set(SculkSensorBlock.POWER, eventRedstone.getNewCurrent()), 3);
@ -40,7 +40,7 @@
public static void a(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
+ // CraftBukkit start
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), iblockdata.get(SculkSensorBlock.POWER), i);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() <= 0) {
+ return;

View file

@ -64,7 +64,7 @@
- itemstack.subtract(1);
+ // CraftBukkit start
+ BrewingStandFuelEvent event = new BrewingStandFuelEvent(CraftBlock.at(world, blockposition), CraftItemStack.asCraftMirror(itemstack), 20);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;

View file

@ -22,7 +22,7 @@
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getServer().getPluginManager().callEvent(blockCookEvent);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+
+ if (blockCookEvent.isCancelled()) {
+ return;

View file

@ -69,7 +69,7 @@
+ CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack);
+
+ FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(CraftBlock.at(world, blockposition), fuel, tileentityfurnace.fuelTime(itemstack));
+ world.getServer().getPluginManager().callEvent(furnaceBurnEvent);
+ world.getCraftServer().getPluginManager().callEvent(furnaceBurnEvent);
+
+ if (furnaceBurnEvent.isCancelled()) {
+ return;
@ -108,7 +108,7 @@
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
+ world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent);
+
+ if (furnaceSmeltEvent.isCancelled()) {
+ return false;
@ -194,7 +194,7 @@
+ // CraftBukkit start - fire FurnaceExtractEvent
+ if (amount != 0) {
+ FurnaceExtractEvent event = new FurnaceExtractEvent((Player) entityhuman.getBukkitEntity(), CraftBlock.at(worldserver, blockposition), org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(itemstack.getItem()), amount, j);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ j = event.getExpToDrop();
+ }
+ // CraftBukkit end

View file

@ -93,7 +93,7 @@
+ }
+
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(iinventory.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ hopper.setItem(i, itemstack);
+ hopper.setCooldown(8); // Delay hopper checks
@ -146,7 +146,7 @@
boolean flag = false;
+ // CraftBukkit start
+ InventoryPickupItemEvent event = new InventoryPickupItemEvent(iinventory.getOwner().getInventory(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ entityitem.level.getServer().getPluginManager().callEvent(event);
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }

View file

@ -23,7 +23,7 @@
+ if (!this.isSticky) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -66,7 +66,7 @@
+ } else {
+ event = new BlockPistonRetractEvent(bblock, blocks, CraftBlock.notchToBlockFace(enumdirection1));
+ }
+ world.getServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ for (BlockPosition b : broken) {

View file

@ -110,7 +110,7 @@
+ // CraftBukkit start
+ public void loadCallback() {
+ org.bukkit.Server server = this.level.getServer();
+ org.bukkit.Server server = this.level.getCraftServer();
+ if (server != null) {
+ /*
+ * If it's a new world, the first few chunks are generated inside
@ -144,7 +144,7 @@
+ }
+
+ public void unloadCallback() {
+ org.bukkit.Server server = this.level.getServer();
+ org.bukkit.Server server = this.level.getCraftServer();
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isNeedsSaving());
+ server.getPluginManager().callEvent(unloadEvent);
+ // note: saving can be prevented, but not forced if no saving is actually required

View file

@ -23,7 +23,7 @@
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+ generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event);
+ generatoraccess.getMinecraftWorld().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
@ -39,7 +39,7 @@
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
+ generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event);
+ generatoraccess.getMinecraftWorld().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ continue;

View file

@ -83,7 +83,7 @@
+ org.bukkit.World bworld = this.level.getWorld();
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blockList.getList(), bworld, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.NETHER_PAIR);
+
+ this.level.getServer().getPluginManager().callEvent(event);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return Optional.empty();
+ }

View file

@ -335,7 +335,7 @@ public class CraftEventFactory {
*/
public static BlockMultiPlaceEvent callBlockMultiPlaceEvent(WorldServer world, EntityHuman who, EnumHand hand, List<BlockState> blockStates, int clickedX, int clickedY, int clickedZ) {
CraftWorld craftWorld = world.getWorld();
CraftServer craftServer = world.getServer();
CraftServer craftServer = world.getCraftServer();
Player player = (Player) who.getBukkitEntity();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
@ -363,7 +363,7 @@ public class CraftEventFactory {
public static BlockPlaceEvent callBlockPlaceEvent(WorldServer world, EntityHuman who, EnumHand hand, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) {
CraftWorld craftWorld = world.getWorld();
CraftServer craftServer = world.getServer();
CraftServer craftServer = world.getCraftServer();
Player player = (Player) who.getBukkitEntity();
@ -409,7 +409,7 @@ public class CraftEventFactory {
org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(clickedFace);
EntityPlaceEvent event = new EntityPlaceEvent(entity.getBukkitEntity(), who, blockClicked, blockFace);
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -579,7 +579,7 @@ public class CraftEventFactory {
boolean isNpc = entity instanceof NPC;
if (spawnReason != SpawnReason.CUSTOM) {
if (isAnimal && !world.getWorld().getAllowAnimals() || isMonster && !world.getWorld().getAllowMonsters() || isNpc && !world.getServer().getServer().getSpawnNPCs()) {
if (isAnimal && !world.getWorld().getAllowAnimals() || isMonster && !world.getWorld().getAllowMonsters() || isNpc && !world.getCraftServer().getServer().getSpawnNPCs()) {
entity.die();
return false;
}
@ -1072,7 +1072,7 @@ public class CraftEventFactory {
public static FluidLevelChangeEvent callFluidLevelChangeEvent(World world, BlockPosition block, IBlockData newData) {
FluidLevelChangeEvent event = new FluidLevelChangeEvent(CraftBlock.at(world, block), CraftBlockData.fromData(newData));
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1148,7 +1148,7 @@ public class CraftEventFactory {
player.connection.a(new PacketPlayInCloseWindow(player.containerMenu.containerId));
}
CraftServer server = player.level.getServer();
CraftServer server = player.level.getCraftServer();
CraftPlayer craftPlayer = player.getBukkitEntity();
player.containerMenu.transferTo(container, craftPlayer);
@ -1202,7 +1202,7 @@ public class CraftEventFactory {
}
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace);
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1215,13 +1215,13 @@ public class CraftEventFactory {
public static BlockRedstoneEvent callRedstoneChange(World world, BlockPosition pos, int oldCurrent, int newCurrent) {
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), oldCurrent, newCurrent);
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static NotePlayEvent callNotePlayEvent(World world, BlockPosition pos, BlockPropertyInstrument instrument, int note) {
NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), org.bukkit.Instrument.getByType((byte) instrument.ordinal()), new org.bukkit.Note(note));
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1248,7 +1248,7 @@ public class CraftEventFactory {
}
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(block.getX(), block.getY(), block.getZ()), cause, igniter);
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1282,7 +1282,7 @@ public class CraftEventFactory {
}
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, bukkitIgniter);
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1291,25 +1291,25 @@ public class CraftEventFactory {
org.bukkit.entity.Entity igniter = explosion.source == null ? null : explosion.source.getBukkitEntity();
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), IgniteCause.EXPLOSION, igniter);
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition pos, IgniteCause cause, Entity igniter) {
BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, igniter.getBukkitEntity());
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static void handleInventoryCloseEvent(EntityHuman human) {
InventoryCloseEvent event = new InventoryCloseEvent(human.containerMenu.getBukkitView());
human.level.getServer().getPluginManager().callEvent(event);
human.level.getCraftServer().getPluginManager().callEvent(event);
human.containerMenu.transferTo(human.inventoryMenu, human.getBukkitEntity());
}
public static ItemStack handleEditBookEvent(EntityPlayer player, int itemInHandIndex, ItemStack itemInHand, ItemStack newBookItem) {
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), (itemInHandIndex >= 0 && itemInHandIndex <= 8) ? itemInHandIndex : -1, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
player.level.getServer().getPluginManager().callEvent(editBookEvent);
player.level.getCraftServer().getPluginManager().callEvent(editBookEvent);
// If they've got the same item in their hand, it'll need to be updated.
if (itemInHand != null && itemInHand.getItem() == Items.WRITABLE_BOOK) {
@ -1327,13 +1327,13 @@ public class CraftEventFactory {
public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(EntityInsentient entity, EntityHuman player) {
PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity());
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static PlayerLeashEntityEvent callPlayerLeashEntityEvent(EntityInsentient entity, Entity leashHolder, EntityHuman player) {
PlayerLeashEntityEvent event = new PlayerLeashEntityEvent(entity.getBukkitEntity(), leashHolder.getBukkitEntity(), (Player) player.getBukkitEntity());
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1393,13 +1393,13 @@ public class CraftEventFactory {
event = new PlayerStatisticIncrementEvent(player, stat, current, newValue, material);
}
}
entityHuman.level.getServer().getPluginManager().callEvent(event);
entityHuman.level.getCraftServer().getPluginManager().callEvent(event);
return (Cancellable) event;
}
public static FireworkExplodeEvent callFireworkExplodeEvent(EntityFireworks firework) {
FireworkExplodeEvent event = new FireworkExplodeEvent((Firework) firework.getBukkitEntity());
firework.level.getServer().getPluginManager().callEvent(event);
firework.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1419,19 +1419,19 @@ public class CraftEventFactory {
public static EntityToggleGlideEvent callToggleGlideEvent(EntityLiving entity, boolean gliding) {
EntityToggleGlideEvent event = new EntityToggleGlideEvent((LivingEntity) entity.getBukkitEntity(), gliding);
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static EntityToggleSwimEvent callToggleSwimEvent(EntityLiving entity, boolean swimming) {
EntityToggleSwimEvent event = new EntityToggleSwimEvent((LivingEntity) entity.getBukkitEntity(), swimming);
entity.level.getServer().getPluginManager().callEvent(event);
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
public static AreaEffectCloudApplyEvent callAreaEffectCloudApplyEvent(EntityAreaEffectCloud cloud, List<LivingEntity> entities) {
AreaEffectCloudApplyEvent event = new AreaEffectCloudApplyEvent((AreaEffectCloud) cloud.getBukkitEntity(), entities);
cloud.level.getServer().getPluginManager().callEvent(event);
cloud.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1447,7 +1447,7 @@ public class CraftEventFactory {
CraftItemStack bredWithStack = bredWith == null ? null : CraftItemStack.asCraftMirror(bredWith).clone();
EntityBreedEvent event = new EntityBreedEvent((LivingEntity) child.getBukkitEntity(), (LivingEntity) mother.getBukkitEntity(), (LivingEntity) father.getBukkitEntity(), breederEntity, bredWithStack, experience);
child.level.getServer().getPluginManager().callEvent(event);
child.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
@ -1511,7 +1511,7 @@ public class CraftEventFactory {
blockState.setData(block);
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
world.getCraftServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);