From 0155bcedb7f00726d0b2f14e612a5342322a8278 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 14 Dec 2011 16:31:08 +0100 Subject: Updated all modules to new api, some settings are still missing --- .../com/earth2me/essentials/protect/EssentialsConnect.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 569123cd5..7f9ec44e4 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.protect; -import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; +import com.earth2me.essentials.api.IReload; +import com.earth2me.essentials.api.IEssentials; +import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.protect.data.ProtectedBlockMemory; import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; @@ -45,7 +45,7 @@ public class EssentialsConnect return ess; } - public void alert(final User user, final String item, final String type) + public void alert(final IUser user, final String item, final String type) { final Location loc = user.getLocation(); final String warnMessage = _("alertFormat", user.getName(), type, item, @@ -54,7 +54,7 @@ public class EssentialsConnect LOGGER.log(Level.WARNING, warnMessage); for (Player p : ess.getServer().getOnlinePlayers()) { - final User alertUser = ess.getUser(p); + final IUser alertUser = ess.getUser(p); if (alertUser.isAuthorized("essentials.protect.alerts")) { alertUser.sendMessage(warnMessage); @@ -63,10 +63,10 @@ public class EssentialsConnect } - private class ProtectReloader implements IConf + private class ProtectReloader implements IReload { @Override - public void reloadConfig() + public void onReload() { if (protect.getStorage() != null) { -- cgit v1.2.3 From 7153676137a23f6780b21682456377b0f86b6fb1 Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 3 Jan 2012 00:07:44 +0100 Subject: Starting to break Protect --- .../com/earth2me/essentials/protect/EssentialsConnect.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 7f9ec44e4..6f724ac87 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -1,13 +1,13 @@ package com.earth2me.essentials.protect; -import com.earth2me.essentials.api.IReload; +import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; +import com.earth2me.essentials.api.IReload; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.protect.data.ProtectedBlockMemory; import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; import java.beans.PropertyVetoException; -import static com.earth2me.essentials.I18n._; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; @@ -30,7 +30,7 @@ public class EssentialsConnect ess = (IEssentials)essPlugin; protect = (IProtect)essProtect; ProtectReloader pr = new ProtectReloader(); - pr.reloadConfig(); + pr.onReload(); ess.addReloadListener(pr); LOGGER.info(_("loadinfo", essProtect.getDescription().getName(), essProtect.getDescription().getVersion(), "essentials team")); @@ -72,7 +72,8 @@ public class EssentialsConnect { protect.getStorage().onPluginDeactivation(); } - for (ProtectConfig protectConfig : ProtectConfig.values()) + + /*for (ProtectConfig protectConfig : ProtectConfig.values()) { if (protectConfig.isList()) { @@ -87,7 +88,7 @@ public class EssentialsConnect protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); } - } + }*/ if (protect.getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) { -- cgit v1.2.3 From d64c73fc51817b3698510b7eea0cdfa274a58c63 Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 10 Jan 2012 00:36:09 +0100 Subject: Finished Protect, Essentials should build now. --- .../essentials/protect/EssentialsConnect.java | 79 ++++++++++++---------- 1 file changed, 42 insertions(+), 37 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 6f724ac87..b208b5e43 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -72,54 +72,59 @@ public class EssentialsConnect { protect.getStorage().onPluginDeactivation(); } - - /*for (ProtectConfig protectConfig : ProtectConfig.values()) - { - if (protectConfig.isList()) - { - protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); - } - else if (protectConfig.isString()) - { - protect.getSettingsString().put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); - } - else - { - protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); - } - }*/ + /* + * for (ProtectConfig protectConfig : ProtectConfig.values()) { if (protectConfig.isList()) { + * protect.getSettingsList().put(protectConfig, + * ess.getSettings().getProtectList(protectConfig.getConfigName())); } else if (protectConfig.isString()) { + * protect.getSettingsString().put(protectConfig, + * ess.getSettings().getProtectString(protectConfig.getConfigName())); } else { + * protect.getSettingsBoolean().put(protectConfig, + * ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), + * protectConfig.getDefaultValueBoolean())); } + * + * } + */ - if (protect.getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) + ProtectHolder settings = protect.getSettings(); + settings.acquireReadLock(); + try { - try + if (settings.getData().getDbtype().equalsIgnoreCase("mysql")) { - protect.setStorage(new ProtectedBlockMySQL( - protect.getSettingString(ProtectConfig.mysqlDB), - protect.getSettingString(ProtectConfig.dbUsername), - protect.getSettingString(ProtectConfig.dbPassword))); + try + { + protect.setStorage(new ProtectedBlockMySQL( + settings.getData().getDburl(), + settings.getData().getDbuser(), + settings.getData().getDbpassword())); + } + catch (PropertyVetoException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } } - catch (PropertyVetoException ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - } - else - { - try + else { - protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); + try + { + protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); + } + catch (PropertyVetoException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } } - catch (PropertyVetoException ex) + /*if (protect.getSettingBool(ProtectConfig.memstore)) { - LOGGER.log(Level.SEVERE, null, ex); - } + protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); + }*/ + } - if (protect.getSettingBool(ProtectConfig.memstore)) + finally { - protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); + settings.unlock(); } - } } } -- cgit v1.2.3 From 703c5741bd665078f5363651fe2fa95dd36acbfb Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 10 Jan 2012 01:02:23 +0100 Subject: Essentials should run now... --- .../src/com/earth2me/essentials/protect/EssentialsConnect.java | 1 + 1 file changed, 1 insertion(+) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index b208b5e43..38c6cc3f9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -29,6 +29,7 @@ public class EssentialsConnect } ess = (IEssentials)essPlugin; protect = (IProtect)essProtect; + protect.setSettings(new ProtectHolder(ess)); ProtectReloader pr = new ProtectReloader(); pr.onReload(); ess.addReloadListener(pr); -- cgit v1.2.3 From f4413633b8c1ad5dd888370158fe412fa00a66d3 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 28 Jan 2012 13:48:30 +0000 Subject: Clean more imports. --- .../src/com/earth2me/essentials/protect/EssentialsConnect.java | 1 - 1 file changed, 1 deletion(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 5988bd06f..0b39920b5 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IReload; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.protect.data.ProtectedBlockMemory; import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; import java.beans.PropertyVetoException; -- cgit v1.2.3 From 8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 5 Feb 2012 17:19:32 +0100 Subject: Modified BetterLocation, and new Permission-System --- .../src/com/earth2me/essentials/protect/EssentialsConnect.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 0b39920b5..539ff208b 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -43,7 +43,7 @@ public class EssentialsConnect return ess; } - public void alert(final IUser user, final String item, final String type) + public void alert(final Player user, final String item, final String type) { final Location loc = user.getLocation(); final String warnMessage = _("alertFormat", user.getName(), type, item, @@ -53,7 +53,7 @@ public class EssentialsConnect for (Player p : ess.getServer().getOnlinePlayers()) { final IUser alertUser = ess.getUser(p); - if (alertUser.isAuthorized("essentials.protect.alerts")) + if (Permissions.ALERTS.isAuthorized(alertUser)) { alertUser.sendMessage(warnMessage); } -- cgit v1.2.3 From 7b8a9d60d7da4cba5013671920b1064f711b4538 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 2 Mar 2012 21:48:03 +1100 Subject: I honestly have no idea if this works, but on paper it does. Will be great, now to figure out how to test. --- .../earth2me/essentials/protect/EssentialsConnect.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 539ff208b..9f1cc122a 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -66,10 +66,6 @@ public class EssentialsConnect @Override public void onReload() { - if (protect.getStorage() != null) - { - protect.getStorage().onPluginDeactivation(); - } /* * for (ProtectConfig protectConfig : ProtectConfig.values()) { if (protectConfig.isList()) { @@ -97,7 +93,7 @@ public class EssentialsConnect settings.getData().getDbuser(), settings.getData().getDbpassword())); } - catch (PropertyVetoException ex) + catch (ClassNotFoundException ex) { LOGGER.log(Level.SEVERE, null, ex); } @@ -108,15 +104,15 @@ public class EssentialsConnect { protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); } - catch (PropertyVetoException ex) + catch (ClassNotFoundException ex) { LOGGER.log(Level.SEVERE, null, ex); } } - /*if (protect.getSettingBool(ProtectConfig.memstore)) - { - protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); - }*/ + /* + * if (protect.getSettingBool(ProtectConfig.memstore)) { protect.setStorage(new + * ProtectedBlockMemory(protect.getStorage(), protect)); } + */ } finally -- cgit v1.2.3 From 22a37a0c1bfdad81196a38e23c120e9ddee4b43f Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 3 Mar 2012 02:40:22 +0100 Subject: Revert "I honestly have no idea if this works, but on paper it does. Will be great, now to figure out how to test." until there is a real alternative. This reverts commit 7b8a9d60d7da4cba5013671920b1064f711b4538. --- .../earth2me/essentials/protect/EssentialsConnect.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 9f1cc122a..539ff208b 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -66,6 +66,10 @@ public class EssentialsConnect @Override public void onReload() { + if (protect.getStorage() != null) + { + protect.getStorage().onPluginDeactivation(); + } /* * for (ProtectConfig protectConfig : ProtectConfig.values()) { if (protectConfig.isList()) { @@ -93,7 +97,7 @@ public class EssentialsConnect settings.getData().getDbuser(), settings.getData().getDbpassword())); } - catch (ClassNotFoundException ex) + catch (PropertyVetoException ex) { LOGGER.log(Level.SEVERE, null, ex); } @@ -104,15 +108,15 @@ public class EssentialsConnect { protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); } - catch (ClassNotFoundException ex) + catch (PropertyVetoException ex) { LOGGER.log(Level.SEVERE, null, ex); } } - /* - * if (protect.getSettingBool(ProtectConfig.memstore)) { protect.setStorage(new - * ProtectedBlockMemory(protect.getStorage(), protect)); } - */ + /*if (protect.getSettingBool(ProtectConfig.memstore)) + { + protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); + }*/ } finally -- cgit v1.2.3