Copy+Paste errors fixed + renaming of files to match module names

This commit is contained in:
Evenprime 2011-03-01 17:52:36 +01:00
parent e83984d2ce
commit 78c264d726
8 changed files with 26 additions and 24 deletions

View File

@ -3,5 +3,5 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.6b
version: 0.6c

View File

@ -167,18 +167,18 @@ public class NoCheatPlugin extends JavaPlugin {
// LOGGING IF NEEDED AND WHERE NEEDED
Level logLevel = null;
if(NoCheatConfiguration.movingActionMinor.contains("loglow")) {
if(actions.contains("loglow")) {
logLevel = Level.INFO;
}
if(NoCheatConfiguration.movingActionMinor.contains("logmed")) {
if(actions.contains("logmed")) {
logLevel = Level.WARNING;
}
if(NoCheatConfiguration.movingActionMinor.contains("loghigh")) {
if(actions.contains("loghigh")) {
logLevel = Level.SEVERE;
}
if(logLevel != null) {
NoCheatPlugin.log(logLevel, message);
NoCheatPlugin.log(logLevel, "NC: "+message);
}
}
/**

View File

@ -15,7 +15,7 @@ import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin;
* @author Evenprime
*
*/
public class BlockPlacingCheck {
public class AirbuildCheck {
public static void check(BlockPlaceEvent event) {

View File

@ -9,7 +9,7 @@ import org.bukkit.inventory.PlayerInventory;
import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin;
public class DupePrevention {
public class DupebydeathCheck {
/**
* Explicitly remove all items that are going to be dropped from the players inventory
@ -32,6 +32,7 @@ public class DupePrevention {
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)) {

View File

@ -303,14 +303,16 @@ public class MovingCheck {
*/
private static void action(PlayerMoveEvent event, String actions) {
if(actions == null) return;
// LOGGING IF NEEDED
NoCheatPlugin.logAction(actions, "Moving violation: "+event.getPlayer().getName()+" from " + String.format("(%.5f, %.5f, %.5f) to (%.5f, %.5f, %.5f)", event.getFrom().getX(), event.getFrom().getY(), event.getFrom().getZ(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()));
// RESET IF NEEDED
if(NoCheatConfiguration.movingActionMinor.contains("reset")) {
resetPlayer(event);
if(actions.contains("log")) {
NoCheatPlugin.logAction(actions, "Moving violation: "+event.getPlayer().getName()+" from " + String.format("(%.5f, %.5f, %.5f) to (%.5f, %.5f, %.5f)", event.getFrom().getX(), event.getFrom().getY(), event.getFrom().getZ(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()));
}
// RESET IF NEEDED
if(actions.contains("reset")) {
resetPlayer(event);
}
}

View File

@ -46,15 +46,12 @@ public class SpeedhackCheck {
else if(data.speedhackEventsSinceLastCheck > limitMed) action = NoCheatConfiguration.speedhackActionNormal;
else if(data.speedhackEventsSinceLastCheck > limitLow) action = NoCheatConfiguration.speedhackActionMinor;
if(action != null) {
if(data.speedhackSetBackPoint == null) {
data.speedhackSetBackPoint = event.getFrom().clone();
}
data.speedhackViolationsInARow++;
if(action == null) {
data.speedhackSetBackPoint = event.getFrom().clone();
data.speedhackViolationsInARow = 0;
}
else {
data.speedhackViolationsInARow = 0;
data.speedhackSetBackPoint = null;
data.speedhackViolationsInARow++;
}
if(data.speedhackViolationsInARow >= violationsLimit) {
@ -66,17 +63,19 @@ public class SpeedhackCheck {
data.speedhackLastCheck = time;
}
data.speedhackEventsSinceLastCheck++;
}
private static void action(String actions, PlayerMoveEvent event, NoCheatData data) {
if(actions == null) return;
// LOGGING IF NEEDED
if(actions.contains("log")) {
NoCheatPlugin.logAction(actions, event.getPlayer().getName()+" sent "+ data.speedhackEventsSinceLastCheck + " move events, but only "+NoCheatConfiguration.speedhackLimitLow+ " were allowed. Speedhack?");
}
// RESET IF NEEDED
if(NoCheatConfiguration.movingActionMinor.contains("reset")) {
if(actions.contains("reset")) {
resetPlayer(event, data);
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
import cc.co.evenprime.bukkit.nocheat.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.checks.BlockPlacingCheck;
import cc.co.evenprime.bukkit.nocheat.checks.AirbuildCheck;
/**
* Handle events for all Block related events
@ -23,6 +23,6 @@ public class NoCheatBlockListener extends BlockListener {
public void onBlockPlace(BlockPlaceEvent event) {
if(!event.isCancelled() && NoCheatConfiguration.airbuildCheckActive)
BlockPlacingCheck.check(event);
AirbuildCheck.check(event);
}
}

View File

@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import cc.co.evenprime.bukkit.nocheat.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.checks.DupePrevention;
import cc.co.evenprime.bukkit.nocheat.checks.DupebydeathCheck;
public class NoCheatEntityListener extends EntityListener {
@ -17,7 +17,7 @@ public class NoCheatEntityListener extends EntityListener {
public void onEntityDeath(EntityDeathEvent event) {
if(NoCheatConfiguration.dupebydeathCheckActive) {
DupePrevention.playerDeath(event);
DupebydeathCheck.playerDeath(event);
}
}
}