mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Remove Static Abuse - WorldGuardUtils
This commit is contained in:
parent
3aa896cfc9
commit
7c0d1f4e0a
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -44,7 +43,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import com.gmail.nossr50.skills.mining.MiningManager;
|
|||||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -249,7 +248,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -343,7 +342,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -412,7 +411,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -482,7 +481,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import com.gmail.nossr50.skills.taming.TamingManager;
|
|||||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -78,7 +77,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,7 +114,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getEntity().getShooter();
|
Player player = (Player) event.getEntity().getShooter();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -276,7 +275,7 @@ public class EntityListener implements Listener {
|
|||||||
Entity defender = event.getEntity();
|
Entity defender = event.getEntity();
|
||||||
Entity attacker = event.getDamager();
|
Entity attacker = event.getDamager();
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(pluginRef.getWorldGuardUtils().isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(attacker instanceof Player) {
|
if(attacker instanceof Player) {
|
||||||
|
|
||||||
@ -450,7 +449,7 @@ public class EntityListener implements Listener {
|
|||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -528,7 +527,7 @@ public class EntityListener implements Listener {
|
|||||||
if (owner instanceof Player) {
|
if (owner instanceof Player) {
|
||||||
Player player = (Player) owner;
|
Player player = (Player) owner;
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -745,7 +744,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -783,7 +782,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -846,7 +845,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -947,7 +946,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -993,7 +992,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
|
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
@ -93,7 +92,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -126,7 +125,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -158,7 +157,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -225,7 +224,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -343,7 +342,7 @@ public class InventoryListener implements Listener {
|
|||||||
// Player player = (Player) whoClicked;
|
// Player player = (Player) whoClicked;
|
||||||
//
|
//
|
||||||
// /* WORLD GUARD MAIN FLAG CHECK */
|
// /* WORLD GUARD MAIN FLAG CHECK */
|
||||||
// if (WorldGuardUtils.isWorldGuardLoaded()) {
|
// if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
// if (!plugin.getWorldGuardManager().hasMainFlag(player))
|
// if (!plugin.getWorldGuardManager().hasMainFlag(player))
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
@ -466,7 +465,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.Party;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
|
|
||||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||||
@ -23,7 +22,6 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.Motd;
|
import com.gmail.nossr50.util.Motd;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -67,7 +65,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -106,7 +104,7 @@ public class PlayerListener implements Listener {
|
|||||||
String deathMessage = event.getDeathMessage();
|
String deathMessage = event.getDeathMessage();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getEntity()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getEntity()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,7 +149,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player killer = killedPlayer.getKiller();
|
Player killer = killedPlayer.getKiller();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(killedPlayer))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(killedPlayer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -215,7 +213,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,7 +245,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -322,7 +320,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -415,7 +413,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -567,7 +565,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -682,7 +680,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
|||||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -72,7 +71,7 @@ public class SelfListener implements Listener {
|
|||||||
event.getXpGainReason() == XPGainReason.PVP ||
|
event.getXpGainReason() == XPGainReason.PVP ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVP) {
|
event.getXpGainReason() == XPGainReason.SHARED_PVP) {
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if (!pluginRef.getWorldGuardManager().hasXPFlag(player)) {
|
if (!pluginRef.getWorldGuardManager().hasXPFlag(player)) {
|
||||||
event.setRawXpGained(0);
|
event.setRawXpGained(0);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -44,6 +44,7 @@ import com.gmail.nossr50.util.skills.CombatTools;
|
|||||||
import com.gmail.nossr50.util.skills.RankTools;
|
import com.gmail.nossr50.util.skills.RankTools;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
|
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -97,6 +98,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private RankTools rankTools;
|
private RankTools rankTools;
|
||||||
private ItemTools itemTools;
|
private ItemTools itemTools;
|
||||||
private PermissionTools permissionTools;
|
private PermissionTools permissionTools;
|
||||||
|
private WorldGuardUtils worldGuardUtils;
|
||||||
|
|
||||||
/* Never-Ending tasks */
|
/* Never-Ending tasks */
|
||||||
private BleedTimerTask bleedTimerTask;
|
private BleedTimerTask bleedTimerTask;
|
||||||
@ -271,6 +273,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//Init Item Tools
|
//Init Item Tools
|
||||||
itemTools = new ItemTools(this);
|
itemTools = new ItemTools(this);
|
||||||
|
|
||||||
|
//Init World Guard Utils (Not sure about the order of this one, might need to be loaded earlier)
|
||||||
|
worldGuardUtils = new WorldGuardUtils(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -798,4 +803,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public PermissionTools getPermissionTools() {
|
public PermissionTools getPermissionTools() {
|
||||||
return permissionTools;
|
return permissionTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorldGuardUtils getWorldGuardUtils() {
|
||||||
|
return worldGuardUtils;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -15,7 +14,7 @@ public final class HardcoreManager {
|
|||||||
|
|
||||||
public static void invokeStatPenalty(Player player) {
|
public static void invokeStatPenalty(Player player) {
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
if(pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if(!WorldGuardManager.getInstance().hasHardcoreFlag(player)) {
|
if(!WorldGuardManager.getInstance().hasHardcoreFlag(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,7 +66,7 @@ public final class HardcoreManager {
|
|||||||
|
|
||||||
public static void invokeVampirism(Player killer, Player victim) {
|
public static void invokeVampirism(Player killer, Player victim) {
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
if(pluginRef.getWorldGuardUtils().isWorldGuardLoaded()) {
|
||||||
if(!WorldGuardManager.getInstance().hasHardcoreFlag(killer) || !WorldGuardManager.getInstance().hasHardcoreFlag(victim)) {
|
if(!WorldGuardManager.getInstance().hasHardcoreFlag(killer) || !WorldGuardManager.getInstance().hasHardcoreFlag(victim)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.worldguard;
|
package com.gmail.nossr50.worldguard;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -8,10 +9,15 @@ import java.util.ArrayList;
|
|||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class WorldGuardUtils {
|
public class WorldGuardUtils {
|
||||||
private static WorldGuardPlugin worldGuardPluginRef;
|
private WorldGuardPlugin worldGuardPluginRef;
|
||||||
private static boolean isLoaded = false;
|
private boolean isLoaded = false;
|
||||||
private static boolean detectedIncompatibleWG = false;
|
private boolean detectedIncompatibleWG = false;
|
||||||
private static final ArrayList<String> WGClassList;
|
private static final ArrayList<String> WGClassList;
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
|
public WorldGuardUtils(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
/*
|
/*
|
||||||
@ -37,7 +43,7 @@ public class WorldGuardUtils {
|
|||||||
WGClassList.add("com.sk89q.worldguard.protection.regions.RegionQuery");
|
WGClassList.add("com.sk89q.worldguard.protection.regions.RegionQuery");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWorldGuardLoaded()
|
public boolean isWorldGuardLoaded()
|
||||||
{
|
{
|
||||||
if(detectedIncompatibleWG)
|
if(detectedIncompatibleWG)
|
||||||
return false;
|
return false;
|
||||||
@ -52,7 +58,7 @@ public class WorldGuardUtils {
|
|||||||
* Results are cached
|
* Results are cached
|
||||||
* @return the instance of WG plugin, null if its not compatible or isn't present
|
* @return the instance of WG plugin, null if its not compatible or isn't present
|
||||||
*/
|
*/
|
||||||
private static WorldGuardPlugin getWorldGuard()
|
private WorldGuardPlugin getWorldGuard()
|
||||||
{
|
{
|
||||||
//WG plugin reference is already cached so just return it
|
//WG plugin reference is already cached so just return it
|
||||||
if(isLoaded)
|
if(isLoaded)
|
||||||
@ -90,7 +96,7 @@ public class WorldGuardUtils {
|
|||||||
* This does not guarantee compatibility, but it should help reduce the chance that mcMMO tries to hook into WG and its not compatible
|
* This does not guarantee compatibility, but it should help reduce the chance that mcMMO tries to hook into WG and its not compatible
|
||||||
* @return true if the version of WG appears to be compatible
|
* @return true if the version of WG appears to be compatible
|
||||||
*/
|
*/
|
||||||
private static boolean isCompatibleVersion(Plugin plugin) {
|
private boolean isCompatibleVersion(Plugin plugin) {
|
||||||
//Check that the version of WG is at least version 7.xx
|
//Check that the version of WG is at least version 7.xx
|
||||||
if(!plugin.getDescription().getVersion().startsWith("7")) {
|
if(!plugin.getDescription().getVersion().startsWith("7")) {
|
||||||
markWGIncompatible();
|
markWGIncompatible();
|
||||||
@ -114,7 +120,7 @@ public class WorldGuardUtils {
|
|||||||
/**
|
/**
|
||||||
* Mark WG as being incompatible to avoid unnecessary operations
|
* Mark WG as being incompatible to avoid unnecessary operations
|
||||||
*/
|
*/
|
||||||
private static void markWGIncompatible() {
|
private void markWGIncompatible() {
|
||||||
pluginRef.getLogger().severe("You are using a version of WG that is not compatible with mcMMO, " +
|
pluginRef.getLogger().severe("You are using a version of WG that is not compatible with mcMMO, " +
|
||||||
"WG features for mcMMO will be disabled. mcMMO requires you to be using a new version of WG7 " +
|
"WG features for mcMMO will be disabled. mcMMO requires you to be using a new version of WG7 " +
|
||||||
"in order for it to use WG features. Not all versions of WG7 are compatible.");
|
"in order for it to use WG features. Not all versions of WG7 are compatible.");
|
||||||
|
Loading…
Reference in New Issue
Block a user