Everything should be using customPrefixes now

This commit is contained in:
Max Qian 2016-08-01 20:51:16 -07:00
parent db76bc6ef2
commit 75d5fef5b0
7 changed files with 83 additions and 79 deletions

View File

@ -63,7 +63,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
regionselector.setItemMeta(selectorname);
inventory.addItem(regionselector);
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been given a \u00A7ePortal Region Selector\u00A7a!");
sender.sendMessage(PluginMessages.customPrefix + " You have been given a \u00A7ePortal Region Selector\u00A7a!");
break;
case "portal":
case "portalblock":
@ -71,7 +71,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
inventory.addItem(portalBlock);
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been given a \u00A7ePortal Block\u00A7a!");
sender.sendMessage(PluginMessages.customPrefix + " You have been given a \u00A7ePortal Block\u00A7a!");
break;
case "create":
if (player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")) {
@ -98,7 +98,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
hasName = true;
portalName = args[i].replaceFirst("name:", "");
} else if (args[i].toLowerCase().startsWith("name:")) {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must include a name for the portal that isnt nothing!");
player.sendMessage(PluginMessages.customPrefixFail + " You must include a name for the portal that isnt nothing!");
return true;
} else if (args[i].toLowerCase().startsWith("destination:") && args[i].length() > 12) {
hasDestination = true;
@ -128,7 +128,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
}
}
if (!hasName) {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must include a name for the portal that you are creating in the variables!");
player.sendMessage(PluginMessages.customPrefixFail + " You must include a name for the portal that you are creating in the variables!");
return true;
}
@ -142,7 +142,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if (!Portal.portalExists(portalName)) {
player.sendMessage("");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a]\u00A7e You have created a new portal with the following details:");
player.sendMessage(PluginMessages.customPrefix + "\u00A7e You have created a new portal with the following details:");
player.sendMessage("\u00A7aname: \u00A7e" + portalName);
if (hasDestination) {
player.sendMessage("\u00A7adestination: \u00A7e" + destination);
@ -192,25 +192,25 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName, portalArgs));
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] A portal by that name already exists!");
sender.sendMessage(PluginMessages.customPrefixFail + " A portal by that name already exists!");
}
// add code to save the portal to the portal config and reload the portals
player.sendMessage("");
} else {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to at least add the name of the portal as a variable, \u00A7cType \u00A7e/portal variables\u00A7c"
player.sendMessage(PluginMessages.customPrefixFail + " You need to at least add the name of the portal as a variable, \u00A7cType \u00A7e/portal variables\u00A7c"
+ " for a full list of currently available variables and an example command!");
}
} else {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The points you have selected need to be in the same world!");
player.sendMessage(PluginMessages.customPrefixFail + " The points you have selected need to be in the same world!");
}
} else {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to have two points selected to make a portal!");
player.sendMessage(PluginMessages.customPrefixFail + " You need to have two points selected to make a portal!");
}
break;
case "variables" :
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Currently available variables: name, triggerBlock, destination");
sender.sendMessage(PluginMessages.customPrefix + " Currently available variables: name, triggerBlock, destination");
sender.sendMessage("");
sender.sendMessage("\u00A7aExample command: \u00A7e/portal create name:test triggerId:portal");
break;
@ -221,23 +221,23 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if (Portal.portalExists(args[1])) {
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, args[1]));
} else {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by the name \u00A7e" + args[1] + "\u00A7c exists (maybe you got the caps wrong)\n Try typing \u00A7e/portal select\u00A7c and hit inside the apropriate portals area!");
player.sendMessage(PluginMessages.customPrefixFail + " No portal by the name \u00A7e" + args[1] + "\u00A7c exists (maybe you got the caps wrong)\n Try typing \u00A7e/portal select\u00A7c and hit inside the apropriate portals area!");
}
} else {
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Hit a block inside the portal region to select the portal!");
player.sendMessage(PluginMessages.customPrefix + " Hit a block inside the portal region to select the portal!");
player.setMetadata("selectingPortal", new FixedMetadataValue(plugin, true));
}
} else {
player.removeMetadata("selectingPortal", plugin);
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Portal selection cancelled!");
player.sendMessage(PluginMessages.customPrefixFail + " Portal selection cancelled!");
}
break;
case "gui" :
if (args.length > 1) {
if (args[1].toLowerCase().equals("remove") && args.length > 2) {
sender.sendMessage("");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
sender.sendMessage(PluginMessages.customPrefixFail + " Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
sender.sendMessage("");
plugin.nmsAccess.sendRawMessage("{\"text\":\" \",\"extra\":[{\"text\":\"\u00A7e[Yes]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Confirm removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal remove " + args[2] + "\"}}, " +
"{\"text\":\" \"},{\"text\":\"\u00A7e[No]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Cancel removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal edit " + args[2] + "\"}}]}", player);
@ -251,7 +251,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, args[1]));
portalEditMenu(sender, portalConfig, args[1]);
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by the name \u00A7e" + args[1] + "\u00A7c exists!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal by the name \u00A7e" + args[1] + "\u00A7c exists!");
}
} else {
if (player.hasMetadata("selectedPortal")) {
@ -260,11 +260,11 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if (posX != null) {
portalEditMenu(sender, portalConfig, portalName);
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal has been defined or selected!");
}
}
break;
@ -280,22 +280,22 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String newPortalPosX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
if (posX != null && newPortalPosX == null) {
Portal.rename(portalName, args[1]);
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] The portal \u00A7e" + portalName + "\u00A7a has been renamed to \u00A7e" + args[1] + "\u00A7a.");
sender.sendMessage(PluginMessages.customPrefix + " The portal \u00A7e" + portalName + "\u00A7a has been renamed to \u00A7e" + args[1] + "\u00A7a.");
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, args[1]));
} else if (newPortalPosX != null) {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] There is already a portal with the name \u00A7e" + args[1] + "\u00A7c!");
sender.sendMessage(PluginMessages.customPrefixFail + " There is already a portal with the name \u00A7e" + args[1] + "\u00A7c!");
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you have selected is already called that!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal you have selected is already called that!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal has been defined or selected!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must select a portal first and then type \u00A7e/portal rename (new name)\u00A7c!");
sender.sendMessage(PluginMessages.customPrefixFail + " You must select a portal first and then type \u00A7e/portal rename (new name)\u00A7c!");
}
break;
case "command":
@ -310,13 +310,13 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
portalCommand += args[i];
}
if (Portal.addCommand(portalName, portalCommand)) {
sender.sendMessage("\u00A77a[\u00A77eAdvancedPortals\u00A77a] Command added to portal!");
sender.sendMessage(PluginMessages.customPrefixFail + " Command added to portal!");
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Failed to add command to portal!");
sender.sendMessage(PluginMessages.customPrefixFail + " Failed to add command to portal!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must actually specify a command to execute!");
sender.sendMessage(PluginMessages.customPrefixFail + " You must actually specify a command to execute!");
}
} else if (args[1].toLowerCase().equals("remove")) {
@ -324,10 +324,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
} else if (args[1].toLowerCase().equals("show")) {
// Show all the commands the portal executes
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must specify to \u00A7eadd\u00A7c or \u00A7eremove a command!");
sender.sendMessage(PluginMessages.customPrefixFail + " You must specify to \u00A7eadd\u00A7c or \u00A7eremove a command!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must specify to \u00A7eadd\u00A7c or \u00A7eremove\u00A7c a command!");
sender.sendMessage(PluginMessages.customPrefixFail + " You must specify to \u00A7eadd\u00A7c or \u00A7eremove\u00A7c a command!");
}
} else {
@ -338,9 +338,9 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
if (posX != null) {
Portal.remove(args[1]);
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal \u00A7e" + args[1] + "\u00A7c has been removed!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal \u00A7e" + args[1] + "\u00A7c has been removed!");
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by that name exists!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal by that name exists!");
}
} else {
if (player.hasMetadata("selectedPortal")) {
@ -348,23 +348,23 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(portalName + ".pos1.X");
if (posX != null) {
Portal.remove(portalName);
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal \u00A77" + portalName + "\u00A7c has been removed!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal \u00A77" + portalName + "\u00A7c has been removed!");
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
sender.sendMessage(PluginMessages.customPrefixFail + " The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal has been defined or selected!");
}
}
break;
case "help":
case "helppage":
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Still designing in game help page :(");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] For now please use the wiki http://bit.ly/portals-help");
sender.sendMessage(PluginMessages.customPrefix + " Still designing in game help page :(");
sender.sendMessage(PluginMessages.customPrefix + " For now please use the wiki http://bit.ly/portals-help");
break;
case "bukkitpage":
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Bukkit page: http://bit.ly/adv-portals!");
sender.sendMessage(PluginMessages.customPrefix + " Bukkit page: http://bit.ly/adv-portals!");
break;
case "show":
if (args.length > 1) {
@ -372,29 +372,29 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if (posX != null) {
Selection.Show(player, this.plugin, args[1]);
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by that name exists!");
sender.sendMessage(PluginMessages.customPrefixFail + " No portal by that name exists!");
}
} else {
if (player.hasMetadata("selectedPortal")) {
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Your currently selected portal has been shown, it will dissapear shortly!");
player.sendMessage(PluginMessages.customPrefix + " Your currently selected portal has been shown, it will dissapear shortly!");
Selection.Show(player, this.plugin, player.getMetadata("selectedPortal").get(0).asString());
} else if (player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")) {
if (player.getMetadata("Pos1World").get(0).asString().equals(player.getMetadata("Pos2World").get(0).asString()) && player.getMetadata("Pos1World").get(0).asString().equals(player.getLocation().getWorld().getName())) {
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Your currently selected area has been shown, it will dissapear shortly!");
player.sendMessage(PluginMessages.customPrefix + " Your currently selected area has been shown, it will dissapear shortly!");
Selection.Show(player, this.plugin, null);
}
} else {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No regions selected!");
player.sendMessage(PluginMessages.customPrefixFail + " No regions selected!");
}
}
break;
case "reload":
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Reloaded values!");
sender.sendMessage(PluginMessages.customPrefix + " Reloaded values!");
Listeners.reloadValues(plugin);
Portal.loadPortals();
break;
case "list" :
String message = "\u00A7eAdvancedPortals\u00A7a :";
String message = PluginMessages.customPrefix + " \u00A7c:\u00A7a";
for (AdvancedPortal portal : Portal.Portals) {
message = message + " " + portal.portalName;
}
@ -444,7 +444,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
// use the usual messages for normal lines but anything that needs special features make sure you use the
// chat steriliser
sender.sendMessage("");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Editing: \u00A7e" + portalName);
sender.sendMessage(PluginMessages.customPrefix + " Editing: \u00A7e" + portalName);
sender.sendMessage(" \u00A7apos1\u00A7e: " + portalConfig.getConfig().getString(portalName + ".pos1.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Z"));
sender.sendMessage(" \u00A7apos2\u00A7e: " + portalConfig.getConfig().getString(portalName + ".pos2.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Z"));

View File

@ -16,12 +16,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
public NMS nmsAccess;
public boolean useCustomPrefix = false;
public String customPrefix = "\u00A7a[\u00A7eAdvancedPortals\u00A7a]";
public String customPrefixFail = "\u00A7c[\u00A77AdvancedPortals\u00A7c]";
public void onEnable() {
try {
@ -59,6 +53,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
new DataCollector(this);
// These register the commands
new PluginMessages(this);
new AdvancedPortalsCommand(this);
new DestinationCommand(this);
new WarpCommand(this);
@ -99,14 +94,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
// thanks to the new config accessor code the config.saveDefaultConfig(); will now
// only copy the file if it doesnt exist!
ConfigAccessor config = new ConfigAccessor(this, "config.yml");
this.useCustomPrefix = config.getConfig().getBoolean("UseCustomPrefix");
if (useCustomPrefix) {
this.customPrefix = config.getConfig().getString("CustomPrefix").replaceAll("&", "\u00A7");
this.customPrefixFail = config.getConfig().getString("CustomPrefixFail").replaceAll("&", "\u00A7");
}
}

View File

@ -3,17 +3,31 @@ package com.sekwah.advancedportals;
import org.bukkit.command.CommandSender;
public class PluginMessages {
private AdvancedPortalsPlugin plugin;
public boolean useCustomPrefix = false;
public static String customPrefix = "\u00A7a[\u00A7eAdvancedPortals\u00A7a]";
public static String customPrefixFail = "\u00A7c[\u00A77AdvancedPortals\u00A7c]";
public PluginMessages (AdvancedPortalsPlugin plugin) {
this.plugin = plugin;
ConfigAccessor config = new ConfigAccessor(this.plugin, "config.yml");
this.useCustomPrefix = config.getConfig().getBoolean("UseCustomPrefix");
if (useCustomPrefix) {
PluginMessages.customPrefixFail = config.getConfig().getString("CustomPrefix").replaceAll("&", "\u00A7");
PluginMessages.customPrefixFail = config.getConfig().getString("CustomPrefixFail").replaceAll("&", "\u00A7");
}
}
// This class is so then the common messages in commands or just messages over the commands are the same and can be
// easily changed.
public static void UnknownCommand(CommandSender sender, String command) {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to type something after /" + command + "\n");
sender.sendMessage(customPrefixFail + " You need to type something after /" + command + "\n");
sender.sendMessage("\u00A7cIf you do not know what you can put or would like some help with the commands please type \u00A7e" + '"' + "\u00A7e/" + command + " help" + '"' + "\u00A7c\n");
}
public static void NoPermission(CommandSender sender, String command) {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to perform that command!");
sender.sendMessage(customPrefixFail + " You do not have permission to perform that command!");
}
}

View File

@ -2,6 +2,7 @@ package com.sekwah.advancedportals.destinations;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.PluginMessages;
import com.sekwah.advancedportals.effects.WarpEffects;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@ -141,7 +142,7 @@ public class Destination {
if (PortalMessagesDisplay == 1) {
player.sendMessage("");
player.sendMessage(plugin.customPrefixFail + "\u00A7a You have been warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.");
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7a You have been warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.");
player.sendMessage("");
} else if (PortalMessagesDisplay == 2) {
plugin.nmsAccess.sendActionBarMessage("{\"text\":\"\u00A7aYou have warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.\"}", player);
@ -151,12 +152,12 @@ public class Destination {
return true;
} else {
player.sendMessage(plugin.customPrefixFail + "\u00A7c The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7c The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' is linked to the world "
+ config.getConfig().getString(name + ".world") + " which doesnt seem to exist any more!");
}
} else {
player.sendMessage(plugin.customPrefix + "\u00A7c The destination you are currently attempting to warp to doesnt exist!");
player.sendMessage(PluginMessages.customPrefix + "\u00A7c The destination you are currently attempting to warp to doesnt exist!");
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' has just had a warp "
+ "attempt and either the data is corrupt or that destination doesn't exist!");
}

View File

@ -34,17 +34,17 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
if (args.length > 1) {
String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
if (posX == null) {
sender.sendMessage("§a[\u00A7eAdvancedPortals\u00A7a] You have created a new destination called \u00A7e" + args[1] + "!");
sender.sendMessage(PluginMessages.customPrefix + " You have created a new destination called \u00A7e" + args[1] + "!");
Player player = sender.getServer().getPlayer(sender.getName());
Destination.create(player.getLocation(), args[1]);
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] A destination by that name already exists!");
sender.sendMessage(PluginMessages.customPrefixFail + " A destination by that name already exists!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Please state the name of the destination you would like to create!");
sender.sendMessage(PluginMessages.customPrefixFail + " Please state the name of the destination you would like to create!");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to create portals so you cannot give yourself a \u00A7ePortal Region Selector\u00A7c!");
sender.sendMessage(PluginMessages.customPrefixFail + " You do not have permission to create portals so you cannot give yourself a \u00A7ePortal Region Selector\u00A7c!");
}
break;
case "remove":
@ -53,12 +53,12 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(args[1] + ".pos.X");
if (posX != null) {
Destination.remove(args[1]);
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The destination \u00A7e" + args[1] + "\u00A7c has been removed!");
sender.sendMessage(PluginMessages.customPrefixFail + " The destination \u00A7e" + args[1] + "\u00A7c has been removed!");
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No destination by that name exists.");
sender.sendMessage(PluginMessages.customPrefixFail + " No destination by that name exists.");
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to state the name of the destination you wish to remove.");
sender.sendMessage(PluginMessages.customPrefixFail + " You need to state the name of the destination you wish to remove.");
}
break;
case "goto":
@ -66,7 +66,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
if (args.length > 1) {
Destination.warp((Player) sender, args[1]);
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to state the name of the destination you wish to warp to.");
sender.sendMessage(PluginMessages.customPrefixFail + " You need to state the name of the destination you wish to warp to.");
}
break;
case "list":
@ -80,7 +80,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
}
}
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1");
for (int i = (page - 1) * 5; i < page * 5; i++) {
if (i > destiList.size()) {
break;
@ -92,7 +92,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
}
}
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1");
for (int i = 0; i < 5; i++) {
if (i > destiList.size()) {
break;
@ -100,7 +100,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
sender.sendMessage(" \u00A7e" + destiList.get(i));
}
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1");
for (int i = 0; i < 5; i++) {
if (i > destiList.size()) {
break;
@ -108,7 +108,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
sender.sendMessage(" \u00A7e" + destiList.get(i));
}
} else {
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] There are currently no defined destinations.");
sender.sendMessage(PluginMessages.customPrefixFail + " There are currently no defined destinations.");
}
break;
}

View File

@ -2,6 +2,7 @@ package com.sekwah.advancedportals.listeners;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.PluginMessages;
import com.sekwah.advancedportals.api.events.WarpEvent;
import com.sekwah.advancedportals.portals.AdvancedPortal;
import com.sekwah.advancedportals.portals.Portal;
@ -170,14 +171,14 @@ public class Listeners implements Listener {
if (player.hasMetadata("selectingPortal") && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
for (AdvancedPortal portal : Portal.Portals) {
if (Portal.locationInPortal(portal, event.getClickedBlock().getLocation(), 0)) {
player.sendMessage(plugin.customPrefixFail + "\u00A7a You have selected: \u00A7e" + portal.portalName);
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7a You have selected: \u00A7e" + portal.portalName);
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, portal.portalName)); // adds the name to the metadata of the character
event.setCancelled(true);
player.removeMetadata("selectingPortal", plugin);
return;
}
}
player.sendMessage(plugin.customPrefixFail + "\u00A7c No portal was selected. If you would like to stop selecting please type \u00A7e/portal select \u00A7cagain!");
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7c No portal was selected. If you would like to stop selecting please type \u00A7e/portal select \u00A7cagain!");
event.setCancelled(true);
return;
}

View File

@ -4,6 +4,7 @@ import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.PluginMessages;
import com.sekwah.advancedportals.destinations.Destination;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -368,7 +369,7 @@ public class Portal {
/*if((permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())){*/
// 3 checks, 1st is if it doesnt need perms. 2nd is if it does do they have it. And third is are they op.
if (!(permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())) {
player.sendMessage(plugin.customPrefix + "\u00A7c You do not have permission to use this portal!");
player.sendMessage(PluginMessages.customPrefix + "\u00A7c You do not have permission to use this portal!");
return false;
}
@ -426,7 +427,7 @@ public class Portal {
//plugin.getLogger().info(portal.portalName + ":" + portal.destiation);
if (portal.bungee != null) {
if (ShowBungeeMessage) {
player.sendMessage(plugin.customPrefix + "\u00A7a Attempting to warp to \u00A7e" + portal.bungee + "\u00A7a.");
player.sendMessage(PluginMessages.customPrefix + "\u00A7a Attempting to warp to \u00A7e" + portal.bungee + "\u00A7a.");
}
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
@ -442,7 +443,7 @@ public class Portal {
}
} else {
if (showFailMessage) {
player.sendMessage(plugin.customPrefix + "\u00A7c The portal you are trying to use doesn't have a destination!");
player.sendMessage(PluginMessages.customPrefix + "\u00A7c The portal you are trying to use doesn't have a destination!");
plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.portalName + "' has just had a warp "
+ "attempt and either the data is corrupt or portal doesn't exist!");
}