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
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 API for plugins to add custom tools directly via Spout
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)

View File

@ -12,4 +12,4 @@ public class FakeBlockBreakEvent extends BlockBreakEvent {
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player);
}
}
}

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.config.Config;
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.items.McMMOItemSpawnEvent;
@ -110,14 +111,15 @@ public class Misc {
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
}
FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getItemInHand(), true);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
mcMMO.p.getServer().getPluginManager().callEvent(breakEvent);
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (!damageEvent.isCancelled() || !breakEvent.isCancelled()) {
return true;
}
else {
} else {
return false;
}
}