Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Fix ThermosCommand + 'Horrible Code Hack'
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer committed Feb 7, 2016
1 parent f488fd9 commit 35aba60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions patches/net/minecraftforge/event/ForgeEventFactory.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
MinecraftForge.EVENT_BUS.post(event);
return event.success;
@@ -80,25 +94,140 @@
@@ -80,25 +94,139 @@
@Deprecated // Location version below
public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original)
{
Expand Down Expand Up @@ -127,11 +127,10 @@
+ aktor = org.bukkit.event.block.Action.LEFT_CLICK_AIR;
+ break;
+ }
+ if(!(x==0 && y==0 && z == 0 && face==-1)) {
+ if((x==0 && y==0 && z == 0 && face==-1)) { y = 256; face = 0;} // 0, 256, 0, 0,
+ org.bukkit.event.player.PlayerInteractEvent eve = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(player, aktor, x, y, z, face, player.getHeldItem());
+ event.cb = eve;
+ if(eve.isCancelled()) { event.setCanceled(true); return event; }
+ }
+ if (isSpawn(player) && nonVanilla(player))
+ {
+ event.setCanceled(true);
Expand Down Expand Up @@ -163,11 +162,11 @@
+ aktor = org.bukkit.event.block.Action.LEFT_CLICK_AIR;
+ break;
+ }
+ if(!(x==0 && y==0 && z == 0 && face==-1)) {
+ if((x==0 && y==0 && z == 0 && face==-1)) { y = 256; face = 0;} // 0, 256, 0, 0,
+ org.bukkit.event.player.PlayerInteractEvent eve = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(player, aktor, x, y, z, face, player.getHeldItem());
+ event.cb = eve;
+ if(eve.isCancelled()) { event.setCanceled(true); return event; }
+ }
+
+ if (isSpawn(player) && nonVanilla(player))
+ {
+ event.setCanceled(true);
Expand All @@ -180,7 +179,7 @@
}

public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack)
@@ -182,30 +311,64 @@
@@ -182,30 +310,64 @@
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/thermos/ThermosCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ThermosCommand() {
super(NAME);

StringBuilder builder = new StringBuilder();
builder.append(String.format("-------------------[" + ChatColor.RED + "Thermos" + ChatColor.RESET + "]-------------------"))
builder.append(String.format("-------------------[" + ChatColor.RED + "Thermos" + ChatColor.RESET + "]-------------------"));
builder.append(String.format("/%s check - Check for an update.\n", NAME));
builder.append(String.format("/%s tps - Show tps statistics.\n", NAME));
builder.append(String.format("/%s restart - Restart the server.\n", NAME));
Expand Down

0 comments on commit 35aba60

Please sign in to comment.