mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 13:57:49 +01:00
Deactivate dropCheck for now, as it faces an unsolvable problem
This commit is contained in:
parent
bc9869a68f
commit
9735f3fac1
@ -26,4 +26,6 @@ public interface NoCheatPlayer {
|
||||
public float getSpeedAmplifier();
|
||||
|
||||
public boolean isCreative();
|
||||
|
||||
public void closeInventory();
|
||||
}
|
||||
|
@ -4,11 +4,25 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissibleBase;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
|
||||
public class NoCheatCommandSender extends PermissibleBase implements CommandSender {
|
||||
|
||||
private static final ServerOperator serverOperator = new ServerOperator() {
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
public NoCheatCommandSender() {
|
||||
super(null);
|
||||
super(serverOperator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -18,8 +32,7 @@ public class NoCheatCommandSender extends PermissibleBase implements CommandSend
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
// We don't want to receive messages, as we can't do anything with them
|
||||
// anyway
|
||||
// We don't want messages
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,6 +76,7 @@ public abstract class Check {
|
||||
|
||||
try {
|
||||
command = action.getCommand(player, check);
|
||||
System.out.println("Going to execute command "+command);
|
||||
plugin.getServer().dispatchCommand(noCheatCommandSender, command);
|
||||
} catch(CommandException e) {
|
||||
System.out.println("[NoCheat] failed to execute the command '" + command + "': " + e.getMessage() + ", please check if everything is setup correct. ");
|
||||
|
@ -21,6 +21,7 @@ public class CCInventory implements ConfigItem {
|
||||
dropTimeFrame = data.getInteger(Configuration.INVENTORY_DROP_TIMEFRAME);
|
||||
dropLimit = data.getInteger(Configuration.INVENTORY_DROP_LIMIT);
|
||||
dropActions = data.getActionList(Configuration.INVENTORY_DROP_ACTIONS);
|
||||
|
||||
closebeforeteleports = data.getBoolean(Configuration.INVENTORY_PREVENTITEMDUPE);
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import cc.co.evenprime.bukkit.nocheat.data.ExecutionHistory;
|
||||
|
||||
public class InventoryData implements DataItem {
|
||||
|
||||
public int dropVL = 0;
|
||||
public double dropTotalVL = 0;
|
||||
public int dropFailed = 0;
|
||||
public int dropVL = 0;
|
||||
public double dropTotalVL = 0;
|
||||
public int dropFailed = 0;
|
||||
public long dropLastTime;
|
||||
public int dropCount;
|
||||
public final ExecutionHistory history = new ExecutionHistory();
|
||||
public final ExecutionHistory history = new ExecutionHistory();
|
||||
|
||||
@Override
|
||||
public void collectData(Map<String, Object> map) {
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -14,7 +13,6 @@ import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
||||
import cc.co.evenprime.bukkit.nocheat.config.ConfigurationCacheStore;
|
||||
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
|
||||
import cc.co.evenprime.bukkit.nocheat.debug.PerformanceManager.EventType;
|
||||
import cc.co.evenprime.bukkit.nocheat.events.EventManagerImpl;
|
||||
|
||||
public class InventoryEventManager extends EventManagerImpl {
|
||||
@ -25,18 +23,20 @@ public class InventoryEventManager extends EventManagerImpl {
|
||||
super(plugin);
|
||||
|
||||
this.checks = new ArrayList<InventoryCheck>(1);
|
||||
this.checks.add(new DropCheck(plugin));
|
||||
|
||||
// Don't use this check now, it's buggy
|
||||
//this.checks.add(new DropCheck(plugin));
|
||||
|
||||
registerListener(Event.Type.PLAYER_DROP_ITEM, Priority.Lowest, true, plugin.getPerformance(EventType.INVENTORY));
|
||||
//registerListener(Event.Type.PLAYER_DROP_ITEM, Priority.Lowest, true, plugin.getPerformance(EventType.INVENTORY));
|
||||
registerListener(Event.Type.PLAYER_TELEPORT, Priority.Monitor, true, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerTeleportEvent(final PlayerTeleportEvent event, final Priority priority) {
|
||||
|
||||
CraftPlayer player = (CraftPlayer) event.getPlayer();
|
||||
if(InventoryCheck.getConfig(plugin.getPlayer(player).getConfigurationStore()).closebeforeteleports && event.getTo() != null && !(event.getTo().getWorld().equals(player.getWorld()))) {
|
||||
player.getHandle().closeInventory();
|
||||
NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
|
||||
if(InventoryCheck.getConfig(player.getConfigurationStore()).closebeforeteleports && event.getTo() != null && !(event.getTo().getWorld().equals(player.getPlayer().getWorld()))) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,15 +62,15 @@ public class InventoryEventManager extends EventManagerImpl {
|
||||
}
|
||||
|
||||
if(cancelled)
|
||||
event.setCancelled(cancelled);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public List<String> getActiveChecks(ConfigurationCacheStore cc) {
|
||||
LinkedList<String> s = new LinkedList<String>();
|
||||
|
||||
CCInventory i = InventoryCheck.getConfig(cc);
|
||||
/*CCInventory i = InventoryCheck.getConfig(cc);
|
||||
if(i.check && i.dropCheck)
|
||||
s.add("inventory.dropCheck");
|
||||
s.add("inventory.dropCheck");*/
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ public abstract class Configuration {
|
||||
|
||||
protected final static OptionNode ROOT = new OptionNode(null, null, DataType.PARENT);
|
||||
|
||||
protected final static OptionNode INACTIVE = new OptionNode(null, null, DataType.PARENT);
|
||||
|
||||
private final static OptionNode LOGGING = new OptionNode("logging", ROOT, DataType.PARENT);
|
||||
public final static OptionNode LOGGING_ACTIVE = new OptionNode("active", LOGGING, DataType.BOOLEAN);
|
||||
public final static OptionNode LOGGING_PREFIX = new OptionNode("prefix", LOGGING, DataType.STRING);
|
||||
@ -34,9 +36,9 @@ public abstract class Configuration {
|
||||
|
||||
private final static OptionNode INVENTORY = new OptionNode("inventory", ROOT, DataType.PARENT);
|
||||
public final static OptionNode INVENTORY_PREVENTITEMDUPE = new OptionNode("preventitemdupe", INVENTORY, DataType.BOOLEAN);
|
||||
public static final OptionNode INVENTORY_CHECK = new OptionNode("check", INVENTORY, DataType.BOOLEAN);
|
||||
public static final OptionNode INVENTORY_CHECK = new OptionNode("check", INACTIVE, DataType.BOOLEAN);
|
||||
|
||||
private final static OptionNode INVENTORY_DROP = new OptionNode("drop", INVENTORY, DataType.PARENT);
|
||||
private final static OptionNode INVENTORY_DROP = new OptionNode("drop", INACTIVE, DataType.PARENT);
|
||||
public final static OptionNode INVENTORY_DROP_CHECK = new OptionNode("check", INVENTORY_DROP, DataType.BOOLEAN);
|
||||
public final static OptionNode INVENTORY_DROP_TIMEFRAME = new OptionNode("timeframe", INVENTORY_DROP, DataType.INTEGER);
|
||||
public final static OptionNode INVENTORY_DROP_LIMIT = new OptionNode("limit", INVENTORY_DROP, DataType.INTEGER);
|
||||
|
@ -37,8 +37,8 @@ public class DefaultConfiguration extends Configuration {
|
||||
|
||||
/*** INVENTORY ***/
|
||||
{
|
||||
setValue(INVENTORY_CHECK, true);
|
||||
setValue(INVENTORY_PREVENTITEMDUPE, true);
|
||||
/*setValue(INVENTORY_CHECK, true);
|
||||
|
||||
setValue(INVENTORY_DROP_CHECK, true);
|
||||
setValue(INVENTORY_DROP_TIMEFRAME, 20);
|
||||
@ -47,7 +47,7 @@ public class DefaultConfiguration extends Configuration {
|
||||
ActionList dropActionList = new ActionList();
|
||||
dropActionList.setActions(0, action.getActions("dropLog dropCancel".split(" ")));
|
||||
dropActionList.setActions(500, action.getActions("dropLog dropCancel dropkick".split(" ")));
|
||||
setValue(INVENTORY_DROP_ACTIONS, dropActionList);
|
||||
setValue(INVENTORY_DROP_ACTIONS, dropActionList);*/
|
||||
}
|
||||
|
||||
/*** MOVING ***/
|
||||
|
@ -95,4 +95,8 @@ public class NoCheatPlayerImpl implements NoCheatPlayer {
|
||||
public boolean isCreative() {
|
||||
return player.getGameMode() == GameMode.CREATIVE;
|
||||
}
|
||||
|
||||
public void closeInventory() {
|
||||
((CraftPlayer) this.player).getHandle().closeInventory();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user