mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
Moving strings, part 2
This commit is contained in:
parent
fb6a031860
commit
0c638035f2
@ -8,6 +8,8 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -55,11 +57,11 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
||||
|
||||
private void showList(CommandSender sender, List<String> args) {
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.list", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to list anchors!");
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_NOLISTPERM);
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse Anchor List ]====");
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_LISTHEADER);
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
@ -72,13 +74,12 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
||||
if (filterObject.getFilter().length() > 0) {
|
||||
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
|
||||
if (availableAnchors.size() == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||
+ "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_NOMATCH, filterObject.getFilter());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (availableAnchors.size() == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors were defined.");
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_NODEF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -99,7 +100,7 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
||||
filterObject.setPage(1);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_PAGEHEADER, filterObject.getPage(), totalPages);
|
||||
|
||||
this.showPage(filterObject.getPage(), sender, availableAnchors);
|
||||
}
|
||||
@ -115,33 +116,24 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
||||
return;
|
||||
}
|
||||
if (args.size() == 2 && args.get(1).equalsIgnoreCase("-d")) {
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.delete", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to delete anchors!");
|
||||
} else {
|
||||
if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
|
||||
}
|
||||
}
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.delete", true))
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_NODELPERM);
|
||||
else
|
||||
this.plugin.getMessaging().sendMessage(sender, this.plugin.getAnchorManager().deleteAnchor(args.get(0))
|
||||
? MultiverseMessage.CMD_ANCHOR_DELSUCCESS : MultiverseMessage.CMD_ANCHOR_DELFAIL, args.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("You must be a player to create Anchors.");
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_CONSOLECREATE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.create", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to create anchors!");
|
||||
} else {
|
||||
Player player = (Player) sender;
|
||||
if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
|
||||
}
|
||||
}
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.create", true))
|
||||
this.plugin.getMessaging().sendMessage(sender, MultiverseMessage.CMD_ANCHOR_NOCREATEPERM);
|
||||
else
|
||||
this.plugin.getMessaging().sendMessage(sender, this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), ((Player) sender).getLocation())
|
||||
? MultiverseMessage.CMD_ANCHOR_CREATESUCCESS : MultiverseMessage.CMD_ANCHOR_CREATEFAIL, args.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,6 +10,7 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -39,15 +40,12 @@ public class CheckCommand extends MultiverseCommand {
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player p = this.plugin.getServer().getPlayer(args.get(0));
|
||||
if (p == null) {
|
||||
sender.sendMessage("Could not find player " + ChatColor.GREEN + args.get(0));
|
||||
sender.sendMessage("Are they online?");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CHECK_NOSUCHPLAYER, args.get(0));
|
||||
return;
|
||||
}
|
||||
MVDestination dest = this.plugin.getDestFactory().getDestination(args.get(1));
|
||||
if (dest instanceof InvalidDestination) {
|
||||
sender.sendMessage(String.format("You asked if '%s' could go to %s%s%s,",
|
||||
args.get(0), ChatColor.GREEN, args.get(0), ChatColor.WHITE));
|
||||
sender.sendMessage("but I couldn't find a Destination of that name? Did you type it correctly?");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CHECK_NOSUCHDEST);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -50,8 +51,7 @@ public class CloneCommand extends MultiverseCommand {
|
||||
objectArgs.add(CommandHandler.getFlag("-g", args));
|
||||
if (!this.worldManager.isMVWorld(args.get(0))) {
|
||||
// If no world was found, we can't clone.
|
||||
sender.sendMessage("Sorry, Multiverse doesn't know about world " + args.get(0) + ", so we can't clone it!");
|
||||
sender.sendMessage("Check the " + ChatColor.GREEN + "/mv list" + ChatColor.WHITE + " command to verify it is listed.");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CLONE_NOSUCHWORLD, args.get(0));
|
||||
return;
|
||||
}
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvclone", "cloneWorld", objectArgs,
|
||||
|
@ -8,6 +8,8 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
@ -52,7 +54,7 @@ public class ConfigCommand extends MultiverseCommand {
|
||||
return;
|
||||
}
|
||||
if (!this.plugin.getMVConfig().setConfigProperty(args.get(0).toLowerCase(), args.get(1))) {
|
||||
sender.sendMessage(String.format("%sSetting '%s' to '%s' failed!", ChatColor.RED, args.get(0).toLowerCase(), args.get(1)));
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CONFIG_SETFAIL, args.get(0), args.get(1));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,10 +65,10 @@ public class ConfigCommand extends MultiverseCommand {
|
||||
}
|
||||
|
||||
if (this.plugin.saveMVConfigs()) {
|
||||
sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CLONE_SUCCESS);
|
||||
this.plugin.loadConfigs();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "FAIL!" + ChatColor.WHITE + " Check your console for details!");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CONFIG_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -68,20 +69,18 @@ public class CreateCommand extends MultiverseCommand {
|
||||
}
|
||||
|
||||
if (this.worldManager.isMVWorld(worldName)) {
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse cannot create " + ChatColor.GOLD + ChatColor.UNDERLINE
|
||||
+ "another" + ChatColor.RESET + ChatColor.RED + " world named " + worldName);
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CREATE_WORLDEXISTS, worldName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldFile.exists()) {
|
||||
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
|
||||
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CREATE_FILEEXISTS);
|
||||
return;
|
||||
}
|
||||
|
||||
Environment environment = EnvironmentCommand.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CREATE_INVALIDENV);
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
return;
|
||||
}
|
||||
@ -92,7 +91,7 @@ public class CreateCommand extends MultiverseCommand {
|
||||
}
|
||||
WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
|
||||
if (type == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CREATE_INVALIDTYPE);
|
||||
EnvironmentCommand.showWorldTypes(sender);
|
||||
return;
|
||||
}
|
||||
@ -105,16 +104,16 @@ public class CreateCommand extends MultiverseCommand {
|
||||
}
|
||||
if (this.worldManager.getChunkGenerator(genarray.get(0), genarray.get(1), "test") == null) {
|
||||
// We have an invalid generator.
|
||||
sender.sendMessage("Invalid generator! '" + generator + "'. " + ChatColor.RED + "Aborting world creation.");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_CREATE_INVALIDGEN, generator);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
|
||||
Command.broadcastCommandMessage(sender, this.plugin.getMessageProvider().getMessage(MultiverseMessage.CMD_CREATE_START, worldName));
|
||||
|
||||
if (this.worldManager.addWorld(worldName, environment, seed, type, allowStructures, generator, useSpawnAdjust)) {
|
||||
Command.broadcastCommandMessage(sender, "Complete!");
|
||||
Command.broadcastCommandMessage(sender, this.plugin.getMessageProvider().getMessage(MultiverseMessage.CMD_CREATE_COMPLETE));
|
||||
} else {
|
||||
Command.broadcastCommandMessage(sender, "FAILED.");
|
||||
Command.broadcastCommandMessage(sender, this.plugin.getMessageProvider().getMessage(MultiverseMessage.CMD_CREATE_FAILED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
@ -24,7 +26,7 @@ public class GeneratorCommand extends MultiverseCommand {
|
||||
|
||||
public GeneratorCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("World Information");
|
||||
this.setName("Generator Information");
|
||||
this.setCommandUsage("/mv generators");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv generators");
|
||||
@ -45,16 +47,16 @@ public class GeneratorCommand extends MultiverseCommand {
|
||||
generators.add(p.getDescription().getName());
|
||||
}
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "--- Loaded Generator Plugins ---");
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_GENERATOR_LISTHEADER);
|
||||
String loadedGens = "";
|
||||
boolean altColor = false;
|
||||
for (String s : generators) {
|
||||
loadedGens += (altColor ? ChatColor.YELLOW : ChatColor.WHITE) + s + " ";
|
||||
altColor = !altColor;
|
||||
}
|
||||
if (loadedGens.length() == 0) {
|
||||
loadedGens = ChatColor.RED + "No Generator Plugins found.";
|
||||
}
|
||||
sender.sendMessage(loadedGens);
|
||||
if (loadedGens.length() == 0)
|
||||
this.messaging.sendMessage(sender, MultiverseMessage.CMD_GENERATOR_NOGENSFOUND);
|
||||
else
|
||||
this.messaging.sendMessage(sender, loadedGens, false);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,42 @@ public enum MultiverseMessage {
|
||||
GENERIC_NOT_MV_WORLD("Multiverse doesn't know about &3%s&f yet.\nType &3/mv import ?&f for help!"),
|
||||
|
||||
//// Commands
|
||||
// Anchor Command
|
||||
CMD_ANCHOR_NOLISTPERM("&cYou don't have the permission to list anchors!"),
|
||||
CMD_ANCHOR_LISTHEADER("&d====[ Multiverse Anchor List ]===="),
|
||||
CMD_ANCHOR_NOMATCH("&cSorry... &fNo anchors matched your filter: &b%s"),
|
||||
CMD_ANCHOR_NODEF("&cSorry... &fNo anchors were defined."),
|
||||
CMD_ANCHOR_PAGEHEADER("&b Page %d of %d"),
|
||||
CMD_ANCHOR_NODELPERM("&cYou don't have the permission to delete anchors!"),
|
||||
CMD_ANCHOR_NOCREATEPERM("&cYou don't have the permission to create anchors!"),
|
||||
CMD_ANCHOR_DELSUCCESS("Anchor '%s' was successfully &cdeleted!"),
|
||||
CMD_ANCHOR_DELFAIL("Anchor '%s' was &cNOT&f deleted!"),
|
||||
CMD_ANCHOR_CREATESUCCESS("Anchor '%s' was &asuccessfully&f created!"),
|
||||
CMD_ANCHOR_CREATEFAIL("Anchor '%s' was &cNOT&f created!"),
|
||||
CMD_ANCHOR_CONSOLECREATE("You must be a player to create Anchors!"),
|
||||
// Check Command
|
||||
CMD_CHECK_NOSUCHPLAYER("Could not find player &d%s&f\nAre they online?"),
|
||||
CMD_CHECK_NOSUCHDEST("You asked if '%s' could go to '&d%s&f', but I couldn't find a Destination of that name? Did you type it correctly?"),
|
||||
// Clone Command
|
||||
CMD_CLONE_NOSUCHWORLD("Sorry, Multiverse doesn't know about world '%s', so we can't clone it!\nCheck the &a/mv list&f command to verify it is listed."),
|
||||
CMD_CLONE_SUCCESS("&aWorld Cloned!"),
|
||||
CMD_CLONE_FAIL("&cWorld could NOT be cloned!"),
|
||||
// Config Command
|
||||
CMD_CONFIG_SETFAIL("&cSetting '%s' to '%s' failed!"),
|
||||
CMD_CONFIG_SUCCESS("&aSUCCESS!&f Values were updated successfully!"),
|
||||
CMD_CONFIG_FAIL("&cFAIL!&f Check your console for details!"),
|
||||
// Create Command
|
||||
CMD_CREATE_WORLDEXISTS("&cMultiverse cannot create &n&6another&r&c world named '%s'."),
|
||||
CMD_CREATE_FILEEXISTS("&cA Folder/World already exists with this name!\n&cIf you are confident it is a world you can import it with &a/mv import"),
|
||||
CMD_CREATE_INVALIDENV("&cThat is not a valid environment."),
|
||||
CMD_CREATE_INVALIDTYPE("&cThat is not a valid World Type."),
|
||||
CMD_CREATE_INVALIDGEN("Invalid generator '%s'! &cAborting world creation."),
|
||||
CMD_CREATE_START("Starting creation of world '%s'..."),
|
||||
CMD_CREATE_COMPLETE("Complete!"),
|
||||
CMD_CREATE_FAILED("FAILED."),
|
||||
// Generator Command
|
||||
CMD_GENERATOR_LISTHEADER("&b--- Loaded Generator Plugins ---"),
|
||||
CMD_GENERATOR_NOGENSFOUND("&cNo Generator Plugins found."),
|
||||
// List Command
|
||||
CMD_LIST_NAME("World Listing"),
|
||||
CMD_LIST_DESC("Displays a listing of all worlds that you can enter."),
|
||||
@ -37,7 +73,7 @@ public enum MultiverseMessage {
|
||||
//// World purger
|
||||
PURGER_ENTITIESKILLED("%d entities purged from the world '%s'"),
|
||||
// END CHECKSTYLE-SUPPRESSION: JavadocVariable
|
||||
;
|
||||
; // SUPPRESS CHECKSTYLE: Whitespace
|
||||
|
||||
private final String def;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user