mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Style-fixes. Tons of them. I was too lazy to pack them into different commits.
This commit is contained in:
parent
da0bed3b5e
commit
47e052d180
@ -94,10 +94,11 @@
|
|||||||
<module name="IllegalInstantiation"/>
|
<module name="IllegalInstantiation"/>
|
||||||
<module name="InnerAssignment"/>
|
<module name="InnerAssignment"/>
|
||||||
<module name="MagicNumber">
|
<module name="MagicNumber">
|
||||||
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 8, 5000"/>
|
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 7, 8, 5000"/>
|
||||||
<!-- Explanations why we ignore certain magic numbers: -->
|
<!-- Explanations why we ignore certain magic numbers: -->
|
||||||
<!-- 3: Log-level -->
|
<!-- 3: Log-level -->
|
||||||
<!-- 8: Default nether scale in MVWorld -->
|
<!-- 8: Default nether scale in MVWorld -->
|
||||||
|
<!-- 7: max number of args in CreateCommand -->
|
||||||
<!-- 5000: Default messagecooldown in MultiverseCore -->
|
<!-- 5000: Default messagecooldown in MultiverseCore -->
|
||||||
</module>
|
</module>
|
||||||
<module name="MissingSwitchDefault"/>
|
<module name="MissingSwitchDefault"/>
|
||||||
@ -121,5 +122,8 @@
|
|||||||
<property name="severity" value="info"/>
|
<property name="severity" value="info"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="UpperEll"/>
|
<module name="UpperEll"/>
|
||||||
|
<module name="Indentation"/>
|
||||||
|
<module name="MissingDeprecated"/>
|
||||||
|
<module name="MissingOverride"/>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
||||||
|
@ -217,6 +217,7 @@ public interface MultiverseWorld {
|
|||||||
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
|
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
|
||||||
*
|
*
|
||||||
* @return True if this world has fakepvp on
|
* @return True if this world has fakepvp on
|
||||||
|
* @deprecated This is deprecated.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean getFakePVP();
|
boolean getFakePVP();
|
||||||
|
@ -16,6 +16,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows management of Anchor Destinations.
|
||||||
|
*/
|
||||||
public class AnchorCommand extends PaginatedCoreCommand<String> {
|
public class AnchorCommand extends PaginatedCoreCommand<String> {
|
||||||
|
|
||||||
public AnchorCommand(MultiverseCore plugin) {
|
public AnchorCommand(MultiverseCore plugin) {
|
||||||
@ -59,7 +62,8 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||||||
if (filterObject.getFilter().length() > 0) {
|
if (filterObject.getFilter().length() > 0) {
|
||||||
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
|
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
|
||||||
if (availableAnchors.size() == 0) {
|
if (availableAnchors.size() == 0) {
|
||||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||||
|
+ "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,9 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* Checks to see if a player can go to a destination.
|
||||||
|
*/
|
||||||
public class CheckCommand extends MultiverseCommand {
|
public class CheckCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public CheckCommand(MultiverseCore plugin) {
|
public CheckCommand(MultiverseCore plugin) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
package com.onarandombox.MultiverseCore.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
|
||||||
import com.onarandombox.MultiverseCore.enums.ConfigProperty;
|
import com.onarandombox.MultiverseCore.enums.ConfigProperty;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -16,9 +15,10 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows you to set Global MV Variables.
|
||||||
|
*/
|
||||||
public class ConfigCommand extends MultiverseCommand {
|
public class ConfigCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
|
||||||
|
|
||||||
public ConfigCommand(MultiverseCore plugin) {
|
public ConfigCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.setName("Configuration");
|
this.setName("Configuration");
|
||||||
@ -33,7 +33,6 @@ public class ConfigCommand extends MultiverseCommand {
|
|||||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
|
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
|
||||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
|
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
|
||||||
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
|
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
|
||||||
this.worldManager = this.plugin.getMVWorldManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,7 +57,8 @@ public class ConfigCommand extends MultiverseCommand {
|
|||||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), args.get(1));
|
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), args.get(1));
|
||||||
// Don't forget to set the world!
|
// Don't forget to set the world!
|
||||||
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
|
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
|
||||||
} else if (args.get(0).equalsIgnoreCase("messagecooldown") || args.get(0).equalsIgnoreCase("teleportcooldown") || args.get(0).equalsIgnoreCase("debug")) {
|
} else if (args.get(0).equalsIgnoreCase("messagecooldown") || args.get(0).equalsIgnoreCase("teleportcooldown")
|
||||||
|
|| args.get(0).equalsIgnoreCase("debug")) {
|
||||||
try {
|
try {
|
||||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Integer.parseInt(args.get(1)));
|
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Integer.parseInt(args.get(1)));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@ -70,7 +70,8 @@ public class ConfigCommand extends MultiverseCommand {
|
|||||||
try {
|
try {
|
||||||
property = ConfigProperty.valueOf(args.get(0).toLowerCase());
|
property = ConfigProperty.valueOf(args.get(0).toLowerCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " you can't set " + ChatColor.AQUA + args.get(0));
|
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA
|
||||||
|
+ args.get(0) + ChatColor.WHITE + " you can't set " + ChatColor.AQUA + args.get(0));
|
||||||
sender.sendMessage(ChatColor.GREEN + "Valid values are:");
|
sender.sendMessage(ChatColor.GREEN + "Valid values are:");
|
||||||
sender.sendMessage(ConfigProperty.getAllValues());
|
sender.sendMessage(ConfigProperty.getAllValues());
|
||||||
return;
|
return;
|
||||||
|
@ -13,6 +13,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirms actions.
|
||||||
|
*/
|
||||||
public class ConfirmCommand extends MultiverseCommand {
|
public class ConfirmCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public ConfirmCommand(MultiverseCore plugin) {
|
public ConfirmCommand(MultiverseCore plugin) {
|
||||||
|
@ -21,6 +21,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns detailed information on the Players where abouts.
|
||||||
|
*/
|
||||||
public class CoordCommand extends MultiverseCommand {
|
public class CoordCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new world and loads it.
|
||||||
|
*/
|
||||||
public class CreateCommand extends MultiverseCommand {
|
public class CreateCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables debug-information.
|
||||||
|
*/
|
||||||
public class DebugCommand extends MultiverseCommand {
|
public class DebugCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public DebugCommand(MultiverseCore plugin) {
|
public DebugCommand(MultiverseCore plugin) {
|
||||||
@ -42,7 +45,8 @@ public class DebugCommand extends MultiverseCommand {
|
|||||||
}
|
}
|
||||||
MultiverseCore.GlobalDebug = debugLevel;
|
MultiverseCore.GlobalDebug = debugLevel;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE + " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
|
sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE
|
||||||
|
+ " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes worlds.
|
||||||
|
*/
|
||||||
public class DeleteCommand extends MultiverseCommand {
|
public class DeleteCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public DeleteCommand(MultiverseCore plugin) {
|
public DeleteCommand(MultiverseCore plugin) {
|
||||||
@ -30,8 +33,9 @@ public class DeleteCommand extends MultiverseCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runCommand(CommandSender sender, List<String> args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
Class<?> paramTypes[] = {String.class};
|
Class<?>[] paramTypes = {String.class};
|
||||||
List<Object> objectArgs = new ArrayList<Object>(args);
|
List<Object> objectArgs = new ArrayList<Object>(args);
|
||||||
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", objectArgs, paramTypes, ChatColor.GREEN + "World Deleted!", ChatColor.RED + "World could NOT be deleted!");
|
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", objectArgs,
|
||||||
|
paramTypes, ChatColor.GREEN + "World Deleted!", ChatColor.RED + "World could NOT be deleted!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists valid known environments.
|
||||||
|
*/
|
||||||
public class EnvironmentCommand extends MultiverseCommand {
|
public class EnvironmentCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public EnvironmentCommand(MultiverseCore plugin) {
|
public EnvironmentCommand(MultiverseCore plugin) {
|
||||||
@ -29,6 +32,11 @@ public class EnvironmentCommand extends MultiverseCommand {
|
|||||||
this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
|
this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows all valid known environments to a {@link CommandSender}.
|
||||||
|
*
|
||||||
|
* @param sender The {@link CommandSender}.
|
||||||
|
*/
|
||||||
public static void showEnvironments(CommandSender sender) {
|
public static void showEnvironments(CommandSender sender) {
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
||||||
sender.sendMessage(ChatColor.GREEN + "NORMAL");
|
sender.sendMessage(ChatColor.GREEN + "NORMAL");
|
||||||
|
@ -17,6 +17,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of loaded generator plugins.
|
||||||
|
*/
|
||||||
public class GeneratorCommand extends MultiverseCommand {
|
public class GeneratorCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public GeneratorCommand(MultiverseCore plugin) {
|
public GeneratorCommand(MultiverseCore plugin) {
|
||||||
|
@ -18,6 +18,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a nice help menu.
|
||||||
|
*/
|
||||||
public class HelpCommand extends PaginatedCoreCommand<Command> {
|
public class HelpCommand extends PaginatedCoreCommand<Command> {
|
||||||
|
|
||||||
public HelpCommand(MultiverseCore plugin) {
|
public HelpCommand(MultiverseCore plugin) {
|
||||||
@ -76,7 +79,8 @@ public class HelpCommand extends PaginatedCoreCommand<Command> {
|
|||||||
if (filterObject.getFilter().length() > 0) {
|
if (filterObject.getFilter().length() > 0) {
|
||||||
availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
|
availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
|
||||||
if (availableCommands.size() == 0) {
|
if (availableCommands.size() == 0) {
|
||||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||||
|
+ "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports a new world of the specified type.
|
||||||
|
*/
|
||||||
public class ImportCommand extends MultiverseCommand {
|
public class ImportCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
@ -115,7 +118,8 @@ public class ImportCommand extends MultiverseCommand {
|
|||||||
|
|
||||||
// Make sure we don't already know about this world.
|
// Make sure we don't already know about this world.
|
||||||
if (this.worldManager.isMVWorld(worldName)) {
|
if (this.worldManager.isMVWorld(worldName)) {
|
||||||
sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
|
sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE
|
||||||
|
+ " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ import java.util.List;
|
|||||||
// Will use when we can compile with JDK 6
|
// Will use when we can compile with JDK 6
|
||||||
//import com.sun.xml.internal.ws.util.StringUtils;
|
//import com.sun.xml.internal.ws.util.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns detailed information about a world.
|
||||||
|
*/
|
||||||
public class InfoCommand extends MultiverseCommand {
|
public class InfoCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
@ -116,7 +119,8 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors));
|
message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors));
|
||||||
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
|
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
|
||||||
if (world.getPrice() > 0) {
|
if (world.getPrice() > 0) {
|
||||||
message.add(new FancyMessage("Price to enter this world: ", this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency()), colors));
|
message.add(new FancyMessage("Price to enter this world: ",
|
||||||
|
this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency()), colors));
|
||||||
} else {
|
} else {
|
||||||
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
|
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
|
||||||
}
|
}
|
||||||
@ -150,7 +154,8 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
|
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
|
||||||
if (world.getMonsterList().size() > 0) {
|
if (world.getMonsterList().size() > 0) {
|
||||||
if (world.canMonstersSpawn()) {
|
if (world.canMonstersSpawn()) {
|
||||||
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
|
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT "
|
||||||
|
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
|
||||||
} else {
|
} else {
|
||||||
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
|
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
|
||||||
}
|
}
|
||||||
@ -166,7 +171,8 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
|
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
|
||||||
if (world.getMonsterList().size() > 0) {
|
if (world.getMonsterList().size() > 0) {
|
||||||
if (world.canMonstersSpawn()) {
|
if (world.canMonstersSpawn()) {
|
||||||
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
|
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT "
|
||||||
|
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
|
||||||
} else {
|
} else {
|
||||||
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
|
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
|
||||||
}
|
}
|
||||||
@ -194,6 +200,12 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a "positive" or "negative" {@link ChatColor}.
|
||||||
|
*
|
||||||
|
* @param positive Whether this {@link ChatColor} should be "positive".
|
||||||
|
* @return The {@link ChatColor}.
|
||||||
|
*/
|
||||||
protected ChatColor getChatColor(boolean positive) {
|
protected ChatColor getChatColor(boolean positive) {
|
||||||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a listing of all worlds that a player can enter.
|
||||||
|
*/
|
||||||
public class ListCommand extends PaginatedCoreCommand<String> {
|
public class ListCommand extends PaginatedCoreCommand<String> {
|
||||||
|
|
||||||
public ListCommand(MultiverseCore plugin) {
|
public ListCommand(MultiverseCore plugin) {
|
||||||
@ -99,7 +102,8 @@ public class ListCommand extends PaginatedCoreCommand<String> {
|
|||||||
if (filterObject.getFilter().length() > 0) {
|
if (filterObject.getFilter().length() > 0) {
|
||||||
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
|
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
|
||||||
if (availableWorlds.size() == 0) {
|
if (availableWorlds.size() == 0) {
|
||||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||||
|
+ "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a world into Multiverse.
|
||||||
|
*/
|
||||||
public class LoadCommand extends MultiverseCommand {
|
public class LoadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public LoadCommand(MultiverseCore plugin) {
|
public LoadCommand(MultiverseCore plugin) {
|
||||||
|
@ -21,6 +21,9 @@ import java.util.List;
|
|||||||
// This will contain all the properties that support the ADD/REMOVE
|
// This will contain all the properties that support the ADD/REMOVE
|
||||||
// Anything not in here will only support the SET action
|
// Anything not in here will only support the SET action
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to modify various aspects of worlds.
|
||||||
|
*/
|
||||||
public class ModifyAddCommand extends MultiverseCommand {
|
public class ModifyAddCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
@ -78,7 +81,8 @@ public class ModifyAddCommand extends MultiverseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (world.addToVariable(property, value)) {
|
if (world.addToVariable(property, value)) {
|
||||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
|
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA
|
||||||
|
+ value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(value + " could not be added to " + property);
|
sender.sendMessage(value + " could not be added to " + property);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all values from a world-property.
|
||||||
|
*/
|
||||||
public class ModifyClearCommand extends MultiverseCommand {
|
public class ModifyClearCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to modify various aspects of worlds.
|
||||||
|
*/
|
||||||
public class ModifyCommand extends MultiverseCommand {
|
public class ModifyCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public ModifyCommand(MultiverseCore plugin) {
|
public ModifyCommand(MultiverseCore plugin) {
|
||||||
@ -42,6 +45,13 @@ public class ModifyCommand extends MultiverseCommand {
|
|||||||
this.setPermission(modify);
|
this.setPermission(modify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the specified action.
|
||||||
|
*
|
||||||
|
* @param action The {@link Action}.
|
||||||
|
* @param property The property.
|
||||||
|
* @return Whether this action is valid.
|
||||||
|
*/
|
||||||
protected static boolean validateAction(Action action, String property) {
|
protected static boolean validateAction(Action action, String property) {
|
||||||
if (action != Action.Set) {
|
if (action != Action.Set) {
|
||||||
try {
|
try {
|
||||||
|
@ -18,6 +18,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes values from a world-property.
|
||||||
|
*/
|
||||||
public class ModifyRemoveCommand extends MultiverseCommand {
|
public class ModifyRemoveCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
@ -78,9 +81,11 @@ public class ModifyRemoveCommand extends MultiverseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world.removeFromVariable(property, value)) {
|
if (world.removeFromVariable(property, value)) {
|
||||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
|
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE
|
||||||
|
+ " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY + value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
|
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
|
||||||
|
+ value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to set world-properties.
|
||||||
|
*/
|
||||||
public class ModifySetCommand extends MultiverseCommand {
|
public class ModifySetCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
@ -13,8 +13,14 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic Multiverse-command.
|
||||||
|
*/
|
||||||
public abstract class MultiverseCommand extends Command {
|
public abstract class MultiverseCommand extends Command {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The reference to the core.
|
||||||
|
*/
|
||||||
protected MultiverseCore plugin;
|
protected MultiverseCore plugin;
|
||||||
|
|
||||||
public MultiverseCommand(MultiverseCore plugin) {
|
public MultiverseCommand(MultiverseCore plugin) {
|
||||||
|
@ -14,28 +14,60 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic paginated command.
|
||||||
|
* @param <T> The type of items on the page.
|
||||||
|
*/
|
||||||
public abstract class PaginatedCommand<T> extends Command {
|
public abstract class PaginatedCommand<T> extends Command {
|
||||||
protected int itemsPerPage = 9;
|
private static final int DEFAULT_ITEMS_PER_PAGE = 9;
|
||||||
|
/**
|
||||||
|
* The number of items per page.
|
||||||
|
*/
|
||||||
|
protected int itemsPerPage = DEFAULT_ITEMS_PER_PAGE;
|
||||||
|
|
||||||
public PaginatedCommand(JavaPlugin plugin) {
|
public PaginatedCommand(JavaPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of items per page.
|
||||||
|
*
|
||||||
|
* @param items The new number of items per page.
|
||||||
|
*/
|
||||||
protected void setItemsPerPage(int items) {
|
protected void setItemsPerPage(int items) {
|
||||||
itemsPerPage = items;
|
itemsPerPage = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets filtered items.
|
||||||
|
* @param availableItems All available items.
|
||||||
|
* @param filter The filter-{@link String}.
|
||||||
|
* @return A list of items that match the filter.
|
||||||
|
*/
|
||||||
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
|
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a single string from a list of strings.
|
||||||
|
*
|
||||||
|
* @param list The {@link List} of strings.
|
||||||
|
* @return A single {@link String}.
|
||||||
|
*/
|
||||||
protected String stitchThisString(List<String> list) {
|
protected String stitchThisString(List<String> list) {
|
||||||
String returnstr = "";
|
StringBuilder builder = new StringBuilder();
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
returnstr += s + " ";
|
builder.append(s);
|
||||||
|
builder.append(' ');
|
||||||
}
|
}
|
||||||
return returnstr;
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a page.
|
||||||
|
*
|
||||||
|
* @param page The number of the page to show.
|
||||||
|
* @param sender The {@link CommandSender} that wants to see the page.
|
||||||
|
* @param cmds The items that should be displayed on the page.
|
||||||
|
*/
|
||||||
protected void showPage(int page, CommandSender sender, List<T> cmds) {
|
protected void showPage(int page, CommandSender sender, List<T> cmds) {
|
||||||
// Ensure the page is at least 1.
|
// Ensure the page is at least 1.
|
||||||
page = (page <= 0) ? 1 : page;
|
page = (page <= 0) ? 1 : page;
|
||||||
@ -52,8 +84,20 @@ public abstract class PaginatedCommand<T> extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an item into a string.
|
||||||
|
*
|
||||||
|
* @param item The item.
|
||||||
|
* @return A {@link String}.
|
||||||
|
*/
|
||||||
protected abstract String getItemText(T item);
|
protected abstract String getItemText(T item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a {@link FilterObject} from a {@link List} of arguments.
|
||||||
|
*
|
||||||
|
* @param args The {@link List} of arguments.
|
||||||
|
* @return The {@link FilterObject}.
|
||||||
|
*/
|
||||||
protected FilterObject getPageAndFilter(List<String> args) {
|
protected FilterObject getPageAndFilter(List<String> args) {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
|
|
||||||
@ -80,6 +124,9 @@ public abstract class PaginatedCommand<T> extends Command {
|
|||||||
return new FilterObject(page, filter);
|
return new FilterObject(page, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Key-Object" containing information about the page and the filter that were requested.
|
||||||
|
*/
|
||||||
protected class FilterObject {
|
protected class FilterObject {
|
||||||
private Integer page;
|
private Integer page;
|
||||||
private String filter;
|
private String filter;
|
||||||
@ -89,14 +136,27 @@ public abstract class PaginatedCommand<T> extends Command {
|
|||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the page.
|
||||||
|
* @return The page.
|
||||||
|
*/
|
||||||
public Integer getPage() {
|
public Integer getPage() {
|
||||||
return this.page;
|
return this.page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the page.
|
||||||
|
*
|
||||||
|
* @param page The new page.
|
||||||
|
*/
|
||||||
public void setPage(int page) {
|
public void setPage(int page) {
|
||||||
this.page = page;
|
this.page = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the filter.
|
||||||
|
* @return The filter.
|
||||||
|
*/
|
||||||
public String getFilter() {
|
public String getFilter() {
|
||||||
return this.filter;
|
return this.filter;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,14 @@ package com.onarandombox.MultiverseCore.commands;
|
|||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic paginated Multiverse-command.
|
||||||
|
* @param <T> The type of items on the page.
|
||||||
|
*/
|
||||||
public abstract class PaginatedCoreCommand<T> extends PaginatedCommand<T> {
|
public abstract class PaginatedCoreCommand<T> extends PaginatedCommand<T> {
|
||||||
|
/**
|
||||||
|
* The reference to the core.
|
||||||
|
*/
|
||||||
protected MultiverseCore plugin;
|
protected MultiverseCore plugin;
|
||||||
|
|
||||||
public PaginatedCoreCommand(MultiverseCore plugin) {
|
public PaginatedCoreCommand(MultiverseCore plugin) {
|
||||||
|
@ -20,6 +20,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a type of mob from a world.
|
||||||
|
*/
|
||||||
public class PurgeCommand extends MultiverseCommand {
|
public class PurgeCommand extends MultiverseCommand {
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerates a world.
|
||||||
|
*/
|
||||||
public class RegenCommand extends MultiverseCommand {
|
public class RegenCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public RegenCommand(MultiverseCore plugin) {
|
public RegenCommand(MultiverseCore plugin) {
|
||||||
@ -28,7 +31,8 @@ public class RegenCommand extends MultiverseCommand {
|
|||||||
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s");
|
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s");
|
||||||
this.addCommandExample("or specifiy a seed to get that one:");
|
this.addCommandExample("or specifiy a seed to get that one:");
|
||||||
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s" + ChatColor.AQUA + " gargamel");
|
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s" + ChatColor.AQUA + " gargamel");
|
||||||
this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
|
this.setPermission("multiverse.core.regen", "Regenerates a world on your server. The previous state will be lost "
|
||||||
|
+ ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,12 +41,13 @@ public class RegenCommand extends MultiverseCommand {
|
|||||||
Boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
|
Boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
|
||||||
String seed = (args.size() == 3) ? args.get(2) : "";
|
String seed = (args.size() == 3) ? args.get(2) : "";
|
||||||
|
|
||||||
Class<?> paramTypes[] = {String.class, Boolean.class, Boolean.class, String.class};
|
Class<?>[] paramTypes = {String.class, Boolean.class, Boolean.class, String.class};
|
||||||
List<Object> objectArgs = new ArrayList<Object>();
|
List<Object> objectArgs = new ArrayList<Object>();
|
||||||
objectArgs.add(args.get(0));
|
objectArgs.add(args.get(0));
|
||||||
objectArgs.add(useseed);
|
objectArgs.add(useseed);
|
||||||
objectArgs.add(randomseed);
|
objectArgs.add(randomseed);
|
||||||
objectArgs.add(seed);
|
objectArgs.add(seed);
|
||||||
this.plugin.getCommandHandler().queueCommand(sender, "mvregen", "regenWorld", objectArgs, paramTypes, ChatColor.GREEN + "World Regenerated!", ChatColor.RED + "World could NOT be regenerated!");
|
this.plugin.getCommandHandler().queueCommand(sender, "mvregen", "regenWorld", objectArgs,
|
||||||
|
paramTypes, ChatColor.GREEN + "World Regenerated!", ChatColor.RED + "World could NOT be regenerated!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads worlds.yml and config.yml.
|
||||||
|
*/
|
||||||
public class ReloadCommand extends MultiverseCommand {
|
public class ReloadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public ReloadCommand(MultiverseCore plugin) {
|
public ReloadCommand(MultiverseCore plugin) {
|
||||||
|
@ -14,6 +14,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unloads a world and removes it from the config.
|
||||||
|
*/
|
||||||
public class RemoveCommand extends MultiverseCommand {
|
public class RemoveCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public RemoveCommand(MultiverseCore plugin) {
|
public RemoveCommand(MultiverseCore plugin) {
|
||||||
@ -24,7 +27,8 @@ public class RemoveCommand extends MultiverseCommand {
|
|||||||
this.addKey("mvremove");
|
this.addKey("mvremove");
|
||||||
this.addKey("mv remove");
|
this.addKey("mv remove");
|
||||||
this.addCommandExample("/mv remove " + ChatColor.GREEN + "MyWorld");
|
this.addCommandExample("/mv remove " + ChatColor.GREEN + "MyWorld");
|
||||||
this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.", PermissionDefault.OP);
|
this.setPermission("multiverse.core.remove",
|
||||||
|
"Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.", PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the spawn for a world.
|
||||||
|
*/
|
||||||
public class SetSpawnCommand extends MultiverseCommand {
|
public class SetSpawnCommand extends MultiverseCommand {
|
||||||
public SetSpawnCommand(MultiverseCore plugin) {
|
public SetSpawnCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
@ -40,6 +43,11 @@ public class SetSpawnCommand extends MultiverseCommand {
|
|||||||
setWorldSpawn(sender);
|
setWorldSpawn(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the actual spawn-setting-work.
|
||||||
|
*
|
||||||
|
* @param sender The {@link CommandSender} that's setting the spawn.
|
||||||
|
*/
|
||||||
protected void setWorldSpawn(CommandSender sender) {
|
protected void setWorldSpawn(CommandSender sender) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
|
@ -14,6 +14,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the player to the latest bed he's slept in.
|
||||||
|
*/
|
||||||
public class SleepCommand extends MultiverseCommand {
|
public class SleepCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public SleepCommand(MultiverseCore plugin) {
|
public SleepCommand(MultiverseCore plugin) {
|
||||||
|
@ -18,11 +18,15 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleports a player to the spawn.
|
||||||
|
*/
|
||||||
public class SpawnCommand extends MultiverseCommand {
|
public class SpawnCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public SpawnCommand(MultiverseCore plugin) {
|
public SpawnCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
Permission otherPerm = new Permission("multiverse.core.spawn.other", "Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
|
Permission otherPerm = new Permission("multiverse.core.spawn.other",
|
||||||
|
"Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
|
||||||
this.setName("Spawn");
|
this.setName("Spawn");
|
||||||
this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
|
this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
|
||||||
this.setArgRange(0, 1);
|
this.setArgRange(0, 1);
|
||||||
|
@ -19,6 +19,9 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a world with spout.
|
||||||
|
*/
|
||||||
public class SpoutCommand extends MultiverseCommand {
|
public class SpoutCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public SpoutCommand(MultiverseCore plugin) {
|
public SpoutCommand(MultiverseCore plugin) {
|
||||||
|
@ -29,6 +29,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to teleport players.
|
||||||
|
*/
|
||||||
public class TeleportCommand extends MultiverseCommand {
|
public class TeleportCommand extends MultiverseCommand {
|
||||||
private SafeTTeleporter playerTeleporter;
|
private SafeTTeleporter playerTeleporter;
|
||||||
|
|
||||||
@ -45,6 +48,8 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
this.setPermission(menu);
|
this.setPermission(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final int UNSAFE_TELEPORT_EXPIRE_DELAY = 15;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runCommand(CommandSender sender, List<String> args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
// Check if the command was sent from a Player.
|
// Check if the command was sent from a Player.
|
||||||
@ -77,7 +82,9 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
String[] cannonSpeed = destinationName.split("-");
|
String[] cannonSpeed = destinationName.split("-");
|
||||||
try {
|
try {
|
||||||
double speed = Double.parseDouble(cannonSpeed[1]);
|
double speed = Double.parseDouble(cannonSpeed[1]);
|
||||||
destinationName = "ca:" + teleportee.getWorld().getName() + ":" + teleportee.getLocation().getX() + "," + teleportee.getLocation().getY() + "," + teleportee.getLocation().getZ() + ":" + teleportee.getLocation().getPitch() + ":" + teleportee.getLocation().getYaw() + ":" + speed;
|
destinationName = "ca:" + teleportee.getWorld().getName() + ":" + teleportee.getLocation().getX()
|
||||||
|
+ "," + teleportee.getLocation().getY() + "," + teleportee.getLocation().getZ() + ":"
|
||||||
|
+ teleportee.getLocation().getPitch() + ":" + teleportee.getLocation().getYaw() + ":" + speed;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
destinationName = "i:invalid";
|
destinationName = "i:invalid";
|
||||||
}
|
}
|
||||||
@ -107,14 +114,17 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
if (teleportee.equals(teleporter)) {
|
if (teleportee.equals(teleporter)) {
|
||||||
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
||||||
} else {
|
} else {
|
||||||
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD
|
||||||
|
+ teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (teleporter != null && !this.plugin.getMVPerms().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
|
} else if (teleporter != null && !this.plugin.getMVPerms().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
|
||||||
if (teleportee.equals(teleporter)) {
|
if (teleportee.equals(teleporter)) {
|
||||||
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + "THERE from " + ChatColor.GREEN + ((Player) teleporter).getWorld().getName());
|
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED
|
||||||
|
+ "THERE from " + ChatColor.GREEN + ((Player) teleporter).getWorld().getName());
|
||||||
} else {
|
} else {
|
||||||
teleporter.sendMessage("DOH! Doesn't look like " + ChatColor.GREEN + ((Player) teleporter).getWorld().getName() + " can get to " + ChatColor.RED + "THERE from where they are...");
|
teleporter.sendMessage("DOH! Doesn't look like " + ChatColor.GREEN + ((Player) teleporter).getWorld().getName()
|
||||||
|
+ " can get to " + ChatColor.RED + "THERE from where they are...");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -149,7 +159,7 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
if (result == TeleportResult.FAIL_UNSAFE) {
|
if (result == TeleportResult.FAIL_UNSAFE) {
|
||||||
this.plugin.log(Level.FINE, "Could not teleport " + teleportee.getName() + " to " + LocationManipulation.strCoordsRaw(d.getLocation(teleportee)));
|
this.plugin.log(Level.FINE, "Could not teleport " + teleportee.getName() + " to " + LocationManipulation.strCoordsRaw(d.getLocation(teleportee)));
|
||||||
this.plugin.log(Level.FINE, "Queueing Command");
|
this.plugin.log(Level.FINE, "Queueing Command");
|
||||||
Class<?> paramTypes[] = {CommandSender.class, Player.class, Location.class};
|
Class<?>[] paramTypes = {CommandSender.class, Player.class, Location.class};
|
||||||
List<Object> items = new ArrayList<Object>();
|
List<Object> items = new ArrayList<Object>();
|
||||||
items.add(teleporter);
|
items.add(teleporter);
|
||||||
items.add(teleportee);
|
items.add(teleportee);
|
||||||
@ -158,24 +168,26 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
if (!teleportee.equals(teleporter)) {
|
if (!teleportee.equals(teleporter)) {
|
||||||
player = teleportee.getName();
|
player = teleportee.getName();
|
||||||
}
|
}
|
||||||
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport " + ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
|
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport "
|
||||||
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, message, "Would you like to try anyway?", "", "", 15);
|
+ ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
|
||||||
} else {
|
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items,
|
||||||
// Player was teleported successfully (or the tp event was fired I should say);
|
paramTypes, message, "Would you like to try anyway?", "", "", UNSAFE_TELEPORT_EXPIRE_DELAY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// else: Player was teleported successfully (or the tp event was fired I should say)
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) {
|
private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) {
|
||||||
MVMessaging message = this.plugin.getMessaging();
|
MVMessaging message = this.plugin.getMessaging();
|
||||||
if (teleporter.equals(teleportee)) {
|
if (teleporter.equals(teleportee)) {
|
||||||
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.self." + destination.getIdentifier(), true)) {
|
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.self." + destination.getIdentifier(), true)) {
|
||||||
message.sendMessages(teleporter, new String[]{"You don't have permission to teleport yourself to a " + ChatColor.GREEN + destination.getType() + " Destination.", ChatColor.RED + " (multiverse.teleport.self." + destination.getIdentifier() + ")"});
|
message.sendMessages(teleporter, new String[]{"You don't have permission to teleport yourself to a " + ChatColor.GREEN
|
||||||
|
+ destination.getType() + " Destination.", ChatColor.RED + " (multiverse.teleport.self." + destination.getIdentifier() + ")"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.other." + destination.getIdentifier(), true)) {
|
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.other." + destination.getIdentifier(), true)) {
|
||||||
message.sendMessages(teleporter, new String[]{"You don't have permission to teleport another player to a " + ChatColor.GREEN + destination.getType() + " Destination.", ChatColor.RED + " (multiverse.teleport.other." + destination.getIdentifier() + ")"});
|
message.sendMessages(teleporter, new String[]{"You don't have permission to teleport another player to a " + ChatColor.GREEN
|
||||||
|
+ destination.getType() + " Destination.", ChatColor.RED + " (multiverse.teleport.other." + destination.getIdentifier() + ")"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unloads worlds from Multiverse.
|
||||||
|
*/
|
||||||
public class UnloadCommand extends MultiverseCommand {
|
public class UnloadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public UnloadCommand(MultiverseCore plugin) {
|
public UnloadCommand(MultiverseCore plugin) {
|
||||||
@ -24,7 +27,8 @@ public class UnloadCommand extends MultiverseCommand {
|
|||||||
this.setArgRange(1, 1);
|
this.setArgRange(1, 1);
|
||||||
this.addKey("mvunload");
|
this.addKey("mvunload");
|
||||||
this.addKey("mv unload");
|
this.addKey("mv unload");
|
||||||
this.setPermission("multiverse.core.unload", "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
|
this.setPermission("multiverse.core.unload",
|
||||||
|
"Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dumps version info to the console.
|
||||||
|
*/
|
||||||
public class VersionCommand extends MultiverseCommand {
|
public class VersionCommand extends MultiverseCommand {
|
||||||
|
|
||||||
public VersionCommand(MultiverseCore plugin) {
|
public VersionCommand(MultiverseCore plugin) {
|
||||||
@ -31,7 +34,8 @@ public class VersionCommand extends MultiverseCommand {
|
|||||||
this.addKey("mv version");
|
this.addKey("mv version");
|
||||||
this.addKey("mvv");
|
this.addKey("mvv");
|
||||||
this.addKey("mvversion");
|
this.addKey("mvversion");
|
||||||
this.setPermission("multiverse.core.version", "Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
|
this.setPermission("multiverse.core.version",
|
||||||
|
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String pasteBinBuffer = "";
|
private String pasteBinBuffer = "";
|
||||||
|
@ -18,6 +18,9 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* States who is in what world.
|
||||||
|
*/
|
||||||
public class WhoCommand extends MultiverseCommand {
|
public class WhoCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private MVWorldManager worldManager;
|
private MVWorldManager worldManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user