mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 11:20:32 +01:00
Fix && should be ||, Allow Creative mode, Set all players in a world to a specific mode when it's changed
This commit is contained in:
parent
40c4ce0a37
commit
97168043ff
@ -424,11 +424,12 @@ public class MVWorld {
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("gamemode") && name.equalsIgnoreCase("mode")) {
|
||||
if (name.equalsIgnoreCase("gamemode") || name.equalsIgnoreCase("mode")) {
|
||||
try {
|
||||
GameMode mode = GameMode.valueOf(value);
|
||||
GameMode mode = GameMode.valueOf(value.toUpperCase());
|
||||
return this.setGameMode(mode);
|
||||
} catch (Exception e) {
|
||||
System.out.print("BLASKNKENFW");
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,9 +654,15 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
private boolean setGameMode(GameMode mode) {
|
||||
|
||||
this.gameMode = mode;
|
||||
config.setProperty("worlds." + this.name + ".gamemode", this.gameMode.toString());
|
||||
saveConfig();
|
||||
|
||||
for(Player p : this.plugin.getServer().getWorld(this.getName()).getPlayers()) {
|
||||
this.plugin.log(Level.FINER, "Setting " + p.getName() + "'s GameMode to " + this.gameMode.toString());
|
||||
this.plugin.getPlayerListener().handleGameMode(p, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -614,4 +614,8 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
return this.worldManager;
|
||||
}
|
||||
|
||||
public MVPlayerListener getPlayerListener() {
|
||||
return this.playerListener;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class MVPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleGameMode(Player player, MVWorld world) {
|
||||
public void handleGameMode(Player player, MVWorld world) {
|
||||
// We perform this task one tick later to MAKE SURE that the player actually reaches the
|
||||
// destination world, otherwise we'd be changing the player mode if they havent moved anywhere.
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new HandleGameMode(player, world), 1L);
|
||||
|
Loading…
Reference in New Issue
Block a user