mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
Add more currency stuff, lots of cleanup.
This commit is contained in:
parent
9e1484408c
commit
dac95eceba
@ -83,7 +83,7 @@ public class MVPlayerListener extends PlayerListener {
|
||||
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.world.import", true)) {
|
||||
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.core.import", true)) {
|
||||
event.getPlayer().sendMessage("You don't have any worlds imported into Multiverse!");
|
||||
event.getPlayer().sendMessage("You can import your current worlds with " + ChatColor.AQUA + "/mvimport");
|
||||
event.getPlayer().sendMessage("or you can create new ones with " + ChatColor.GOLD + "/mvcreate");
|
||||
|
@ -148,18 +148,6 @@ public class MVWorld {
|
||||
// }
|
||||
}
|
||||
|
||||
private void setCurrency(int currency) {
|
||||
this.currency = currency;
|
||||
config.getInt("worlds." + this.name + ".entryfee.currency", currency);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private void setPrice(double price) {
|
||||
this.price = price;
|
||||
config.setProperty("worlds." + this.name + ".entryfee.amount", price);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private void addToUpperLists(Permission permission) {
|
||||
Permission all = this.plugin.getServer().getPluginManager().getPermission("multiverse.*");
|
||||
Permission allWorlds = this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*");
|
||||
@ -393,7 +381,7 @@ public class MVWorld {
|
||||
this.setAliasColor(value);
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("currency")) {
|
||||
if (name.equalsIgnoreCase("currency") || name.equalsIgnoreCase("curr")) {
|
||||
try {
|
||||
int intValue = Integer.parseInt(value);
|
||||
this.setCurrency(intValue);
|
||||
@ -587,7 +575,23 @@ public class MVWorld {
|
||||
return this.price;
|
||||
}
|
||||
|
||||
private void setCurrency(int currency) {
|
||||
this.currency = currency;
|
||||
config.getInt("worlds." + this.name + ".entryfee.currency", currency);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private void setPrice(double price) {
|
||||
this.price = price;
|
||||
config.setProperty("worlds." + this.name + ".entryfee.amount", price);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public boolean isExempt(Player p) {
|
||||
return (this.plugin.getPermissions().hasPermission(p, this.exempt.getName(), true));
|
||||
}
|
||||
|
||||
public Permission getExempt() {
|
||||
return this.exempt;
|
||||
}
|
||||
}
|
||||
|
@ -262,15 +262,21 @@ public class MultiverseCore extends JavaPlugin {
|
||||
if (forceLoad) {
|
||||
// Remove all world permissions.
|
||||
Permission allAccess = this.getServer().getPluginManager().getPermission("multiverse.access.*");
|
||||
Permission allExempt = this.getServer().getPluginManager().getPermission("multiverse.exempt.*");
|
||||
for (MVWorld w : this.worlds.values()) {
|
||||
// Remove this world from the master list
|
||||
if (allAccess != null) {
|
||||
allAccess.getChildren().remove(w.getPermission().getName());
|
||||
}
|
||||
if (allExempt != null) {
|
||||
allExempt.getChildren().remove(w.getPermission().getName());
|
||||
}
|
||||
this.getServer().getPluginManager().removePermission(w.getPermission().getName());
|
||||
this.getServer().getPluginManager().removePermission(w.getExempt().getName());
|
||||
}
|
||||
// Recalc the all permission
|
||||
this.getServer().getPluginManager().recalculatePermissionDefaults(allAccess);
|
||||
this.getServer().getPluginManager().recalculatePermissionDefaults(allExempt);
|
||||
this.worlds.clear();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class InfoCommand extends MultiverseCommand {
|
||||
this.addKey("mvinfo");
|
||||
this.addKey("mvi");
|
||||
this.addKey("mv info");
|
||||
this.setPermission("multiverse.world.coord", "Returns detailed information on the world.", PermissionDefault.OP);
|
||||
this.setPermission("multiverse.core.coord", "Returns detailed information on the world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,7 +21,7 @@ enum Action {
|
||||
|
||||
// Color == Aliascolor
|
||||
enum SetProperties {
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price
|
||||
}
|
||||
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
@ -24,7 +24,6 @@ public class DestinationFactory {
|
||||
Class<? extends Destination> myClass = this.destList.get(idenChar);
|
||||
try {
|
||||
Destination mydest = myClass.newInstance();
|
||||
System.out.print(idenChar);
|
||||
if(!mydest.isThisType((MultiverseCore) this.plugin, dest)) {
|
||||
return new InvalidDestination();
|
||||
}
|
||||
|
@ -23,29 +23,24 @@ public class ExactDestination extends Destination {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
return false;
|
||||
}
|
||||
System.out.print("Checking Exact Dest");
|
||||
List<String> parsed = Arrays.asList(destination.split(":"));
|
||||
// Need at least: e:world:x,y,z
|
||||
// OR e:world:x,y,z:pitch:yaw
|
||||
// so basically 3 or 5
|
||||
if (!(parsed.size() == 3 || parsed.size() == 5)) {
|
||||
System.out.print("Invalid Args:" + parsed.size());
|
||||
return false;
|
||||
}
|
||||
// If it's not an Exact type
|
||||
if (!parsed.get(0).equalsIgnoreCase("e")) {
|
||||
System.out.print("No E found");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If it's not a MV world
|
||||
if (!((MultiverseCore)plugin).isMVWorld(parsed.get(1))) {
|
||||
System.out.print("Not a MV world");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parsed.get(2).matches(coordRegex)) {
|
||||
System.out.print("Invalid Regex");
|
||||
return false;
|
||||
}
|
||||
// This is 1 now, because we've removed 2
|
||||
|
Loading…
Reference in New Issue
Block a user