diff --git a/pom.xml b/pom.xml
index 8855662..360f103 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,12 @@
Multiverse-Core
2.4
+
+
+ multiworld
+ multiworld
+ 4.6.6
+
com.cypherx
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java
index 974d620..5b9ee9c 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/FeatureBlockItemSpawn.java
@@ -110,10 +110,10 @@ public class FeatureBlockItemSpawn extends CoreModule implement
/**
* Don't default Plugin-debug to this mod. Because it is too spammy.
- * /
+ */
public boolean isDebug() {
return debug;
- }*/
+ }
private class CleanUp extends BukkitRunnable {
public long maxTime = 0;
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java
index 80bb47d..dc5e9cc 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Hooks.java
@@ -6,6 +6,7 @@ import de.jaschastarke.hooking.BooleanHooker;
import de.jaschastarke.hooking.GetHooker;
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMeHooks;
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiVerseHooks;
+import de.jaschastarke.minecraft.limitedcreative.hooks.MultiWorldHooks;
import de.jaschastarke.minecraft.limitedcreative.hooks.PlayerCheckHooker;
import de.jaschastarke.minecraft.limitedcreative.hooks.WorldTypeHooker;
import de.jaschastarke.minecraft.limitedcreative.hooks.xAuthHooks;
@@ -34,6 +35,8 @@ public final class Hooks {
}
if (isPluginEnabled("Multiverse-Core")) {
new MultiVerseHooks(plugin);
+ } else if (isPluginEnabled("MultiWorld")) {
+ new MultiWorldHooks(plugin);
}
InventoryIncompatible.register(new GetHooker.Check() {
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/MultiWorldHooks.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/MultiWorldHooks.java
new file mode 100644
index 0000000..2583f37
--- /dev/null
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/hooks/MultiWorldHooks.java
@@ -0,0 +1,28 @@
+package de.jaschastarke.minecraft.limitedcreative.hooks;
+
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.World;
+
+import de.jaschastarke.minecraft.limitedcreative.Hooks;
+import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
+import multiworld.MultiWorldPlugin;
+import multiworld.api.MultiWorldAPI;
+
+public class MultiWorldHooks {
+ public MultiWorldHooks(final LimitedCreative plugin) {
+ Hooks.DefaultWorldGameMode.register(new WorldTypeHooker.Check() {
+ @Override
+ public GameMode get(World world) {
+ boolean creative = getMWApi().isCreativeWorld(world.getName());
+ GameMode gm = creative ? GameMode.CREATIVE : GameMode.SURVIVAL;
+ plugin.getLog().debug("MultiWorld: "+world.getName()+": game mode: "+gm);
+ return gm;
+ }
+ });
+ }
+
+ private static MultiWorldAPI getMWApi() {
+ return ((MultiWorldPlugin) Bukkit.getServer().getPluginManager().getPlugin("MultiWorld")).getApi();
+ }
+}
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java
index f805dc0..bd92784 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/inventories/PlayerListener.java
@@ -19,6 +19,7 @@ package de.jaschastarke.minecraft.limitedcreative.inventories;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
@@ -32,7 +33,7 @@ public class PlayerListener implements Listener {
this.mod = mod;
}
- @EventHandler
+ @EventHandler(priority=EventPriority.LOW, ignoreCancelled = true)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
boolean isLoggedIn = Hooks.IsLoggedIn.test(event.getPlayer());
if (mod.isDebug()) {
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
index a2a706b..6cc5a59 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
@@ -8,7 +8,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
@@ -80,14 +79,14 @@ public class PlayerListener extends Listener {
return mod.getRegionManager().getRegionSet(player.getLocation()).allows(Flags.GAMEMODE_OPTIONAL);
}
- @EventHandler(priority = EventPriority.LOW)
+ @EventHandler(ignoreCancelled = true)
public void onGameModeChange(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
PlayerMeta pmeta = new PlayerMeta(player);
GameMode gm = event.getNewGameMode();
if (mod.isDebug())
- mod.getLog().debug(player.getName() + " is changing to GameMode " + gm);;
+ mod.getLog().debug(player.getName() + " is changing to GameMode " + gm);
if (Hooks.IsLoggedIn.test(player)) { // if authme is changing GameMode before going to teleport, this should be remembered
if (pmeta.isActiveRegionGameMode()) { // change to the other gamemode as the area defines
if (!pmeta.isActiveRegionGameMode(gm)) { // only when we are not switching to the mode the region allows