summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-01 22:06:00 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-01 22:06:00 +0000
commit3c59ec9c5862493543b0fa0efe96c7ed2354d05e (patch)
tree3cf92f7419d2e852ddc22fd3f91a020f36ee3d95 /EssentialsProtect/src/com/earth2me/essentials/protect
parent1e45b468dc4cb5ce78bb7cf666a14b217df7ea29 (diff)
downloadEssentials-3c59ec9c5862493543b0fa0efe96c7ed2354d05e.tar
Essentials-3c59ec9c5862493543b0fa0efe96c7ed2354d05e.tar.gz
Essentials-3c59ec9c5862493543b0fa0efe96c7ed2354d05e.tar.lz
Essentials-3c59ec9c5862493543b0fa0efe96c7ed2354d05e.tar.xz
Essentials-3c59ec9c5862493543b0fa0efe96c7ed2354d05e.zip
[trunk] Item lists in settings are now stored as Integer lists.
Also: Names from items.csv now work in item lists. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1084 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java16
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java6
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java12
3 files changed, 17 insertions, 17 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index ec93acc2c..3a041413f 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -26,12 +26,12 @@ public class EssentialsProtect extends JavaPlugin
public static HashMap<String, String> dataSettings = null;
public static HashMap<String, Boolean> guardSettings = null;
public static HashMap<String, Boolean> playerSettings = null;
- public static ArrayList usageList = null;
- public static ArrayList blackListPlace = null;
- public static ArrayList breakBlackList = null;
- public static ArrayList onPlaceAlert = null;
- public static ArrayList onUseAlert = null;
- public static ArrayList onBreakAlert = null;
+ public static ArrayList<Integer> usageList = null;
+ public static ArrayList<Integer> blackListPlace = null;
+ public static ArrayList<Integer> breakBlackList = null;
+ public static ArrayList<Integer> onPlaceAlert = null;
+ public static ArrayList<Integer> onUseAlert = null;
+ public static ArrayList<Integer> onBreakAlert = null;
public EssentialsProtect()
@@ -65,9 +65,9 @@ public class EssentialsProtect extends JavaPlugin
logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " maintained by " + AUTHORS);
}
- public static boolean checkProtectionItems(ArrayList itemList, int id)
+ public static boolean checkProtectionItems(ArrayList<Integer> itemList, int id)
{
- return !itemList.isEmpty() && itemList.contains(String.valueOf(id));
+ return !itemList.isEmpty() && itemList.contains(id);
}
@Override
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index be5757364..742cb9d6d 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -56,7 +56,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
- if (!EssentialsProtect.onPlaceAlert.isEmpty() && EssentialsProtect.onPlaceAlert.contains(String.valueOf(item.getTypeId())))
+ if (EssentialsProtect.checkProtectionItems(EssentialsProtect.onPlaceAlert, id))
{
parent.alert(user, item.getType().toString(), "placed: ");
}
@@ -192,13 +192,13 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
- if(EssentialsProtect.breakBlackList.contains(String.valueOf(block.getTypeId())) && !user.isAuthorized("essentials.protect.exemptbreak"))
+ if (EssentialsProtect.checkProtectionItems(EssentialsProtect.breakBlackList, block.getTypeId()) && !user.isAuthorized("essentials.protect.exemptbreak"))
{
event.setCancelled(true);
return;
}
- if (!EssentialsProtect.onBreakAlert.isEmpty() && EssentialsProtect.onBreakAlert.contains(String.valueOf(block.getTypeId())))
+ if (EssentialsProtect.checkProtectionItems(EssentialsProtect.onBreakAlert, block.getTypeId()))
{
parent.alert(user, block.getType().toString(), "broke: ");
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index 0c9cddec5..f8ef85cc7 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -45,11 +45,11 @@ public class EssentialsProtectPlayerListener extends PlayerListener
}
- if (item != null && EssentialsProtect.checkProtectionItems(EssentialsProtect.usageList, item.getTypeId()) && !user.isAuthorized("essentials.protect.exemptusage"))
- {
- event.setCancelled(true);
- return;
- }
+ if (item != null && EssentialsProtect.checkProtectionItems(EssentialsProtect.usageList, item.getTypeId()) && !user.isAuthorized("essentials.protect.exemptusage"))
+ {
+ event.setCancelled(true);
+ return;
+ }
if (user.isAuthorized("essentials.protect.admin"))
{
@@ -61,7 +61,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
+ ownerName);
}
}
- if (item != null && EssentialsProtect.onUseAlert.contains(String.valueOf(item.getTypeId())))
+ if (item != null && EssentialsProtect.checkProtectionItems(EssentialsProtect.onUseAlert, item.getTypeId()))
{
parent.alert(user, item.getType().toString(), "used: ");
}