diff options
author | md_5 <git@md-5.net> | 2016-12-09 12:45:21 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-12-09 12:45:21 +1100 |
commit | caf86c88a91b7b87bb2ace9b28d4ecaa60120c92 (patch) | |
tree | a782d3a940503406abab48c2cd9b3ebad72cfcff /nms-patches/WorldServer.patch | |
parent | 521b64741e4ba929fbf8bc9f4da4caa2f0e3d9e1 (diff) | |
download | craftbukkit-caf86c88a91b7b87bb2ace9b28d4ecaa60120c92.tar craftbukkit-caf86c88a91b7b87bb2ace9b28d4ecaa60120c92.tar.gz craftbukkit-caf86c88a91b7b87bb2ace9b28d4ecaa60120c92.tar.lz craftbukkit-caf86c88a91b7b87bb2ace9b28d4ecaa60120c92.tar.xz craftbukkit-caf86c88a91b7b87bb2ace9b28d4ecaa60120c92.zip |
Use CraftEventFactory for BlockFormEvent
Diffstat (limited to 'nms-patches/WorldServer.patch')
-rw-r--r-- | nms-patches/WorldServer.patch | 70 |
1 files changed, 26 insertions, 44 deletions
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index f73bc578..37c8b6f0 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -267,39 +267,21 @@ this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true)); } else { this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false)); -@@ -297,11 +437,29 @@ +@@ -297,11 +437,11 @@ BlockPosition blockposition1 = blockposition.down(); if (this.v(blockposition1)) { - this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData()); -+ // CraftBukkit start -+ BlockState blockState = this.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()).getState(); -+ blockState.setTypeId(Block.getId(Blocks.ICE)); -+ -+ BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState); -+ this.getServer().getPluginManager().callEvent(iceBlockForm); -+ if (!iceBlockForm.isCancelled()) { -+ blockState.update(true); -+ } -+ // CraftBukkit end ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE, null); // CraftBukkit } if (flag && this.f(blockposition, true)) { - this.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData()); -+ // CraftBukkit start -+ BlockState blockState = this.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); -+ blockState.setTypeId(Block.getId(Blocks.SNOW_LAYER)); -+ -+ BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState); -+ this.getServer().getPluginManager().callEvent(snow); -+ if (!snow.isCancelled()) { -+ blockState.update(true); -+ } -+ // CraftBukkit end ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER, null); // CraftBukkit } if (flag && this.getBiome(blockposition1).d()) { -@@ -376,7 +534,7 @@ +@@ -376,7 +516,7 @@ public boolean b(BlockPosition blockposition, Block block) { NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block); @@ -308,7 +290,7 @@ } public void a(BlockPosition blockposition, Block block, int i) { -@@ -415,8 +573,8 @@ +@@ -415,8 +555,8 @@ nextticklistentry.a(j); } @@ -319,7 +301,7 @@ this.nextTickList.add(nextticklistentry); } } -@@ -438,15 +596,15 @@ +@@ -438,15 +578,15 @@ nextticklistentry.a((long) i + this.worldData.getTime()); } @@ -338,7 +320,7 @@ if (this.emptyTime++ >= 300) { return; } -@@ -516,11 +674,17 @@ +@@ -516,11 +656,17 @@ } else { int i = this.nextTickList.size(); @@ -358,7 +340,7 @@ } this.methodProfiler.a("cleaning"); -@@ -533,8 +697,9 @@ +@@ -533,8 +679,9 @@ break; } @@ -369,7 +351,7 @@ this.U.add(nextticklistentry); } -@@ -604,7 +769,7 @@ +@@ -604,7 +751,7 @@ if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) { if (flag) { if (i == 0) { @@ -378,7 +360,7 @@ } iterator.remove(); -@@ -622,6 +787,7 @@ +@@ -622,6 +769,7 @@ return arraylist; } @@ -386,7 +368,7 @@ public void entityJoinedWorld(Entity entity, boolean flag) { if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { entity.die(); -@@ -633,6 +799,7 @@ +@@ -633,6 +781,7 @@ super.entityJoinedWorld(entity, flag); } @@ -394,7 +376,7 @@ private boolean getSpawnNPCs() { return this.server.getSpawnNPCs(); -@@ -645,7 +812,54 @@ +@@ -645,7 +794,54 @@ protected IChunkProvider n() { IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); @@ -450,7 +432,7 @@ } public boolean a(EntityHuman entityhuman, BlockPosition blockposition) { -@@ -707,6 +921,23 @@ +@@ -707,6 +903,23 @@ int j = this.worldProvider.getSeaLevel(); int k = 8; @@ -474,7 +456,7 @@ if (blockposition != null) { i = blockposition.getX(); k = blockposition.getZ(); -@@ -716,7 +947,7 @@ +@@ -716,7 +929,7 @@ int l = 0; @@ -483,7 +465,7 @@ i += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64); ++l; -@@ -758,6 +989,7 @@ +@@ -758,6 +971,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkProviderServer(); if (chunkproviderserver.e()) { @@ -491,7 +473,7 @@ if (iprogressupdate != null) { iprogressupdate.a("Saving level"); } -@@ -768,7 +1000,8 @@ +@@ -768,7 +982,8 @@ } chunkproviderserver.a(flag); @@ -501,7 +483,7 @@ Iterator iterator = arraylist.iterator(); while (iterator.hasNext()) { -@@ -803,6 +1036,12 @@ +@@ -803,6 +1018,12 @@ } } @@ -514,7 +496,7 @@ this.worldData.a(this.getWorldBorder().getSize()); this.worldData.d(this.getWorldBorder().getCenterX()); this.worldData.c(this.getWorldBorder().getCenterZ()); -@@ -816,9 +1055,13 @@ +@@ -816,9 +1037,13 @@ this.worldMaps.a(); } @@ -530,7 +512,7 @@ public void a(Collection<Entity> collection) { ArrayList arraylist = Lists.newArrayList(collection); -@@ -837,7 +1080,7 @@ +@@ -837,7 +1062,7 @@ private boolean i(Entity entity) { if (entity.dead) { @@ -539,7 +521,7 @@ return false; } else { UUID uuid = entity.getUniqueID(); -@@ -849,7 +1092,7 @@ +@@ -849,7 +1074,7 @@ this.f.remove(entity1); } else { if (!(entity instanceof EntityHuman)) { @@ -548,7 +530,7 @@ return false; } -@@ -902,8 +1145,16 @@ +@@ -902,8 +1127,16 @@ } public boolean strikeLightning(Entity entity) { @@ -566,7 +548,7 @@ return true; } else { return false; -@@ -919,10 +1170,20 @@ +@@ -919,10 +1152,20 @@ } public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { @@ -587,7 +569,7 @@ if (!flag1) { explosion.clearBlocks(); } -@@ -968,7 +1229,8 @@ +@@ -968,7 +1211,8 @@ BlockActionData blockactiondata = (BlockActionData) iterator.next(); if (this.a(blockactiondata)) { @@ -597,7 +579,7 @@ } } -@@ -991,6 +1253,7 @@ +@@ -991,6 +1235,7 @@ boolean flag = this.W(); super.t(); @@ -605,7 +587,7 @@ if (this.n != this.o) { this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID()); } -@@ -1009,6 +1272,21 @@ +@@ -1009,6 +1254,21 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q)); } @@ -627,7 +609,7 @@ } -@@ -1038,10 +1316,20 @@ +@@ -1038,10 +1298,20 @@ } public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) { |