This should make us AntiCheat friendly.

This commit is contained in:
nossr50 2012-06-03 14:38:33 -07:00
parent 6637758ad0
commit e3e400f376
4 changed files with 24 additions and 7 deletions

View File

@ -8,6 +8,7 @@ Key:
- Removal - Removal
Version 1.3.09 Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
+ Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP) + Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP)
+ Added API for plugins to add custom tools directly via Spout + Added API for plugins to add custom tools directly via Spout
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing) = Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)

View File

@ -0,0 +1,14 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.inventory.ItemStack;
public class FakeBlockDamageEvent extends BlockDamageEvent {
public FakeBlockDamageEvent(Player player, Block block,
ItemStack itemInHand, boolean instaBreak) {
super(player, block, itemInHand, instaBreak);
}
}

View File

@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
@ -111,13 +112,14 @@ public class Misc {
mcMMO.p.getServer().getPluginManager().callEvent(armswing); mcMMO.p.getServer().getPluginManager().callEvent(armswing);
} }
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getItemInHand(), true);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
mcMMO.p.getServer().getPluginManager().callEvent(breakEvent);
if (!event.isCancelled()) { if (!damageEvent.isCancelled() || !breakEvent.isCancelled()) {
return true; return true;
} } else {
else {
return false; return false;
} }
} }