Made ingame prints colored.
This commit is contained in:
parent
b9e84b122d
commit
cf2155ab40
@ -3,6 +3,7 @@ package de.craftinc.gates.commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -89,28 +90,28 @@ public abstract class BaseCommand
|
|||||||
senderHasPermission = this.hasPermission();
|
senderHasPermission = this.hasPermission();
|
||||||
}
|
}
|
||||||
catch (Exception e) { // the gate paramter is missing or incorrect!
|
catch (Exception e) { // the gate paramter is missing or incorrect!
|
||||||
senderHasPermission = parameterIsGate ? false : true; // only display the lack of permission message if there is a gate
|
senderHasPermission = this.hasGateParam ? false : true; // only display the lack of permission message if there is a gate
|
||||||
// this should prevent giving permission to the user if there is
|
// this should prevent giving permission to the user if there is
|
||||||
// a bug inside the permission validation code.
|
// a bug inside the permission validation code.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!senderHasPermission)
|
if(!senderHasPermission)
|
||||||
{
|
{
|
||||||
sendMessage("You lack the permissions to " + this.helpDescription.toLowerCase() + ".");
|
sendMessage(ChatColor.RED + "You lack the permissions to " + this.helpDescription.toLowerCase() + ".");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.senderMustBePlayer && !senderIsPlayer)
|
if (this.senderMustBePlayer && !senderIsPlayer)
|
||||||
{
|
{
|
||||||
sendMessage("This command can only be used by ingame players.");
|
sendMessage(ChatColor.RED + "This command can only be used by ingame players.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasGateParam && !parameterIsGate)
|
if (this.hasGateParam && !parameterIsGate)
|
||||||
{
|
{
|
||||||
sendMessage("There exists no gate with id " + this.parameters.get(0));
|
sendMessage(ChatColor.RED + "There exists no gate with id " + this.parameters.get(0));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,9 +202,9 @@ public abstract class BaseCommand
|
|||||||
protected String getUsageTemplate(boolean withColor, boolean withDescription) {
|
protected String getUsageTemplate(boolean withColor, boolean withDescription) {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
|
|
||||||
// if (withColor) {
|
if (withColor) {
|
||||||
// ret += Conf.colorCommand;
|
ret += ChatColor.AQUA;
|
||||||
// }
|
}
|
||||||
|
|
||||||
ret += "/" + Plugin.instance.getBaseCommand() + " " + TextUtil.implode(this.getAliases(), ",")+" ";
|
ret += "/" + Plugin.instance.getBaseCommand() + " " + TextUtil.implode(this.getAliases(), ",")+" ";
|
||||||
|
|
||||||
@ -217,15 +218,21 @@ public abstract class BaseCommand
|
|||||||
parts.add("*["+optionalParameter+"]");
|
parts.add("*["+optionalParameter+"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (withColor) {
|
if (withColor) {
|
||||||
// ret += Conf.colorParameter;
|
ret += ChatColor.DARK_AQUA;
|
||||||
// }
|
}
|
||||||
|
|
||||||
ret += TextUtil.implode(parts, " ");
|
ret += TextUtil.implode(parts, " ");
|
||||||
|
|
||||||
// if (withDescription) {
|
if (withDescription) {
|
||||||
// ret += " "+Conf.colorSystem + this.helpDescription;
|
ret += " ";
|
||||||
// }
|
|
||||||
|
if (withColor) {
|
||||||
|
ret += ChatColor.YELLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret += this.helpDescription;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +26,19 @@ public class CommandClose extends BaseCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setOpen(false);
|
gate.setOpen(false);
|
||||||
|
sendMessage(ChatColor.GREEN + "The gate was closed.");
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
sendMessage(ChatColor.RED + "Opening the gate failed! See server log for more information");
|
||||||
|
Plugin.log(Level.WARNING, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The gate was closed.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import de.craftinc.gates.Gate;
|
import de.craftinc.gates.Gate;
|
||||||
@ -30,27 +33,36 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
{
|
{
|
||||||
String id = parameters.get(0);
|
String id = parameters.get(0);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate = Gate.create(id);
|
gate = Gate.create(id);
|
||||||
|
sendMessage("ChatColor.GREEN + Gate with id \"" + id + "\" was created.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
System.out.println(e.getMessage());
|
{
|
||||||
|
sendMessage(ChatColor.RED + "Creating the gate failed! See server log for more information");
|
||||||
|
Plugin.log(Level.WARNING, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location playerLocation = getValidPlayerLocation();
|
Location playerLocation = getValidPlayerLocation();
|
||||||
|
|
||||||
if (playerLocation != null) {
|
if (playerLocation != null)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
gate.setLocation(playerLocation);
|
gate.setLocation(playerLocation);
|
||||||
|
sendMessage(ChatColor.AQUA + "The gates location has been set to your current location.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("Gate with id \"" + id + "\" was created.");
|
|
||||||
sendMessage("The gates location has been set to your current location.");
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
sendMessage("Gate with id \"" + id + "\" was created.");
|
{
|
||||||
|
sendMessage(ChatColor.GREEN + "Gate with id \"" + id + "\" was created.");
|
||||||
sendMessage("Now you should build a frame and:");
|
sendMessage("Now you should build a frame and:");
|
||||||
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Gate;
|
import de.craftinc.gates.Gate;
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ public class CommandDelete extends BaseCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Gate.delete(gate.getId());
|
Gate.delete(gate.getId());
|
||||||
sendMessage("Gate with id '" + gate.getId() + "' was deleted.");
|
sendMessage(ChatColor.GREEN + "Gate with id '" + gate.getId() + "' was deleted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import de.craftinc.gates.Gate;
|
import de.craftinc.gates.Gate;
|
||||||
|
import de.craftinc.gates.Plugin;
|
||||||
import de.craftinc.gates.util.TextUtil;
|
import de.craftinc.gates.util.TextUtil;
|
||||||
|
|
||||||
public class CommandHelp extends BaseCommand
|
public class CommandHelp extends BaseCommand
|
||||||
@ -17,10 +18,11 @@ public class CommandHelp extends BaseCommand
|
|||||||
aliases.add("?");
|
aliases.add("?");
|
||||||
|
|
||||||
optionalParameters.add("page");
|
optionalParameters.add("page");
|
||||||
|
helpDescription = "prints this help page";
|
||||||
|
|
||||||
|
requiredPermission = Plugin.permissionInfo;
|
||||||
|
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
|
|
||||||
helpDescription = "Prints a list of all availible commands.";
|
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ public class CommandHelp extends BaseCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(TextUtil.titleize("Craft Inc. Gates Help ("+page+"/"+helpPages.size()+")"));
|
sendMessage(TextUtil.titleize("Craft Inc. Gates Help (" + page + "/" + helpPages.size() + ")"));
|
||||||
|
|
||||||
page -= 1;
|
page -= 1;
|
||||||
if (page < 0 || page >= helpPages.size())
|
if (page < 0 || page >= helpPages.size())
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
import de.craftinc.gates.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class CommandInfo extends BaseCommand
|
public class CommandInfo extends BaseCommand
|
||||||
@ -24,31 +26,31 @@ public class CommandInfo extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
sendMessage(ChatColor.LIGHT_PURPLE + "Information about " + ChatColor.WHITE + gate.getId() + ChatColor.LIGHT_PURPLE + ":");
|
sendMessage(TextUtil.titleize("Information about: '" + ChatColor.WHITE + gate.getId() + ChatColor.YELLOW + "'"));
|
||||||
|
|
||||||
String openHiddenMessage = "This gate is";
|
String openHiddenMessage = ChatColor.DARK_AQUA + "This gate is";
|
||||||
|
|
||||||
if (gate.isOpen())
|
if (gate.isOpen())
|
||||||
openHiddenMessage += " open";
|
openHiddenMessage += ChatColor.AQUA + " open";
|
||||||
else
|
else
|
||||||
openHiddenMessage += " closed";
|
openHiddenMessage += ChatColor.AQUA + " closed";
|
||||||
|
|
||||||
if (gate.isHidden())
|
if (gate.isHidden())
|
||||||
openHiddenMessage += " and hidden";
|
openHiddenMessage += ChatColor.DARK_AQUA +" and" + ChatColor.AQUA + " hidden";
|
||||||
|
|
||||||
openHiddenMessage += ".";
|
openHiddenMessage += ".\n";
|
||||||
|
|
||||||
sendMessage(openHiddenMessage);
|
sendMessage(openHiddenMessage);
|
||||||
|
|
||||||
if (gate.getLocation() != null)
|
if (gate.getLocation() != null)
|
||||||
sendMessage(ChatColor.GREEN + "'from' location: " + ChatColor.YELLOW + "( " + gate.getLocation().getBlockX() + " | " + gate.getLocation().getBlockY() + " | " + gate.getLocation().getBlockZ() + " ) in " + gate.getLocation().getWorld().getName());
|
sendMessage(ChatColor.DARK_AQUA + "from: " + ChatColor.AQUA + "( " + gate.getLocation().getBlockX() + " | " + gate.getLocation().getBlockY() + " | " + gate.getLocation().getBlockZ() + " ) in " + gate.getLocation().getWorld().getName());
|
||||||
else
|
else
|
||||||
sendMessage(ChatColor.GREEN + "this gate has no 'from' location");
|
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no 'from' location");
|
||||||
|
|
||||||
if (gate.getExit() != null)
|
if (gate.getExit() != null)
|
||||||
sendMessage(ChatColor.GREEN + "'to' location: " + ChatColor.YELLOW + "( " + gate.getExit().getBlockX() + " | " + gate.getExit().getBlockY() + " | " + gate.getExit().getBlockZ() + " ) in " + gate.getExit().getWorld().getName());
|
sendMessage(ChatColor.DARK_AQUA + "to: " + ChatColor.AQUA + "( " + gate.getExit().getBlockX() + " | " + gate.getExit().getBlockY() + " | " + gate.getExit().getBlockZ() + " ) in " + gate.getExit().getWorld().getName());
|
||||||
else
|
else
|
||||||
sendMessage(ChatColor.GREEN + "this gate has no 'to' location");
|
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no 'to' location");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,25 +21,24 @@ public class CommandList extends BaseCommand
|
|||||||
|
|
||||||
optionalParameters.add("page");
|
optionalParameters.add("page");
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
|
||||||
helpDescription = "Prints a list of all availible gates.";
|
helpDescription = "lists all availible gates.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionInfo;
|
requiredPermission = Plugin.permissionInfo;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String intToTitleString(int i)
|
protected String intToTitleString(int i)
|
||||||
{
|
{
|
||||||
if ( i < 26 ) {
|
if ( i < 26 ) {
|
||||||
return ChatColor.GREEN + "" + (char)(i+65) + ":";
|
return ChatColor.DARK_AQUA + "" + (char)(i+65) + ":";
|
||||||
}
|
}
|
||||||
else if ( i == 26 ) {
|
else if ( i == 26 ) {
|
||||||
return ChatColor.GREEN + "0 - 9:";
|
return ChatColor.DARK_AQUA + "0 - 9:";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ChatColor.GREEN + "!@#$:";
|
return ChatColor.DARK_AQUA + "!@#$:";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ public class CommandList extends BaseCommand
|
|||||||
linesLeftOnCurrentPage -= numLinesForCurrentChar;
|
linesLeftOnCurrentPage -= numLinesForCurrentChar;
|
||||||
|
|
||||||
if (currentPage == page) {
|
if (currentPage == page) {
|
||||||
pageMessages.add(TextUtil.implode(currentIds, ", "));
|
pageMessages.add(ChatColor.AQUA + TextUtil.implode(currentIds, ", "));
|
||||||
if (finishedCurrentIds == false) {
|
if (finishedCurrentIds == false) {
|
||||||
pageMessages.set(pageMessages.size() -2, pageMessages.get(pageMessages.size() -2) + " (more on previous page)");
|
pageMessages.set(pageMessages.size() -2, pageMessages.get(pageMessages.size() -2) + " (more on previous page)");
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ public class CommandList extends BaseCommand
|
|||||||
String stringToPutOnCurrentPage = TextUtil.implode(idsToPutOnCurrentPage, ", ");
|
String stringToPutOnCurrentPage = TextUtil.implode(idsToPutOnCurrentPage, ", ");
|
||||||
|
|
||||||
if (currentPage == page) {
|
if (currentPage == page) {
|
||||||
pageMessages.add(stringToPutOnCurrentPage);
|
pageMessages.add(ChatColor.AQUA + stringToPutOnCurrentPage);
|
||||||
pageMessages.set(pageMessages.size() -2, pageMessages.get(pageMessages.size() -2) + " (more on next page)");
|
pageMessages.set(pageMessages.size() -2, pageMessages.get(pageMessages.size() -2) + " (more on next page)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +166,7 @@ public class CommandList extends BaseCommand
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ArrayList<String> retVal = new ArrayList<String>();
|
ArrayList<String> retVal = new ArrayList<String>();
|
||||||
retVal.add(ChatColor.LIGHT_PURPLE + "This is page " + ChatColor.WHITE + page + ChatColor.LIGHT_PURPLE + "/" + ChatColor.WHITE + --currentPage + ChatColor.LIGHT_PURPLE + ". There are " + gates.size() + " gates on this server: ");
|
retVal.add(TextUtil.titleize("List of all gates (" + page + "/" + + --currentPage + ")"));
|
||||||
retVal.addAll(pageMessages);
|
retVal.addAll(pageMessages);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -180,7 +179,7 @@ public class CommandList extends BaseCommand
|
|||||||
Collection<Gate> gates = Gate.getAll();
|
Collection<Gate> gates = Gate.getAll();
|
||||||
|
|
||||||
if (gates.size() == 0) {
|
if (gates.size() == 0) {
|
||||||
sendMessage("There are no gates yet.");
|
sendMessage(ChatColor.RED + "There are no gates yet.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
@ -194,7 +193,7 @@ public class CommandList extends BaseCommand
|
|||||||
List<String> messages = message(page);
|
List<String> messages = message(page);
|
||||||
|
|
||||||
if (messages == null) {
|
if (messages == null) {
|
||||||
sendMessage("The requested page is not availible");
|
sendMessage(ChatColor.RED + "The requested page is not availible");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendMessage(messages);
|
sendMessage(messages);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
@ -22,15 +25,15 @@ public class CommandOpen extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setOpen(true);
|
gate.setOpen(true);
|
||||||
} catch (Exception e) {
|
sendMessage(ChatColor.GREEN + "The gate was opened.");
|
||||||
sendMessage(e.getMessage());
|
}
|
||||||
return;
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
sendMessage(ChatColor.RED + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The gate was opened.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Gate;
|
import de.craftinc.gates.Gate;
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
@ -30,14 +32,15 @@ public class CommandRename extends BaseCommand
|
|||||||
{
|
{
|
||||||
String newId = parameters.get(1);
|
String newId = parameters.get(1);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
Gate.rename(gate.getId(), newId);
|
Gate.rename(gate.getId(), newId);
|
||||||
|
sendMessage(ChatColor.GREEN + "Gate " + gate.getId() + " is now known as " + newId + ".");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
sendMessage("Cannot rename " + gate.getId() + ". There is already a gate named " + newId + ".");
|
{
|
||||||
|
sendMessage(ChatColor.RED + "Cannot rename " + gate.getId() + ". There is already a gate named " + newId + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("Gate " + gate.getId() + " is now known as " + newId + ".");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
@ -23,14 +27,16 @@ public class CommandSetExit extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setExit(player.getLocation());
|
gate.setExit(player.getLocation());
|
||||||
|
sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
sendMessage(e.getMessage());
|
sendMessage(ChatColor.RED + "Setting the exit for the gate failed! See server log for more information");
|
||||||
|
Plugin.log(Level.WARNING, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The exit of gate '" + gate.getId() + "' is now where you stand.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +26,16 @@ public class CommandSetHidden extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setHidden(true);
|
gate.setHidden(true);
|
||||||
|
sendMessage(ChatColor.GREEN + "The gate '" + gate.getId() + "' is now hidden.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
sendMessage(e.getMessage());
|
{
|
||||||
|
sendMessage(ChatColor.RED + "Hiding the gate failed! See server log for more information");
|
||||||
|
Plugin.log(Level.WARNING, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The gate '" + gate.getId() + "' is now hidden.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,9 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
@ -28,19 +31,23 @@ public class CommandSetLocation extends BaseLocationCommand
|
|||||||
{
|
{
|
||||||
Location playerLocation = getValidPlayerLocation();
|
Location playerLocation = getValidPlayerLocation();
|
||||||
|
|
||||||
if (playerLocation == null) {
|
if (playerLocation == null)
|
||||||
|
{
|
||||||
sendMessage("There is not enough room for a gate to open here");
|
sendMessage("There is not enough room for a gate to open here");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setLocation(playerLocation);
|
gate.setLocation(playerLocation);
|
||||||
|
sendMessage(ChatColor.GREEN + "The location of '" + gate.getId() + "' is now at your current location.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e)
|
||||||
sendMessage(e.getMessage());
|
{
|
||||||
|
sendMessage(ChatColor.RED + "Setting the location for the gate failed! See server log for more information");
|
||||||
|
Plugin.log(Level.WARNING, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The location of '" + gate.getId() + "' is now at your current location.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package de.craftinc.gates.commands;
|
package de.craftinc.gates.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
@ -23,14 +27,16 @@ public class CommandSetVisible extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
gate.setHidden(false);
|
gate.setHidden(false);
|
||||||
|
sendMessage(ChatColor.GREEN + "The gate " + gate.getId() + " is now visible.");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
sendMessage(e.getMessage());
|
sendMessage(ChatColor.RED + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage("The gate " + gate.getId() + " is now visible.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user