diff --git a/lib/commandhandler b/lib/commandhandler index ad5c57e5..50ecf6af 160000 --- a/lib/commandhandler +++ b/lib/commandhandler @@ -1 +1 @@ -Subproject commit ad5c57e56cb44061b1b0f6429ada625da26d434d +Subproject commit 50ecf6af450d138a9bc562c1c5664b31be6ffd2f diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java index 1135e5fe..edba43bd 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java @@ -1,11 +1,10 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class ConfirmCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CoordCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CoordCommand.java index ac62c4b2..90c1e538 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/CoordCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CoordCommand.java @@ -1,8 +1,9 @@ package com.onarandombox.MultiverseCore.commands; -import java.text.DecimalFormat; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.LocationManipulation; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.World; @@ -10,10 +11,8 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.LocationManipulation; -import com.onarandombox.utils.WorldManager; +import java.text.DecimalFormat; +import java.util.List; public class CoordCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java index 1b97b6a2..15073821 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java @@ -1,16 +1,15 @@ package com.onarandombox.MultiverseCore.commands; -import java.io.File; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; +import com.pneumaticraft.commandhandler.CommandHandler; import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; -import com.pneumaticraft.commandhandler.CommandHandler; +import java.io.File; +import java.util.List; public class CreateCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java index 3d44e224..d826d3ea 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java @@ -1,13 +1,12 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; -import java.util.logging.Level; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; +import java.util.logging.Level; public class DebugCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java index d9a49713..eb3e44ed 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java @@ -1,13 +1,12 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.ArrayList; +import java.util.List; public class DeleteCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java index e1352d07..7293c64f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java @@ -1,12 +1,11 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class EnvironmentCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/GeneratorCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/GeneratorCommand.java index bcdc7805..a50f8182 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/GeneratorCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/GeneratorCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.Plugin; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; public class GeneratorCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java index c2cd0182..3a5044e9 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java @@ -1,16 +1,15 @@ // This file is no longer licensed under that silly CC license. I have blanked it out and will start implementaiton of my own in a few days. For now there is no help. package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.pneumaticraft.commandhandler.Command; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.pneumaticraft.commandhandler.Command; +import java.util.ArrayList; +import java.util.List; public class HelpCommand extends MultiverseCommand { private static final int CMDS_PER_PAGE = 7; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 51daa88a..95b53be9 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.io.File; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.io.File; +import java.util.List; public class ImportCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java index 21d8c3ef..20d85434 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java @@ -1,8 +1,8 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.*; import com.sun.xml.internal.ws.util.StringUtils; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -10,14 +10,8 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.FancyColorScheme; -import com.onarandombox.utils.FancyHeader; -import com.onarandombox.utils.FancyMessage; -import com.onarandombox.utils.FancyText; -import com.onarandombox.utils.LocationManipulation; -import com.onarandombox.utils.WorldManager; +import java.util.ArrayList; +import java.util.List; public class InfoCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ListCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ListCommand.java index 03160c51..5c3f5878 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ListCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ListCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class ListCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java index a8da2e28..c3722255 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.util.List; // This will contain all the properties that support the ADD/REMOVE // Anything not in here will only support the SET action diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java index 2000061c..c82ec9c0 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.util.List; public class ModifyClearCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyCommand.java index bce82b37..da0f9c1d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.HashMap; +import java.util.List; +import java.util.Map; enum AddProperties { blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java index 45e45905..7ccfe3e8 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.util.List; public class ModifyRemoveCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java index e41c55b9..f3227da4 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.util.List; public class ModifySetCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/MultiverseCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/MultiverseCommand.java index 0724a55f..4cc4b984 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/MultiverseCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/MultiverseCommand.java @@ -1,11 +1,10 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - -import org.bukkit.command.CommandSender; - import com.onarandombox.MultiverseCore.MultiverseCore; import com.pneumaticraft.commandhandler.Command; +import org.bukkit.command.CommandSender; + +import java.util.List; public abstract class MultiverseCommand extends Command { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java index cb2f360c..15e30496 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java @@ -1,18 +1,17 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionDefault; - import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.utils.PurgeWorlds; import com.onarandombox.utils.WorldManager; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; public class PurgeCommand extends MultiverseCommand { private WorldManager worldManager; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ReloadCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ReloadCommand.java index cbca1449..613402ea 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ReloadCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ReloadCommand.java @@ -1,14 +1,13 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent; +import java.util.ArrayList; +import java.util.List; public class ReloadCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/RemoveCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/RemoveCommand.java index 8bc65f35..59f5ecd8 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/RemoveCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/RemoveCommand.java @@ -1,12 +1,11 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class RemoveCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java index b857db3c..bbe94b53 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java @@ -1,16 +1,15 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.LocationManipulation; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.LocationManipulation; +import java.util.List; public class SetSpawnCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SleepCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SleepCommand.java index 1cc2132f..f5db242b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SleepCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SleepCommand.java @@ -1,12 +1,11 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class SleepCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SpawnCommand.java index e9810300..5a3644ff 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SpawnCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SpawnCommand.java @@ -1,15 +1,14 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class SpawnCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SpoutCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SpoutCommand.java index 091ba9f2..a912038a 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SpoutCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SpoutCommand.java @@ -1,7 +1,6 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -11,7 +10,7 @@ import org.getspout.spoutapi.gui.GenericPopup; import org.getspout.spoutapi.gui.PopupScreen; import org.getspout.spoutapi.player.SpoutPlayer; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class SpoutCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java index 4bec129a..b16c5226 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java @@ -1,16 +1,5 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; - import com.onarandombox.MultiverseCore.MVTeleport; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.event.MVTeleportEvent; @@ -18,14 +7,23 @@ import com.onarandombox.utils.DestinationFactory; import com.onarandombox.utils.InvalidDestination; import com.onarandombox.utils.LocationManipulation; import com.onarandombox.utils.MVDestination; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; public class TeleportCommand extends MultiverseCommand { private MVTeleport playerTeleporter; public TeleportCommand(MultiverseCore plugin) { super(plugin); - Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); - Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport others to other worlds.", PermissionDefault.OP); + Permission menu = new Permission("multiverse.teleport", "Allows you to display the teleport menu.", PermissionDefault.OP); this.setName("Teleport"); this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}"); @@ -33,9 +31,7 @@ public class TeleportCommand extends MultiverseCommand { this.addKey("mvtp"); this.addKey("mv tp"); this.playerTeleporter = new MVTeleport(this.plugin); - // setPermission in some for is REQUIRED - this.setPermission(self); - this.addAdditonalPermission(other); + this.setPermission(menu); } @Override @@ -50,10 +46,6 @@ public class TeleportCommand extends MultiverseCommand { String destinationName; if (args.size() == 2) { - if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.other", true)) { - sender.sendMessage("You don't have permission to teleport another player. (multiverse.core.tp.other)"); - return; - } teleportee = this.plugin.getServer().getPlayer(args.get(0)); if (teleportee == null) { sender.sendMessage("Sorry, I couldn't find player: " + args.get(0)); @@ -63,13 +55,8 @@ public class TeleportCommand extends MultiverseCommand { } else { destinationName = args.get(0); - if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.self", true)) { - sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.core.tp.self)"); - return; - } - if (!(sender instanceof Player)) { - sender.sendMessage("From the console, you must specifiy a player to teleport"); + sender.sendMessage("From the console, you must specify a player to teleport"); return; } teleporter = (Player) sender; @@ -88,9 +75,13 @@ public class TeleportCommand extends MultiverseCommand { } DestinationFactory df = this.plugin.getDestinationFactory(); MVDestination d = df.getDestination(destinationName); + + + MVTeleportEvent teleportEvent = new MVTeleportEvent(d, teleportee, teleporter); this.plugin.getServer().getPluginManager().callEvent(teleportEvent); if (teleportEvent.isCancelled()) { + this.plugin.log(Level.FINE, "Someone else cancelled the MVTeleport Event!!!"); return; } @@ -99,6 +90,10 @@ public class TeleportCommand extends MultiverseCommand { return; } + if(!this.checkSendPermissions(teleporter,teleportee,d)) { + return; + } + if (teleporter != null && !this.plugin.getPermissions().canEnterDestination(teleporter, d)) { if (teleportee.equals(teleporter)) { teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there..."); @@ -135,4 +130,21 @@ public class TeleportCommand extends MultiverseCommand { teleportee.setVelocity(d.getVelocity()); } } + + private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) { + if(teleporter.equals(teleportee)) { + if(!this.plugin.getPermissions().hasPermission(teleporter, "multiverse.teleport.self."+destination.getIdentifier(),true)) { + teleporter.sendMessage("You don't have permission to teleport yourself to a " + ChatColor.GREEN + destination.getType() + " Destination."); + teleporter.sendMessage(ChatColor.RED + " (multiverse.teleport.self."+destination.getIdentifier()+")"); + return false; + } + } else { + if(!this.plugin.getPermissions().hasPermission(teleporter, "multiverse.teleport.other."+destination.getIdentifier(),true)) { + teleporter.sendMessage("You don't have permission to teleport another player to a " + ChatColor.GREEN + destination.getType() + " Destination."); + teleporter.sendMessage(ChatColor.RED + " (multiverse.teleport.other."+destination.getIdentifier()+")"); + return false; + } + } + return true; + } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/UnloadCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/UnloadCommand.java index 02230a3c..cc4972dc 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/UnloadCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/UnloadCommand.java @@ -1,12 +1,11 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.List; - +import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MultiverseCore; +import java.util.List; public class UnloadCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java index f4498f1c..921c915f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/VersionCommand.java @@ -1,5 +1,12 @@ package com.onarandombox.MultiverseCore.commands; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; + import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; @@ -12,14 +19,6 @@ import java.util.Date; import java.util.List; import java.util.logging.Level; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionDefault; - -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent; - public class VersionCommand extends MultiverseCommand { public VersionCommand(MultiverseCore plugin) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java index dcf7bbbd..73339fa5 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java @@ -1,16 +1,15 @@ package com.onarandombox.MultiverseCore.commands; -import java.util.ArrayList; -import java.util.List; - +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.utils.WorldManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionDefault; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.utils.WorldManager; +import java.util.ArrayList; +import java.util.List; public class WhoCommand extends MultiverseCommand { diff --git a/src/main/java/com/onarandombox/utils/DestinationFactory.java b/src/main/java/com/onarandombox/utils/DestinationFactory.java index 8efd46d6..fd959d19 100644 --- a/src/main/java/com/onarandombox/utils/DestinationFactory.java +++ b/src/main/java/com/onarandombox/utils/DestinationFactory.java @@ -1,33 +1,39 @@ package com.onarandombox.utils; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import com.onarandombox.MultiverseCore.MultiverseCore; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; public class DestinationFactory { private MultiverseCore plugin; private Map> destList; + private List teleportPermissions; public DestinationFactory(MultiverseCore plugin) { this.plugin = plugin; this.destList = new HashMap>(); + this.teleportPermissions = new ArrayList(); } - public MVDestination getDestination(String dest) { + public MVDestination getDestination(String destination) { String idenChar = ""; - if (dest.split(":").length > 1) { - idenChar = dest.split(":")[0]; + if (destination.split(":").length > 1) { + idenChar = destination.split(":")[0]; } if (this.destList.containsKey(idenChar)) { Class myClass = this.destList.get(idenChar); try { MVDestination mydest = myClass.newInstance(); - if (!mydest.isThisType((MultiverseCore) this.plugin, dest)) { + if (!mydest.isThisType((MultiverseCore) this.plugin, destination)) { return new InvalidDestination(); } - mydest.setDestination(this.plugin, dest); + mydest.setDestination(this.plugin, destination); return mydest; } catch (InstantiationException e) { } catch (IllegalAccessException e) { @@ -41,6 +47,27 @@ public class DestinationFactory { return false; } this.destList.put(identifier, c); + // Special case for world defaults: + if(identifier.equals("")) { + identifier = "w"; + } + Permission self = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.self."+identifier); + Permission other = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.other."+identifier); + PermissionTools pt = new PermissionTools(this.plugin); + if(self == null) { + this.plugin.getServer().getPluginManager().addPermission(new Permission("multiverse.teleport.self."+identifier,"Permission to teleport yourself for the " + identifier + " destination.", PermissionDefault.OP)); + pt.addToParentPerms("multiverse.teleport.self."+identifier); + } + if(other == null) { + this.plugin.getServer().getPluginManager().addPermission(new Permission("multiverse.teleport.other."+identifier,"Permission to teleport others for the " + identifier + " destination.", PermissionDefault.OP)); + pt.addToParentPerms("multiverse.teleport.other."+identifier); + } + this.teleportPermissions.add(self); + this.teleportPermissions.add(other); return true; } + + public List getTeleportPermissions() { + return this.teleportPermissions; + } } diff --git a/src/main/java/com/onarandombox/utils/PermissionTools.java b/src/main/java/com/onarandombox/utils/PermissionTools.java new file mode 100644 index 00000000..4c7a897e --- /dev/null +++ b/src/main/java/com/onarandombox/utils/PermissionTools.java @@ -0,0 +1,70 @@ +package com.onarandombox.utils; + +import com.onarandombox.MultiverseCore.MultiverseCore; +import org.bukkit.permissions.Permission; + +public class PermissionTools { + private MultiverseCore plugin; + + public PermissionTools(MultiverseCore plugin) { + this.plugin = plugin; + } + public void addToParentPerms(String permString) { + String permStringChopped = permString.replace(".*", ""); + + String[] seperated = permStringChopped.split("\\."); + String parentPermString = getParentPerm(seperated); + if (parentPermString == null) { + addToRootPermission("*", permStringChopped); + addToRootPermission("*.*", permStringChopped); + return; + } + Permission parentPermission = this.plugin.getServer().getPluginManager().getPermission(parentPermString); + // Creat parent and grandparents + if (parentPermission == null) { + parentPermission = new Permission(parentPermString); + this.plugin.getServer().getPluginManager().addPermission(parentPermission); + + this.addToParentPerms(parentPermString); + } + // Create actual perm. + Permission actualPermission = this.plugin.getServer().getPluginManager().getPermission(permString); + // Extra check just to make sure the actual one is added + if (actualPermission == null) { + + actualPermission = new Permission(permString); + this.plugin.getServer().getPluginManager().addPermission(actualPermission); + } + if (!parentPermission.getChildren().containsKey(permString)) { + parentPermission.getChildren().put(actualPermission.getName(), true); + this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(parentPermission); + } + } + + private void addToRootPermission(String rootPerm, String permStringChopped) { + Permission rootPermission = this.plugin.getServer().getPluginManager().getPermission(rootPerm); + if (rootPermission == null) { + rootPermission = new Permission(rootPerm); + this.plugin.getServer().getPluginManager().addPermission(rootPermission); + } + rootPermission.getChildren().put(permStringChopped + ".*", true); + this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(rootPermission); + } + + /** + * If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'. + * + * @param separatedPermissionString The array of a dot separated perm string. + * @return The dot separated parent permission string. + */ + private String getParentPerm(String[] separatedPermissionString) { + if (separatedPermissionString.length == 1) { + return null; + } + String returnString = ""; + for (int i = 0; i < separatedPermissionString.length - 1; i++) { + returnString += separatedPermissionString[i] + "."; + } + return returnString + "*"; + } +}