mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Recognize certain combinations as quick combos; hopefully fix #168
This commit is contained in:
1 parent
6ad7ca1c9d
commit
6ac4d61df1
1 file changed
+23
@@ -19,7 +19,10 @@
|
||||
package net.h31ix.anticheat.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -42,6 +45,7 @@ public final class Utilities {
|
||||
private static final List<Material> SHEARS = new ArrayList<Material>();
|
||||
private static final List<Material> SHOVELS = new ArrayList<Material>();
|
||||
private static final List<Material> ANY = new ArrayList<Material>();
|
||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||
|
||||
public static void alert(List<String> message) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
@@ -205,9 +209,22 @@ public final class Utilities {
|
||||
} else if (result < 0) {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
if(isQuickCombo(tool, block)) {
|
||||
result = result/2;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean isQuickCombo(ItemStack tool, Material block) {
|
||||
for(Material t : COMBO.keySet()) {
|
||||
if(tool.getType() == t && COMBO.get(t) == block) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean blockIsnt(Block block, Material[] materials) {
|
||||
Material type = block.getType();
|
||||
@@ -278,5 +295,11 @@ public final class Utilities {
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.POTATO_ITEM);
|
||||
|
||||
COMBO.put(Material.SHEARS, Material.WOOL);
|
||||
COMBO.put(Material.IRON_SWORD, Material.WEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, Material.WEB);
|
||||
COMBO.put(Material.STONE_SWORD, Material.WEB);
|
||||
COMBO.put(Material.WOOD_SWORD, Material.WEB);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user