parent
fac79282df
commit
e47632793a
|
@ -31,6 +31,7 @@ import java.util.List;
|
|||
public class ChestShop extends JavaPlugin {
|
||||
|
||||
public static final File folder = new File("plugins/ChestShop");
|
||||
public static final String chatPrefix = "[ChestShop] ";
|
||||
private static EbeanServer DB;
|
||||
|
||||
private static PluginDescriptionFile description;
|
||||
|
|
|
@ -6,6 +6,7 @@ package com.Acrobot.ChestShop.Config;
|
|||
public enum Property {
|
||||
PREFERRED_ECONOMY_PLUGIN("", "Preferred economy plugin (iConomy, BOSEconomy, Essentials). If you do not want to specify this, leave it blank."),
|
||||
REVERSE_BUTTONS(false, "If true, people will buy with left-click and sell with right-click."),
|
||||
//ALLOW_LEFT_CLICK_DESTROYING(false, "If true, if you left-click your own shop sign you won't open chest's inventory, but instead you will start destroying the sign."),
|
||||
SERVER_ECONOMY_ACCOUNT("", "Economy account's name you want Admin Shops to be assigned to"),
|
||||
ADMIN_SHOP_NAME("Admin Shop", "First line of your admin shop should look like this"),
|
||||
SHOP_CREATION_PRICE(0, "Amount of money player must pay to create a shop"),
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.Acrobot.ChestShop.Config.Config;
|
|||
import com.Acrobot.ChestShop.Config.Language;
|
||||
import com.Acrobot.ChestShop.Config.Property;
|
||||
import com.Acrobot.ChestShop.Permission;
|
||||
import com.Acrobot.ChestShop.Protection.Default;
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.Default;
|
||||
import com.Acrobot.ChestShop.Shop.ShopManagement;
|
||||
import com.Acrobot.ChestShop.Signs.restrictedSign;
|
||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||
|
|
|
@ -5,8 +5,9 @@ import com.Acrobot.ChestShop.Config.Config;
|
|||
import com.Acrobot.ChestShop.Economy;
|
||||
import com.Acrobot.ChestShop.Items.Odd;
|
||||
import com.Acrobot.ChestShop.Permission;
|
||||
import com.Acrobot.ChestShop.Protection.LWCplugin;
|
||||
import com.Acrobot.ChestShop.Protection.LockettePlugin;
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.LWCplugin;
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.LockettePlugin;
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.OldLockettePlugin;
|
||||
import com.Acrobot.ChestShop.Protection.Security;
|
||||
import com.griefcraft.lwc.LWCPlugin;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
@ -28,7 +29,6 @@ import java.util.List;
|
|||
public class pluginEnable extends ServerListener {
|
||||
|
||||
public static final Methods methods = new Methods(Config.getPreferred());
|
||||
private static final String lineStart = "[ChestShop] ";
|
||||
|
||||
private static final List<String> pluginsToLoad = new LinkedList<String>(Arrays.asList(
|
||||
"Permissions",
|
||||
|
@ -44,7 +44,7 @@ public class pluginEnable extends ServerListener {
|
|||
if (!methods.hasMethod()) {
|
||||
if (methods.setMethod(event.getPlugin())) {
|
||||
Economy.economy = methods.getMethod();
|
||||
System.out.println(lineStart + Economy.economy.getName() + ' ' + Economy.economy.getVersion() + " loaded.");
|
||||
System.out.println(ChestShop.chatPrefix + Economy.economy.getName() + ' ' + Economy.economy.getVersion() + " loaded.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,13 +68,18 @@ public class pluginEnable extends ServerListener {
|
|||
LWCplugin.setLWC(((LWCPlugin) plugin).getLWC());
|
||||
Security.protection = new LWCplugin();
|
||||
} else if (name.equals("Lockette")) {
|
||||
if (LockettePlugin.lockette != null) return;
|
||||
LockettePlugin.lockette = (Lockette) plugin;
|
||||
if (OldLockettePlugin.lockette != null || LockettePlugin.lockette != null) return;
|
||||
if (plugin.getClass().getName().equals("com.daemitus.lockette.Lockette")) {
|
||||
LockettePlugin.lockette = (com.daemitus.lockette.Lockette) plugin;
|
||||
Security.protection = new LockettePlugin();
|
||||
} else {
|
||||
OldLockettePlugin.lockette = (Lockette) plugin;
|
||||
Security.protection = new OldLockettePlugin();
|
||||
}
|
||||
} else if (name.equals("OddItem")) {
|
||||
if (Odd.oddItem != null) return;
|
||||
Odd.oddItem = (OddItem) plugin;
|
||||
}
|
||||
System.out.println(lineStart + description.getName() + " version " + description.getVersion() + " loaded.");
|
||||
System.out.println(ChestShop.chatPrefix + description.getName() + " version " + description.getVersion() + " loaded.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.Acrobot.ChestShop.Config.Property;
|
|||
import com.Acrobot.ChestShop.Economy;
|
||||
import com.Acrobot.ChestShop.Items.Items;
|
||||
import com.Acrobot.ChestShop.Permission;
|
||||
import com.Acrobot.ChestShop.Protection.Default;
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.Default;
|
||||
import com.Acrobot.ChestShop.Protection.Security;
|
||||
import com.Acrobot.ChestShop.Signs.restrictedSign;
|
||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.Acrobot.ChestShop.Protection;
|
||||
package com.Acrobot.ChestShop.Protection.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.Protection.Protection;
|
||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||
import com.Acrobot.ChestShop.Utils.uLongName;
|
||||
import org.bukkit.block.Block;
|
|
@ -1,6 +1,7 @@
|
|||
package com.Acrobot.ChestShop.Protection;
|
||||
package com.Acrobot.ChestShop.Protection.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.Protection.Protection;
|
||||
import com.griefcraft.lwc.LWC;
|
||||
import com.griefcraft.model.ProtectionTypes;
|
||||
import com.griefcraft.modules.limits.LimitsModule;
|
||||
|
@ -16,10 +17,11 @@ public class LWCplugin implements Protection {
|
|||
private static LimitsModule limitsModule;
|
||||
|
||||
|
||||
public static void setLWC(LWC LWC){
|
||||
public static void setLWC(LWC LWC) {
|
||||
lwc = LWC;
|
||||
limitsModule = new LimitsModule();
|
||||
}
|
||||
|
||||
public boolean isProtected(Block block) {
|
||||
return lwc.findProtection(block) != null;
|
||||
}
|
||||
|
@ -31,7 +33,12 @@ public class LWCplugin implements Protection {
|
|||
public boolean protect(String name, Block block) {
|
||||
if (lwc.findProtection(block) != null) return false;
|
||||
Player player = ChestShop.getBukkitServer().getPlayer(name);
|
||||
if (player != null && lwc.getPhysicalDatabase().getProtectionCount(name) >= limitsModule.mapProtectionLimit(player, block.getTypeId())) return false;
|
||||
try {
|
||||
if (player != null && limitsModule.hasReachedLimit(player, block)) return false;
|
||||
} catch (NoSuchMethodError e) {
|
||||
System.out.println(ChestShop.chatPrefix + "Your LWC plugin is outdated!");
|
||||
}
|
||||
|
||||
lwc.getPhysicalDatabase().registerProtection(block.getTypeId(), ProtectionTypes.PRIVATE, block.getWorld().getName(), name, "", block.getX(), block.getY(), block.getZ());
|
||||
return true;
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package com.Acrobot.ChestShop.Protection;
|
||||
package com.Acrobot.ChestShop.Protection.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.Protection.Protection;
|
||||
import com.daemitus.lockette.Lockette;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.yi.acru.bukkit.Lockette.Lockette;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
|
@ -16,7 +17,7 @@ public class LockettePlugin implements Protection {
|
|||
|
||||
public boolean canAccess(Player player, Block block) {
|
||||
int length = (player.getName().length() > 15? 15 : player.getName().length());
|
||||
return player.getName().substring(0, length).equals(Lockette.getProtectedOwner(block));
|
||||
return player.getName().substring(0, length).equals(Lockette.getOwnerName(block));
|
||||
}
|
||||
|
||||
public boolean protect(String name, Block block) {
|
|
@ -0,0 +1,26 @@
|
|||
package com.Acrobot.ChestShop.Protection.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.Protection.Protection;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.yi.acru.bukkit.Lockette.Lockette;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
*/
|
||||
public class OldLockettePlugin implements Protection {
|
||||
public static Lockette lockette;
|
||||
|
||||
public boolean isProtected(Block block) {
|
||||
return Lockette.isProtected(block);
|
||||
}
|
||||
|
||||
public boolean canAccess(Player player, Block block) {
|
||||
int length = (player.getName().length() > 15? 15 : player.getName().length());
|
||||
return player.getName().substring(0, length).equals(Lockette.getProtectedOwner(block));
|
||||
}
|
||||
|
||||
public boolean protect(String name, Block block) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.Acrobot.ChestShop.Protection;
|
||||
|
||||
import com.Acrobot.ChestShop.Protection.Plugins.Default;
|
||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||
import com.Acrobot.ChestShop.Utils.uLongName;
|
||||
import org.bukkit.block.Block;
|
||||
|
|
|
@ -2,7 +2,7 @@ name: ChestShop
|
|||
|
||||
main: com.Acrobot.ChestShop.ChestShop
|
||||
|
||||
version: 3.03
|
||||
version: 3.04
|
||||
|
||||
|
||||
author: Acrobot
|
||||
|
|
Loading…
Reference in New Issue