mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Add multiworld difficulty
This commit is contained in:
parent
d97bbfb1b1
commit
c566ead9ef
@ -406,6 +406,9 @@ public class MVWorld {
|
||||
* @return
|
||||
*/
|
||||
public boolean setVariable(String name, String value) {
|
||||
if (name.equalsIgnoreCase("diff") || name.equalsIgnoreCase("difficulty")) {
|
||||
return this.setDifficulty(value);
|
||||
}
|
||||
if (name.equalsIgnoreCase("alias")) {
|
||||
this.setAlias(value);
|
||||
return true;
|
||||
@ -733,4 +736,28 @@ public class MVWorld {
|
||||
public Location getSpawnLocation() {
|
||||
return this.spawnLocation;
|
||||
}
|
||||
|
||||
public World.Difficulty getDifficulty() {
|
||||
return this.getCBWorld().getDifficulty();
|
||||
}
|
||||
|
||||
public boolean setDifficulty(String difficulty) {
|
||||
try {
|
||||
World.Difficulty worlddiff = World.Difficulty.valueOf(difficulty);
|
||||
this.getCBWorld().setDifficulty(worlddiff);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
int diff = Integer.parseInt(difficulty);
|
||||
if(diff >= 0 && diff <= 3) {
|
||||
World.Difficulty worlddiff = World.Difficulty.getDifficulty(diff);
|
||||
this.getCBWorld().setDifficulty(worlddiff);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ enum Action {
|
||||
|
||||
// Color == Aliascolor
|
||||
enum SetProperties {
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger, food
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger, food, diff, difficulty
|
||||
}
|
||||
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
Loading…
Reference in New Issue
Block a user