From 4c7c4bb94d5f1c95ec21f7a7dd7d6bcc27bece82 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sun, 26 Feb 2012 12:33:52 +0100 Subject: [PATCH] v0.9.6: - projectile fix - multiple worlds without multiverse fix --- src/de/jaschastarke/minecraft/integration/Communicator.java | 6 +++++- src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/jaschastarke/minecraft/integration/Communicator.java b/src/de/jaschastarke/minecraft/integration/Communicator.java index 3ae43da..111c473 100644 --- a/src/de/jaschastarke/minecraft/integration/Communicator.java +++ b/src/de/jaschastarke/minecraft/integration/Communicator.java @@ -47,9 +47,13 @@ public class Communicator extends AbstractCommunicator { } public GameMode getDefaultGameMode(World world) { GameMode def = Bukkit.getServer().getDefaultGameMode(); - if (isPluginEnabled("Multiverse-Core")) + if (isMultiVerse()) def = MultiVerse.getGameMode(world); Core.debug("com: "+world.getName()+": game mode: "+def); return def; } + + public boolean isMultiVerse() { + return isPluginEnabled("Multiverse-Core"); + } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index 67ca9be..7bc5310 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -277,7 +277,7 @@ public class LCPlayer { public void onDamage(Entity from, EntityDamageByEntityEvent event) { // receives damage if (from instanceof Player) { // its PVP - Player attacker = (Player) event.getDamager(); + Player attacker = (Player) from; if (attacker.getGameMode() == GameMode.CREATIVE) { if (!plugin.config.getPermissionsEnabled() || !Players.get(attacker).hasPermission(Perms.NoLimit.PVP)) { event.setCancelled(true); @@ -423,7 +423,7 @@ public class LCPlayer { // result: change him back to default mode if (checkSwitchFlight(area_event)) { setRegionGameMode(null); - if (event == null || event.getTo().getWorld() == event.getFrom().getWorld()) { + if (event == null || event.getTo().getWorld() == event.getFrom().getWorld() || !plugin.com.isMultiVerse()) { // do not enforce the game mode change, on world teleport, as multiverse may cancel the event afterwards // the world-change game-mode change is done by multiworld getPlayer().setGameMode(DEFAULT_GAMEMODE);