diff --git a/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestAcceptCommand.java b/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestAcceptCommand.java index 5f4a2a9..b94ac39 100644 --- a/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestAcceptCommand.java +++ b/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestAcceptCommand.java @@ -17,6 +17,16 @@ public class TPRequestAcceptCommand implements CommandExecutor { public TPRequestAcceptCommand(TPPlugin p) { plugin = p; } + + String[] errors = { + ChatColor.RED + "" + ChatColor.BOLD + "AW SHUCKS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "OOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "ERROR! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "FAIL! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "UH OH! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "WHOOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "NOPE! " + ChatColor.RED + }; @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { @@ -26,51 +36,51 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, ArrayList reqs = plugin.TeleportRequests.get(player.getUniqueId().toString()); if (reqs.size() > 1) { if (args.length == 0) { - player.sendMessage(ChatColor.RED + "You have multiple teleport requests:"); + player.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "PROBLEM! " + ChatColor.YELLOW + "You have multiple teleport requests:"); ArrayList reqNames = new ArrayList<>(); for(String r : reqs){ reqNames.add(Objects.requireNonNull(plugin.getServer().getPlayer(UUID.fromString(r))).getName()); } - player.sendMessage(ChatColor.RED + String.join(", ", reqNames)); - player.sendMessage(ChatColor.RED + "Therefore, you must specify someone to accept."); + player.sendMessage(ChatColor.YELLOW + String.join(", ", reqNames)); + player.sendMessage(ChatColor.YELLOW + "Therefore, you must specify who to accept."); return false; } else if (args.length > 1) return false; else { Player teleportingPlayer = plugin.getServer().getPlayer(args[0]); if (teleportingPlayer == null) { - player.sendMessage(ChatColor.RED + "You invalid user"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "That player has not sent you a teleport request!"); return true; } if(!reqs.contains(teleportingPlayer.getUniqueId().toString())){ - player.sendMessage(ChatColor.RED + "Player has not requested a teleport."); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "That player has not sent you a teleport request!"); return true; } teleportingPlayer.teleport(player); plugin.removeRequest(player.getUniqueId().toString(), teleportingPlayer.getUniqueId().toString()); - teleportingPlayer.sendMessage(ChatColor.AQUA + "You have been teleported!"); + teleportingPlayer.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "TELEPORTED!" + ChatColor.GREEN + " You have been teleported!"); } return true; } else { String req = reqs.get(0); if(args.length != 0){ - player.sendMessage(ChatColor.RED + "You don't have multiple teleport requests. Use tpaccept without arguments"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "You don't have multiple teleport requests! Enter the command without any arguments."); return true; } Player teleportingPlayer = plugin.getServer().getPlayer(UUID.fromString(req)); if(teleportingPlayer == null){ - player.sendMessage(ChatColor.RED + "That user doesn't exist anymore(?)"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "That player isn't online anymore!"); return true; } teleportingPlayer.teleport(player); plugin.removeRequest(player.getUniqueId().toString(), req); - teleportingPlayer.sendMessage(ChatColor.AQUA + "You have been teleported!"); + teleportingPlayer.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "TELEPORTED!" + ChatColor.GREEN + " You have been teleported!"); return true; } } else { - player.sendMessage(ChatColor.RED + "You don't have any pending teleport requests"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "You don't have any pending teleport requests!"); return true; } } diff --git a/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestDeclineCommand.java b/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestDeclineCommand.java index 4e02f7b..c7ca0f4 100644 --- a/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestDeclineCommand.java +++ b/src/main/java/net/bnbdiscord/tpplugin/commands/TPRequestDeclineCommand.java @@ -17,6 +17,16 @@ public class TPRequestDeclineCommand implements CommandExecutor { public TPRequestDeclineCommand(TPPlugin p) { plugin = p; } + + String[] errors = { + ChatColor.RED + "" + ChatColor.BOLD + "AW SHUCKS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "OOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "ERROR! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "FAIL! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "UH OH! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "WHOOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "NOPE! " + ChatColor.RED + }; @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { @@ -26,20 +36,22 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, ArrayList reqs = plugin.TeleportRequests.get(player.getUniqueId().toString()); if (reqs.size() > 1) { if (args.length == 0) { - player.sendMessage(ChatColor.RED + "You have multiple teleport requests:"); + + player.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "PROBLEM! " + ChatColor.YELLOW + "You have multiple teleport requests:"); ArrayList reqNames = new ArrayList<>(); for(String r : reqs){ reqNames.add(Objects.requireNonNull(plugin.getServer().getPlayer(UUID.fromString(r))).getName()); } - player.sendMessage(ChatColor.RED + String.join(", ", reqNames)); - player.sendMessage(ChatColor.RED + "Therefore, you must specify someone to decline."); - return false; + player.sendMessage(ChatColor.YELLOW + String.join(", ", reqNames)); + player.sendMessage(ChatColor.YELLOW + "Therefore, you must specify someone to decline."); + return true; + } else if (args.length > 1) return false; else { Player teleportingPlayer = plugin.getServer().getPlayer(args[0]); if (teleportingPlayer == null) { - player.sendMessage(ChatColor.RED + "You invalid user"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "That player has not sent you a teleport request!"); return true; } @@ -49,31 +61,33 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, } plugin.removeRequest(player.getUniqueId().toString(), teleportingPlayer.getUniqueId().toString()); - teleportingPlayer.sendMessage(ChatColor.RED + "Your teleport request("+ player.getName() + ") has been declined"); - player.sendMessage(ChatColor.AQUA + "Done!"); + teleportingPlayer.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "DECLINED! " + ChatColor.RED + "Your teleport request to " + player.getName() + " has been declined :("); + player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "DECLINED! " + ChatColor.GREEN + "Successfully declined " + teleportingPlayer.getName + "'s teleport request!"); return true; } } else { String req = reqs.get(0); if(args.length != 0){ - player.sendMessage(ChatColor.RED + "You don't have multiple teleport requests. Use tpdecline without arguments"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "You don't have multiple teleport requests! Enter the command without any arguments."); return true; } Player teleportingPlayer = plugin.getServer().getPlayer(UUID.fromString(req)); if(teleportingPlayer == null){ - player.sendMessage(ChatColor.RED + "That user doesn't exist anymore(?)"); + player.sendMessage(errors[new Random().nextInt(errors.length)] + "That player isn't online anymore!"); return true; } plugin.removeRequest(player.getUniqueId().toString(), teleportingPlayer.getUniqueId().toString()); - teleportingPlayer.sendMessage(ChatColor.RED + "Your teleport request to "+ player.getName() + " has been declined"); - player.sendMessage(ChatColor.AQUA + "Done!"); + teleportingPlayer.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "DECLINED! " + ChatColor.RED + "Your teleport request to " + player.getName() + " has been declined :("); + player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "DECLINED! " + ChatColor.GREEN + "Successfully declined " + teleportingPlayer.getName + "'s teleport request!"); return true; } } else { - player.sendMessage(ChatColor.RED + "You don't have any pending teleport requests"); + + player.sendMessage(errors[new Random().nextInt(errors.length)] + "You don't have any pending teleport requests!"); return true; + } } return false; diff --git a/src/main/java/net/bnbdiscord/tpplugin/commands/TeleportRequestCommand.java b/src/main/java/net/bnbdiscord/tpplugin/commands/TeleportRequestCommand.java index 19e318d..47dc1aa 100644 --- a/src/main/java/net/bnbdiscord/tpplugin/commands/TeleportRequestCommand.java +++ b/src/main/java/net/bnbdiscord/tpplugin/commands/TeleportRequestCommand.java @@ -20,6 +20,16 @@ public TeleportRequestCommand(TPPlugin p) { plugin = p; } + String[] errors = { + ChatColor.RED + "" + ChatColor.BOLD + "AW SHUCKS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "OOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "ERROR! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "FAIL! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "UH OH! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "WHOOPS! " + ChatColor.RED, + ChatColor.RED + "" + ChatColor.BOLD + "NOPE! " + ChatColor.RED + }; + @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { if (commandSender instanceof Player) { @@ -27,17 +37,17 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, if (args.length != 1) return false; Player playerReceiver = plugin.getServer().getPlayer(args[0]); if (playerReceiver == null) { - playerSender.sendMessage(ChatColor.RED + "No users match your query."); + playerSender.sendMessage(errors[new Random().nextInt(errors.length)] + "Can't find a user by that name!"); } else { String receiverID = playerReceiver.getUniqueId().toString(); String senderID = playerSender.getUniqueId().toString(); if(receiverID.equals(senderID)){ - playerSender.sendMessage(ChatColor.RED + "You can't send yourself a teleport request!"); + playerSender.sendMessage(errors[new Random().nextInt(errors.length)] + "You can't send yourself a teleport request, silly!"); return true; } if (plugin.TeleportRequests.containsKey(receiverID)) { if (plugin.TeleportRequests.get(receiverID).contains(senderID)) { - playerSender.sendMessage(ChatColor.RED + "You have already sent that user a teleport request!"); + playerSender.sendMessage(errors[new Random().nextInt(errors.length)] + "You have already sent that player a teleport request!"); return true; } } else { @@ -46,18 +56,18 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, ArrayList reqs = plugin.TeleportRequests.get(receiverID); reqs.add(senderID); plugin.TeleportRequests.replace(receiverID, reqs); - playerSender.sendMessage(ChatColor.AQUA + "You have sent a teleport request to " + playerSender.getName() + ". They have " + - plugin.getConfig().getInt("tpplugin-request-expiration")/20 + "seconds to accept it."); - playerReceiver.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "You have recieved a teleport request from " + playerSender.getName()); - playerReceiver.sendMessage(ChatColor.AQUA + "To accept this, run , otherwise, run . You have " + - plugin.getConfig().getInt("tpplugin-request-expiration")/20 + "seconds to accept it."); + playerSender.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "SENT!" + ChatColor.GREEN + "You have sent a teleport request to " + playerSender.getName() + ". They have " + + plugin.getConfig().getInt("tpplugin-request-expiration")/20) + " seconds to accept it."); + playerReceiver.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "TPA RECIEVED!" + ChatColor.GREEN + "You have recieved a teleport request from " + playerSender.getName()); + playerReceiver.sendMessage(ChatColor.GREEN + "To accept this, type /tpaccept, otherwise, type /tpdeny. You have " + + plugin.getConfig().getInt("tpplugin-request-expiration")/20) + " seconds to accept it."); BukkitScheduler scheduler = plugin.getServer().getScheduler(); scheduler.scheduleSyncDelayedTask(plugin, () -> { if (plugin.TeleportRequests.containsKey(receiverID)) { ArrayList req2s = plugin.TeleportRequests.get(receiverID); if (req2s.contains(senderID)) { - playerReceiver.sendMessage(ChatColor.RED + "The teleport request from " + playerSender.getName() + " has expired"); - playerSender.sendMessage(ChatColor.RED + "The teleport request for " + playerReceiver.getName() + " has expired"); + playerReceiver.sendMessage(errors[new Random().nextInt(errors.length)] + "The teleport request from " + playerSender.getName() + " has expired!"); + playerSender.sendMessage(errors[new Random().nextInt(errors.length)] + "The teleport request to " + playerReceiver.getName() + " has expired!"); plugin.removeRequest(receiverID, senderID); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 923ca02..d2430af 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -14,7 +14,9 @@ commands: tpaccept: description: Accepts someone's teleport request usage: /tpaccept [username] + aliases: [tpallow, tpyes] tpdecline: description: Decline someone's teleport request - usage: /tpdecline [username] \ No newline at end of file + usage: /tpdecline [username] + aliases: [tpdeny, tpno]