Fixed text error

This commit is contained in:
Alastair 2017-06-11 19:14:35 +01:00
parent 9099f2367b
commit 1af04abd37
2 changed files with 11 additions and 1 deletions

View File

@ -555,7 +555,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
"\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal gui remove " + portalName + "\"}}" "\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal gui remove " + portalName + "\"}}"
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal show " + portalName + "\"}}" + ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal show " + portalName + "\"}}"
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eRename\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Change the name of the portal\"},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/portal rename \"}}" + ",{\"text\":\" \"},{\"text\":\"\u00A7eRename\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Change the name of the portal\"},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/portal rename \"}}"
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eActivate\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Teleport to the set destination\n(same as entering the portal)\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/desti warp " + destination + "\"}}]}", player); + ",{\"text\":\" \"},{\"text\":\"\u00A7eTeleport\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Teleport to the set destination\n(If there is one)\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/desti warp " + destination + "\"}}]}", player);
sender.sendMessage(""); sender.sendMessage("");

View File

@ -15,6 +15,7 @@ import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
@ -378,6 +379,7 @@ public class Portal {
// 3 checks, 1st is if it doesnt need perms. 2nd is if it does do they have it. And third is are they op. // 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())) { if (!(permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())) {
player.sendMessage(PluginMessages.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!");
failSound(player, portal);
throwPlayerBack(player); throwPlayerBack(player);
return false; return false;
} }
@ -386,6 +388,7 @@ public class Portal {
int diff = (int) ((System.currentTimeMillis() - cooldown.get(player)) / 1000); int diff = (int) ((System.currentTimeMillis() - cooldown.get(player)) / 1000);
if (diff < cooldelay) { if (diff < cooldelay) {
player.sendMessage(ChatColor.RED + "Please wait " + ChatColor.YELLOW + (cooldelay - diff) + ChatColor.RED + " seconds until attempting to teleport again."); player.sendMessage(ChatColor.RED + "Please wait " + ChatColor.YELLOW + (cooldelay - diff) + ChatColor.RED + " seconds until attempting to teleport again.");
failSound(player, portal);
throwPlayerBack(player); throwPlayerBack(player);
return false; return false;
} }
@ -419,6 +422,7 @@ public class Portal {
plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.portalName + "' has just had a warp " 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!"); + "attempt and either the data is corrupt or portal doesn't exist!");
throwPlayerBack(player); throwPlayerBack(player);
failSound(player, portal);
} }
} }
@ -466,6 +470,12 @@ public class Portal {
return warped; return warped;
} }
private static void failSound(Player player, AdvancedPortal portal) {
if(!(portal.trigger == Material.PORTAL && player.getGameMode() == GameMode.CREATIVE)){
player.playSound(player.getLocation(), Sound.BLOCK_PORTAL_TRAVEL, 0.5f, new Random().nextFloat() * 0.4F + 0.8F);
}
}
public static void rename(String oldName, String newName) { public static void rename(String oldName, String newName) {
// set it so it gets all data from one and puts it into another place // set it so it gets all data from one and puts it into another place