This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
What is the enhancement in mind? How should it look and feel?
Add the ability to allow each individual package to be optionally limited to a list of worlds it is available in.
Please provide any additional information below.
Add a message to config.yml
RestrictedWorld: '&cYou cannot purchase that in this world. You need to be in : %worlds'
Example config.yml package excerpt :
packages: ExamplePackage: price: 100 description: This is an example package. ... RestrictToWorlds: - PvE - Creative
Change to code for handling purchase :
} else if (args[0].equalsIgnoreCase("purchase")) {if (args.length != 2) { s.sendMessage(Prefix + InvalidArguments); return true;} if (!DonationPoints.permission.has(s, "shop.purchase")) { s.sendMessage(Prefix + noPermissionMessage); return true;}String packName = args[1];String caseSensitivePackName = packName;
// Resolve the supplied package name to the case sensitive equivalent from the config.List<String> packages = new ArrayList<String>(plugin.getConfig().getConfigurationSection("packages").getKeys(false));for (String packageName : packages){ if (packageName.toLowerCase().equals(packName.toLowerCase())) { caseSensitivePackName = packageName; break; }}packName = caseSensitivePackName;// If this is package is restricted to any worlds, then check the player is in one of the configured worldsif (plugin.getConfig().contains("packages." + PackName + ".RestrictToWorlds")){ Player p = (Player) s; String worldName = p.getLocation().getWorld().getName().toLowerCase(); boolean worldFound = false; //s.sendMessage("player is in : " + worldName); List<String> worlds = plugin.getConfig().getStringList("packages." + PackName + ".RestrictToWorlds"); for (String world : worlds) { //s.sendMessage("comparing : " + worldName + " and " + world.toLowerCase()); if (worldName.equals(world.toLowerCase())) { worldFound = true; //s.sendMessage("matched."); break; } } if (worldFound == false) { s.sendMessage(Prefix + RestrictedWorldMessage.replace("%worlds", worlds.toString())); return true; }}
To post a comment, please login or register a new account.