mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 03:02:11 +01:00
Removed dupebydeath-check because it is no longer needed starting with
build #520
This commit is contained in:
parent
3bcb55d2b2
commit
75122fb1af
@ -3,7 +3,7 @@ name: NoCheatPlugin
|
||||
author: Evenprime
|
||||
|
||||
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
|
||||
version: 0.6.4a
|
||||
version: 0.6.4b
|
||||
|
||||
commands:
|
||||
nocheat:
|
||||
|
@ -27,7 +27,6 @@ public class NoCheatConfiguration {
|
||||
public static boolean speedhackCheckActive;
|
||||
public static boolean movingCheckActive;
|
||||
public static boolean airbuildCheckActive;
|
||||
public static boolean dupebydeathCheckActive;
|
||||
public static boolean bedteleportCheckActive;
|
||||
|
||||
// Limits for the speedhack check
|
||||
@ -102,7 +101,6 @@ public class NoCheatConfiguration {
|
||||
speedhackCheckActive = c.getBoolean("active.speedhack", true);
|
||||
movingCheckActive = c.getBoolean("active.moving", true);
|
||||
airbuildCheckActive = c.getBoolean("active.airbuild", false);
|
||||
dupebydeathCheckActive = c.getBoolean("active.dupebydeath", true);
|
||||
bedteleportCheckActive = c.getBoolean("active.bedteleport", true);
|
||||
|
||||
speedhackLimitLow = c.getInt("speedhack.limits.low", 30);
|
||||
@ -177,7 +175,7 @@ public class NoCheatConfiguration {
|
||||
w.write(" high: loghigh reset"); w.newLine();
|
||||
w.write("# Moving specific optionse") ;w.newLine();
|
||||
w.write("moving:"); w.newLine();
|
||||
w.write(" freemoves: 10"); w.newLine();
|
||||
w.write(" freemoves: 5"); w.newLine();
|
||||
w.write("# Moving Action, one or more of 'loglow logmed loghigh reset'"); w.newLine();
|
||||
w.write(" action:"); w.newLine();
|
||||
w.write(" low: loglow reset"); w.newLine();
|
||||
@ -187,8 +185,6 @@ public class NoCheatConfiguration {
|
||||
w.write("airbuild:"); w.newLine();
|
||||
w.write("# Airbuild Action, one or more of 'loglow logmed loghigh deny'"); w.newLine();
|
||||
w.write(" action: logmed deny"); w.newLine();
|
||||
w.write("# Dupebydeath specific options (none exist yet)"); w.newLine();
|
||||
w.write("dupebydeath:"); w.newLine();
|
||||
w.write("# Bedteleport specific options (none exist yet)"); w.newLine();
|
||||
w.write("bedteleport:"); w.newLine();
|
||||
|
||||
|
@ -139,7 +139,6 @@ public class NoCheatPlugin extends JavaPlugin {
|
||||
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Lowest, this); // used for speedhack and moving checks
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this); // used to delete old data of users
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Low, this); // used for airbuild check
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Highest, this); // used for dupebydeath check
|
||||
pm.registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Lowest, this); // used for teleportfrombed check
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
@ -248,7 +247,6 @@ public class NoCheatPlugin extends JavaPlugin {
|
||||
return (NoCheatConfiguration.movingCheckActive ? "moving ": "") +
|
||||
(NoCheatConfiguration.speedhackCheckActive ? "speedhack " : "") +
|
||||
(NoCheatConfiguration.airbuildCheckActive ? "airbuild " : "") +
|
||||
(NoCheatConfiguration.dupebydeathCheckActive ? "dupebydeath " : "") +
|
||||
(NoCheatConfiguration.bedteleportCheckActive ? "bedteleport " : "");
|
||||
}
|
||||
|
||||
@ -257,7 +255,6 @@ public class NoCheatPlugin extends JavaPlugin {
|
||||
return (!NoCheatConfiguration.movingCheckActive ? "moving* ": (hasPermission(p, "nocheat.moving") ? "moving " : "") +
|
||||
(!NoCheatConfiguration.speedhackCheckActive ? "speedhack* " : (hasPermission(p, "nocheat.speedhack") ? "speedhack " : "")) +
|
||||
(!NoCheatConfiguration.airbuildCheckActive ? "airbuild* " : (hasPermission(p, "nocheat.airbuild") ? "airbuild " : "")) +
|
||||
(!NoCheatConfiguration.dupebydeathCheckActive ? "dupebydeath* " : (hasPermission(p, "nocheat.dupebydeath") ? "dupebydeath " : "")) +
|
||||
(!NoCheatConfiguration.bedteleportCheckActive ? "bedteleport* " : (hasPermission(p, "nocheat.bedteleport") ? "bedteleport " : "")) +
|
||||
(hasPermission(p, "nocheat.notify") ? "notify " : ""));
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
package cc.co.evenprime.bukkit.nocheat.checks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin;
|
||||
|
||||
public class DupebydeathCheck {
|
||||
|
||||
/**
|
||||
* Explicitly remove all items that are going to be dropped from the players inventory
|
||||
* @param event
|
||||
*/
|
||||
public static void playerDeath(EntityDeathEvent event) {
|
||||
|
||||
if(event.getEntity() instanceof Player) {
|
||||
|
||||
Player p = (Player)event.getEntity();
|
||||
|
||||
// Should we prevent at all?
|
||||
if(NoCheatPlugin.hasPermission(p, "nocheat.dupebydeath"))
|
||||
return;
|
||||
|
||||
PlayerInventory playerInventory = p.getInventory();
|
||||
List<ItemStack> drops = event.getDrops();
|
||||
|
||||
// Go through the "to-be-dropped" items and delete the corresponding items from the players inventory
|
||||
for(ItemStack drop : drops) {
|
||||
for(int i = 0; i < playerInventory.getSize(); i++) {
|
||||
if(playerInventory.getItem(i).equals(drop)) {
|
||||
playerInventory.clear(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,10 @@
|
||||
package cc.co.evenprime.bukkit.nocheat.listeners;
|
||||
|
||||
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheatConfiguration;
|
||||
import cc.co.evenprime.bukkit.nocheat.checks.DupebydeathCheck;
|
||||
|
||||
public class NoCheatEntityListener extends EntityListener {
|
||||
|
||||
@Override
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
|
||||
if(NoCheatConfiguration.dupebydeathCheckActive) {
|
||||
DupebydeathCheck.playerDeath(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user