Changed the § symbol to \u00A7 to stop problems when cloning the repo

This commit is contained in:
sekwah41 2015-01-15 22:16:16 +00:00
parent 52ced1e3ef
commit 86d13268b5
21 changed files with 263 additions and 301 deletions

View File

@ -1,10 +1,6 @@
package com.sekwah.advancedportals;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@ -18,7 +14,10 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.metadata.FixedMetadataValue;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
@ -40,33 +39,33 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if(args[0].toLowerCase().equals("wand") || args[0].toLowerCase().equals("selector")){
PlayerInventory inventory = player.getInventory();
String ItemID = config.getConfig().getString("AxeItemId");
String ItemID = config.getConfig().getString("AxeItemId");
Material WandMaterial = Material.getMaterial(ItemID);
if(WandMaterial == null){
WandMaterial = Material.IRON_AXE;
}
ItemStack regionselector = new ItemStack(WandMaterial);
ItemMeta selectorname = regionselector.getItemMeta();
selectorname.setDisplayName("§ePortal Region Selector");
selectorname.setLore(Arrays.asList("§rThis wand with has the power to help"
, "§r create portals bistowed upon it!"));
selectorname.setDisplayName("\u00A7ePortal Region Selector");
selectorname.setLore(Arrays.asList("\u00A7rThis wand with has the power to help"
, "\u00A7r create portals bistowed upon it!"));
regionselector.setItemMeta(selectorname);
inventory.addItem(regionselector);
sender.sendMessage("§a[§eAdvancedPortals§a] You have been given a §ePortal Region Selector§a!");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been given a \u00A7ePortal Region Selector\u00A7a!");
}
else if(args[0].toLowerCase().equals("portal") || args[0].toLowerCase().equals("portalblock")){
PlayerInventory inventory = player.getInventory();
ItemStack portalBlock = new ItemStack(Material.PORTAL);
inventory.addItem(portalBlock);
sender.sendMessage("§a[§eAdvancedPortals§a] You have been given a §ePortal Block§a!");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been given a \u00A7ePortal Block\u00A7a!");
}
else if(args[0].toLowerCase().equals("create")) {
if(player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")){
@ -86,7 +85,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
portalName = args[i].replaceFirst("name:", "");
}
else if(args[i].toLowerCase().startsWith("name:")) {
player.sendMessage("§c[§7AdvancedPortals§c] You must include a name for the portal that isnt nothing!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must include a name for the portal that isnt nothing!");
return true;
}
else if(args[i].toLowerCase().startsWith("destination:") && args[i].length() > 12){
@ -111,59 +110,60 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
}
}
if(!hasName){
player.sendMessage("§c[§7AdvancedPortals§c] You must include a name for the portal that you are creating in the variables!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must include a name for the portal that you are creating in the variables!");
return true;
}
World world = org.bukkit.Bukkit.getWorld(player.getMetadata("Pos1World").get(0).asString());
Location pos1 = new Location(world, player.getMetadata("Pos1X").get(0).asInt(), player.getMetadata("Pos1Y").get(0).asInt(), player.getMetadata("Pos1Z").get(0).asInt());
Location pos2 = new Location(world, player.getMetadata("Pos2X").get(0).asInt(), player.getMetadata("Pos2Y").get(0).asInt(), player.getMetadata("Pos2Z").get(0).asInt());
ConfigAccessor desticonfig = new ConfigAccessor(plugin, "Destinations.yml");
String destiPosX = desticonfig.getConfig().getString(destination + ".pos1.X");
if(!Portal.portalExists(portalName)){
player.sendMessage("");
player.sendMessage("§a[§eAdvancedPortals§a]§e You have created a new portal with the following details:");
player.sendMessage("§aname: §e" + portalName);
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a]\u00A7e You have created a new portal with the following details:");
player.sendMessage("\u00A7aname: \u00A7e" + portalName);
if(hasDestination){
player.sendMessage("§adestination: §e" + destination);
player.sendMessage("\u00A7adestination: \u00A7e" + destination);
}
else if(destiPosX == null){
player.sendMessage("§cdestination: §e" + destination + " (destination does not exist)");
player.sendMessage("\u00A7cdestination: \u00A7e" + destination + " (destination does not exist)");
}
else{
player.sendMessage("§cdestination: §eN/A (will not work)");
player.sendMessage("\u00A7cdestination: \u00A7eN/A (will not work)");
}
if(isBungeePortal){
player.sendMessage("§abungee: §e" + serverName);
player.sendMessage("\u00A7abungee: \u00A7e" + serverName);
}
Material triggerBlockMat = Material.getMaterial(0);
if(hasTriggerBlock){
triggerBlockMat = Material.getMaterial(triggerBlock.toUpperCase());
if(triggerBlockMat != null){
player.sendMessage("§atriggerBlock: §e" + triggerBlock.toUpperCase());
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, triggerBlockMat, serverName));; }
player.sendMessage("\u00A7atriggerBlock: \u00A7e" + triggerBlock.toUpperCase());
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, triggerBlockMat, serverName));
}
else{
hasTriggerBlock = false;
ConfigAccessor Config = new ConfigAccessor(plugin, "Config.yml");
player.sendMessage("§ctriggerBlock: §edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage("§cThe block " + triggerBlock.toUpperCase() + " is not a valid block name in minecraft so the trigger block has been set to the default!");
player.sendMessage("\u00A7ctriggerBlock: \u00A7edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage("\u00A7cThe block " + triggerBlock.toUpperCase() + " is not a valid block name in minecraft so the trigger block has been set to the default!");
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName));
}
}
else{
ConfigAccessor Config = new ConfigAccessor(plugin, "Config.yml");
player.sendMessage("§atriggerBlock: §edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage("\u00A7atriggerBlock: \u00A7edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName));
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] A portal by that name already exists!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] A portal by that name already exists!");
}
// add code to save the portal to the portal config and reload the portals
@ -171,55 +171,55 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
player.sendMessage("");
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] You need to at least add the name of the portal as a variable, §cType §e/portal variables§c"
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] 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("§c[§7AdvancedPortals§c] The points you have selected need to be in the same world!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The points you have selected need to be in the same world!");
}
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] You need to have two points selected to make a portal!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to have two points selected to make a portal!");
}
}
else if(args[0].toLowerCase().equals("variables")) {
player.sendMessage("§a[§eAdvancedPortals§a] Currently available variables: name, triggerBlock, destination");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Currently available variables: name, triggerBlock, destination");
player.sendMessage("");
player.sendMessage("§aExample command: §e/portal create name:test triggerId:portal");
player.sendMessage("\u00A7aExample command: \u00A7e/portal create name:test triggerId:portal");
}
else if(args[0].toLowerCase().equals("select")) {
// TODO finish the select command and the hit block to replace!
if(!player.hasMetadata("selectingPortal")){
if(args.length > 1){
if(Portal.portalExists(args[1])){
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, args[1]));
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] No portal by the name §e" + args[1] + "§c exists (maybe you got the caps wrong)\n Try typing §e/portal select§c and hit inside the apropriate portals area!");
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!");
}
}
else{
player.sendMessage("§a[§eAdvancedPortals§a] Hit a block inside the portal region to select the portal!");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] 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("§c[§7AdvancedPortals§c] Portal selection cancelled!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Portal selection cancelled!");
}
}
else if(args[0].toLowerCase().equals("gui")){
if(args.length > 1){
if(args[1].toLowerCase().equals("remove") && args.length > 2){
sender.sendMessage("");
sender.sendMessage("§c[§7AdvancedPortals§c] Are you sure you would like to remove the portal §e" + args[2] + "§c?");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
sender.sendMessage("");
plugin.nmsAccess.sendRawMessage("{text:\" \",extra:[{text:\"§e[Yes]\",hoverEvent:{action:show_text,value:\"Confirm removing this portal\"},clickEvent:{action:run_command,value:\"/portal remove " + args[2] + "\"}}, " +
"{text:\" \"},{text:\"§e[No]\",hoverEvent:{action:show_text,value:\"Cancel removing this portal\"},clickEvent:{action:run_command,value:\"/portal edit " + args[2] + "\"}}]}", player);
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);
sender.sendMessage("");
}
}
@ -232,7 +232,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
portalEditMenu(sender, portalConfig, args[1]);
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal by the name §e" + args[1] + "§c exists!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by the name \u00A7e" + args[1] + "\u00A7c exists!");
}
}
else{
@ -243,17 +243,17 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
portalEditMenu(sender, portalConfig, portalName);
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] The portal you had selected no longer seems to exist!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal has been defined or selected!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
}
}
}
else if(args[0].toLowerCase().equals("rename")) {
// not finished yet /
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
if(args.length > 1){
@ -261,31 +261,31 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String portalName = player.getMetadata("selectedPortal").get(0).asString();
if(portalName.toLowerCase() != args[1].toLowerCase()){
String posX = portalConfig.getConfig().getString(portalName + ".pos1.X");
String newPortalPosX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
if(posX != null && newPortalPosX == null){
Portal.rename(portalName, args[1]);
sender.sendMessage("§a[§eAdvancedPortals§a] The portal §e" + portalName + "§a has been renamed to §e" + args[1] + "§a.");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] 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("§c[§7AdvancedPortals§c] There is already a portal with the name §e" + args[1] + "§c!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] There is already a portal with the name \u00A7e" + args[1] + "\u00A7c!");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] The portal you had selected no longer seems to exist!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] The portal you have selected is already called that!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you have selected is already called that!");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal has been defined or selected!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You must select a portal first and then type §e/portal rename (new name)§c!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You must select a portal first and then type \u00A7e/portal rename (new name)\u00A7c!");
}
}
else if(args[0].toLowerCase().equals("remove")) {
@ -294,10 +294,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
if(posX != null){
Portal.remove(args[1]);
sender.sendMessage("§c[§7AdvancedPortals§c] The portal §e" + args[1] + "§c has been removed!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal \u00A7e" + args[1] + "\u00A7c has been removed!");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by that name exists!");
}
}
else{
@ -306,23 +306,23 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(portalName + ".pos1.X");
if(posX != null){
Portal.remove(portalName);
sender.sendMessage("§c[§7AdvancedPortals§c] The portal §7" + portalName + " has been removed!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal \u00A77" + portalName + " has been removed!");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] The portal you had selected no longer seems to exist!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you had selected no longer seems to exist!");
player.removeMetadata("selectedPortal", plugin);
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal has been defined or selected!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal has been defined or selected!");
}
}
}
else if(args[0].toLowerCase().equals("bukkitpage")) {
player.sendMessage("§a[§eAdvancedPortals§a] Bukkit page: (insert bitly link)!");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Bukkit page: (insert bitly link)!");
}
else if(args[0].toLowerCase().equals("helppage")) {
player.sendMessage("§a[§eAdvancedPortals§a] Help page: (insert bitly link)!");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Help page: (insert bitly link)!");
}
else if(args[0].toLowerCase().equals("show")){
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
@ -332,26 +332,26 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
Selection.Show(player, this.plugin, args[1]);
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by that name exists!");
}
}
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("§a[§eAdvancedPortals§a] Your currently selected area has been shown, it will dissapear shortly!");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Your currently selected area has been shown, it will dissapear shortly!");
Selection.Show(player, this.plugin);
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] The points you have selected need to be in the same world!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The points you have selected need to be in the same world!");
}
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] You need to have both points selected!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to have both points selected!");
}
}
}
else if(args[0].toLowerCase().equals("help")) {
player.sendMessage("§a[§eAdvancedPortals§a] Reloaded values!");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Reloaded values!");
Listeners.reloadValues(plugin);
Portal.loadPortals();
}
@ -375,47 +375,47 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
// make the text gui with the json message for a list of edit commands to be clicked or hovered
// put \" for a " in the json messages
// sadly there is no newline code so these three lines will have to be copied and pasted for each line
// use the usual messages for normal lines but anything that needs special features make sure you use the
// chat steriliser
sender.sendMessage("");
sender.sendMessage("§a[§eAdvancedPortals§a] Editing: §e" + portalName);
sender.sendMessage(" §apos1§e: " + portalConfig.getConfig().getString(portalName + ".pos1.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Z"));
sender.sendMessage(" §apos2§e: " + portalConfig.getConfig().getString(portalName + ".pos2.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Z"));
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] 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"));
String destination = portalConfig.getConfig().getString(portalName + ".destination");
if(destination != null){
sender.sendMessage(" §adestination§e: " + destination);
sender.sendMessage(" \u00A7adestination\u00A7e: " + destination);
}
else{
sender.sendMessage(" §cdestination§e: null");
sender.sendMessage(" \u00A7cdestination\u00A7e: null");
}
String trigger = portalConfig.getConfig().getString(portalName + ".triggerblock");
if(trigger != null){
sender.sendMessage(" §atriggerBlock§e: " + trigger);
sender.sendMessage(" \u00A7atriggerBlock\u00A7e: " + trigger);
}
else{
sender.sendMessage(" §ctriggerBlock§e: null");
sender.sendMessage(" \u00A7ctriggerBlock\u00A7e: null");
}
sender.sendMessage("");
Player player = (Player)sender;
plugin.nmsAccess.sendRawMessage("{text:\"§aFunctions§e: \",extra:[{text:\"§eRemove\",hoverEvent:{action:show_text,value:\"Remove the selected portal\"},clickEvent:{action:run_command,value:\"/portal gui remove " + portalName + "\"}}"
+ ",{text:\" \"},{text:\"§eShow\",hoverEvent:{action:show_text,value:\"Show the selected portal\"},clickEvent:{action:run_command,value:\"/portal show " + portalName + "\"}}"
+ ",{text:\" \"},{text:\"§eRename\",hoverEvent:{action:show_text,value:\"Change the name of the portal\"},clickEvent:{action:suggest_command,value:\"/portal rename \"}}"
+ ",{text:\" \"},{text:\"§eActivate\",hoverEvent:{action:show_text,value:\"Teleport to the set destination\n(same as entering the portal)\"},clickEvent:{action:run_command,value:\"/warp " + destination + "\"}}]}", player);
/**IChatBaseComponent comp = ChatSerializer.a("{text:\"§aFunctions§e: \",extra:[{text:\"§eRemove\",hoverEvent:{action:show_text,value:\"Remove the selected portal\"},clickEvent:{action:run_command,value:\"/portal gui remove " + portalName + "\"}}"
+ ",{text:\" \"},{text:\"§eShow\",hoverEvent:{action:show_text,value:\"Show the selected portal\"},clickEvent:{action:run_command,value:\"/portal show " + portalName + "\"}}"
+ ",{text:\" \"},{text:\"§eRename\",hoverEvent:{action:show_text,value:\"Change the name of the portal\"},clickEvent:{action:suggest_command,value:\"/portal rename \"}}"
+ ",{text:\" \"},{text:\"§eActivate\",hoverEvent:{action:show_text,value:\"Teleport to the set destination\n(same as entering the portal)\"},clickEvent:{action:run_command,value:\"/warp " + destination + "\"}}]}");
plugin.nmsAccess.sendRawMessage("{text:\"\u00A7aFunctions\u00A7e: \",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:\"\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:\"/warp " + destination + "\"}}]}", player);
/**IChatBaseComponent comp = ChatSerializer.a("{text:\"\u00A7aFunctions\u00A7e: \",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:\"\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:\"/warp " + destination + "\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);*/
sender.sendMessage("");
}
@Override
@ -427,12 +427,12 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
, "show", "variables", "wand", "remove", "rename", "help", "bukkitpage", "helppage"));
}
else if(args[0].toLowerCase().equals("create")){
boolean hasName = false;
boolean hasTriggerBlock = false;
boolean hasDestination = false;
boolean isBungeePortal = false;
for(int i = 1; i < args.length; i++){
if(args[i].toLowerCase().startsWith("name:") && args[i].length() > 5){
hasName = true;
@ -449,9 +449,9 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
else if(args[i].toLowerCase().startsWith("bungee:") && args[i].length() > 7){
isBungeePortal = true;
}
}
if(!hasName){autoComplete.add("name:");}
if(!hasTriggerBlock){autoComplete.add("triggerblock:");}
if(!hasDestination){autoComplete.add("destination:");autoComplete.add("desti:");}

View File

@ -1,31 +1,30 @@
package com.sekwah.advancedportals;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.bukkit.plugin.java.JavaPlugin;
import com.sekwah.advancedportals.DataCollector.DataCollector;
import com.sekwah.advancedportals.compat.NMS;
import com.sekwah.advancedportals.destinations.Destination;
import com.sekwah.advancedportals.metrics.Metrics;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
public class AdvancedPortalsPlugin extends JavaPlugin {
public NMS nmsAccess;
public void onEnable() {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
this.getServer().getConsoleSender().sendMessage("§aAdvanced portals have been sucsessfully enabled!");
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been sucsessfully enabled!");
String packageName = getServer().getClass().getPackage().getName();
String[] packageSplit = packageName.split("\\.");
String version = packageSplit[packageSplit.length - 1];
@ -99,7 +98,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
public void onDisable() {
this.getServer().getConsoleSender().sendMessage("§cAdvanced portals are being disabled!");
this.getServer().getConsoleSender().sendMessage("\u00A7cAdvanced portals are being disabled!");
}

View File

@ -2,14 +2,14 @@ package com.sekwah.advancedportals;
public class Assets {
public static int currentWarpParticles = 0;
public static int currentWarpSound = 0;
public static int currentWarpParticles = 0;
public Assets(AdvancedPortalsPlugin plugin) {
ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
currentWarpParticles = config.getConfig().getInt("WarpParticles");
currentWarpSound = config.getConfig().getInt("WarpSound");
}
public static int currentWarpSound = 0;
public Assets(AdvancedPortalsPlugin plugin) {
ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
currentWarpParticles = config.getConfig().getInt("WarpParticles");
currentWarpSound = config.getConfig().getInt("WarpSound");
}
}

View File

@ -1,28 +1,29 @@
package com.sekwah.advancedportals;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
public class ConfigAccessor {
private final String fileName;
private final JavaPlugin plugin;
private File configFile;
private FileConfiguration fileConfiguration;
public ConfigAccessor(JavaPlugin plugin, String fileName) {
if (!plugin.isInitialized())
throw new IllegalArgumentException("plugin must be initiaized");
this.plugin = plugin;
this.fileName = fileName;
}
// gets all of the
public void reloadConfig() {
if (configFile == null) {
@ -32,7 +33,7 @@ public class ConfigAccessor {
configFile = new File(dataFolder, fileName);
}
fileConfiguration = YamlConfiguration.loadConfiguration(configFile);
// Look for defaults in the jar
InputStream defConfigStream = plugin.getResource(fileName);
if (defConfigStream != null) {
@ -40,14 +41,14 @@ public class ConfigAccessor {
fileConfiguration.setDefaults(defConfig);
}
}
public FileConfiguration getConfig() {
if (fileConfiguration == null) {
this.reloadConfig();
}
return fileConfiguration;
}
// Saves all the data to the selected yml file
public void saveConfig() {
if (fileConfiguration == null || configFile == null) {
@ -60,23 +61,26 @@ public class ConfigAccessor {
}
}
}
// Saves
/**public void saveDefaultConfig() {
if (!configFile.exists()) {
this.plugin.saveResource(fileName, false);
}
}*/
/**
* public void saveDefaultConfig() {
* if (!configFile.exists()) {
* this.plugin.saveResource(fileName, false);
* }
* }
*/
// New save default config saving code, it checks if the needed config is in the jar file before
// overriding it.
public void saveDefaultConfig() {
if (configFile == null) {
configFile = new File(plugin.getDataFolder(), fileName);
configFile = new File(plugin.getDataFolder(), fileName);
}
if (!configFile.exists()) {
plugin.saveResource(fileName, false);
}
if (!configFile.exists()) {
plugin.saveResource(fileName, false);
}
}
}

View File

@ -1,18 +1,11 @@
package com.sekwah.advancedportals.DataCollector;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.destinations.Destination;
import com.sekwah.advancedportals.metrics.Metrics;
import com.sekwah.advancedportals.metrics.Metrics.Graph;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.Material;
import java.io.IOException;
import java.util.logging.Level;
public class DataCollector {

View File

@ -1,20 +1,16 @@
package com.sekwah.advancedportals;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import com.sekwah.advancedportals.destinations.Destination;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import com.sekwah.advancedportals.destinations.Destination;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class DestinationCommand implements CommandExecutor, TabCompleter {
@ -36,20 +32,20 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
if(posX == null){
sender.sendMessage("§a[§eAdvancedPortals§a] You have created a new destination called §e" + args[1] + "!");
sender.sendMessage("§a[\u00A7eAdvancedPortals\u00A7a] 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("§c[§7AdvancedPortals§c] A destination by that name already exists!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] A destination by that name already exists!");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] Please state the name of the destination you would like to create!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Please state the name of the destination you would like to create!");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to create portals so you cannot give yourself a \u00A7ePortal Region Selector\u00A7c!");
}
}
else if(args[0].toLowerCase().equals("remove")) {
@ -58,14 +54,14 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
if(posX != null){
Destination.remove(args[1]);
sender.sendMessage("§c[§7AdvancedPortals§c] The portal §e" + args[1] + "§c has been removed!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal \u00A7e" + args[1] + "\u00A7c has been removed!");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists.");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal by that name exists.");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to remove.");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to state the name of the destination you wish to remove.");
}
}
else if(args[0].toLowerCase().equals("goto") || args[0].toLowerCase().equals("warp")) {
@ -74,14 +70,14 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
if(configDesti.getConfig().getString(args[1] + ".world") != null){
Destination.warp(sender, args[1]);
sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[1] + "§a.");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been warped to \u00A7e" + args[1] + "\u00A7a.");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] No destination by that name exists.");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No destination by that name exists.");
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to teleport to.");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to state the name of the destination you wish to teleport to.");
}
}
else if(args[0].toLowerCase().equals("list")) {
@ -92,16 +88,16 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
{
int page = Integer.parseInt(args[1]);
if(page * 5 >= destiList.size() - 5){ // add this if statement so that the user cant select a list page higher than the max
if((int) destiList.size() / 5 == destiList.size()){
if(destiList.size() / 5 == destiList.size()){
}
}
sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
for(int i = (page - 1) * 5; i < page * 5; i++){
if(i > destiList.size()){
break;
}
sender.sendMessage(" §e" + destiList.get(i));
sender.sendMessage(" \u00A7e" + destiList.get(i));
}
return true;
}
@ -110,29 +106,29 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
}
}
sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
for(int i = 0; i < 5; i++){
if(i > destiList.size()){
break;
}
sender.sendMessage(" §e" + destiList.get(i));
sender.sendMessage(" \u00A7e" + destiList.get(i));
}
sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Showing destinations page 1 of 1");
for(int i = 0; i < 5; i++){
if(i > destiList.size()){
break;
}
sender.sendMessage(" §e" + destiList.get(i));
sender.sendMessage(" \u00A7e" + destiList.get(i));
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] There are currently no defined destinations.");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] There are currently no defined destinations.");
}
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + ", if you do not know what you can put or would like some help with the commands please type /" + command + " help");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to type something after /" + command + ", if you do not know what you can put or would like some help with the commands please type /" + command + " help");
}
return true;
}

View File

@ -1,22 +1,20 @@
package com.sekwah.advancedportals;
import org.bukkit.Material;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFromToEvent;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
public class FlowStopper implements Listener {
@SuppressWarnings("unused")
private final AdvancedPortalsPlugin plugin;
// The needed config values will be stored so they are easier to access later
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("<EFBFBD>eP...
private boolean WaterFlow = true;
public FlowStopper(AdvancedPortalsPlugin plugin) {

View File

@ -1,5 +1,8 @@
package com.sekwah.advancedportals;
import com.sekwah.advancedportals.events.WarpEvent;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -15,11 +18,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.metadata.FixedMetadataValue;
import com.sekwah.advancedportals.DataCollector.DataCollector;
import com.sekwah.advancedportals.events.WarpEvent;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
public class Listeners implements Listener {
private final AdvancedPortalsPlugin plugin;
@ -27,7 +25,7 @@ public class Listeners implements Listener {
private boolean DefaultPortalMessages = true;
// The needed config values will be stored so they are easier to access later
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("\u00A7eP...
private static boolean UseOnlyServerAxe = false;
private static Material WandMaterial;
@ -105,7 +103,7 @@ public class Listeners implements Listener {
if(DefaultPortalMessages && warped){
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
player.sendMessage("");
player.sendMessage("§a[§eAdvancedPortals§a] You have warped to §e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination") + ".");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have warped to \u00A7e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination") + ".");
player.sendMessage("");
}
@ -195,7 +193,7 @@ public class Listeners implements Listener {
if((Portal.Portals[portalId].pos1.getX() + 3D) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= block.getZ()){
if((Portal.Portals[portalId].pos2.getX() - 3D) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= block.getZ()){
player.sendMessage("§a[§eAdvancedPortals§a] You have selected: §e" + Portal.Portals[portalId].portalName);
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have selected: \u00A7e" + Portal.Portals[portalId].portalName);
// TODO add code somewhere so when a portal is removed or changed if someone has it selected it notifies them
// or removed their selections and tells them, maybe not before this update.
player.removeMetadata("selectingPortal", plugin);
@ -210,7 +208,7 @@ public class Listeners implements Listener {
}
portalId++;
}
player.sendMessage("§c[§7AdvancedPortals§c] No portal was selected - if you would like to stop selecting please type §e/portal select §cagain!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] No portal was selected - if you would like to stop selecting please type \u00A7e/portal select \u00A7cagain!");
event.setCancelled(true);
return;
}
@ -220,7 +218,7 @@ public class Listeners implements Listener {
// UseOnlyServerMadeAxe being set to true makes is so only the axe generated by the server can be used so other iron axes can be used normally,
// by default its false but it is a nice feature in case the user wants to use the axe normally too, such as a admin playing survival or it being used
// as a weapon.
if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§ePortal Region Selector")) && event.getPlayer().getItemInHand().getTypeId() == WandMaterial.getId()) {
if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("\u00A7ePortal Region Selector")) && event.getPlayer().getItemInHand().getTypeId() == WandMaterial.getId()) {
// This checks if the action was a left or right click and if it was directly effecting a block.
if(event.getAction() == Action.LEFT_CLICK_BLOCK) {
@ -231,7 +229,7 @@ public class Listeners implements Listener {
player.setMetadata("Pos1Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
player.setMetadata("Pos1Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
player.setMetadata("Pos1World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
player.sendMessage("§eYou have selected pos1! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
player.sendMessage("\u00A7eYou have selected pos1! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
// Stops the event so the block is not damaged
event.setCancelled(true);
@ -245,7 +243,7 @@ public class Listeners implements Listener {
player.setMetadata("Pos2Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
player.setMetadata("Pos2Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
player.setMetadata("Pos2World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
player.sendMessage("§eYou have selected pos2! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
player.sendMessage("\u00A7eYou have selected pos2! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
// Stops the event so the block is not interacted with
event.setCancelled(true);

View File

@ -8,12 +8,12 @@ public class PluginMessages {
// easily changed.
public static void UnknownCommand(CommandSender sender, String command) {
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n");
sender.sendMessage("§cIf you do not know what you can put or would like some help with the commands please type §e" + '"' + "§e/" + command + " help" + '"' + "§c\n");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] 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("§c[§7AdvancedPortals§c] You do not have permission to perform that command!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to perform that command!");
}
}

View File

@ -1,26 +1,23 @@
package com.sekwah.advancedportals;
import java.util.List;
import org.bukkit.Material;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import java.util.List;
public class PortalProtect implements Listener {
@SuppressWarnings("unused")
private final AdvancedPortalsPlugin plugin;
// The needed config values will be stored so they are easier to access later
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("<EFBFBD>eP...
private boolean PortalProtect = true;
private double PortalProtectionRadius = 5D;
@ -37,7 +34,8 @@ public class PortalProtect implements Listener {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
}
@SuppressWarnings("unused")
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event){
@ -62,7 +60,8 @@ public class PortalProtect implements Listener {
}
}
}
@SuppressWarnings("unused")
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event){
@ -70,8 +69,7 @@ public class PortalProtect implements Listener {
Block block = event.getBlock();
Object[] portals = Portal.Portals;
int portalId = 0;
for(Object portal : portals){
for(int portalId = 0; portalId < portals.length; portalId++){
if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){

View File

@ -228,51 +228,51 @@ public class Selection {
for(int x = LowX; x <= HighX; x++){
Location loc = new Location(player.getWorld(), x, LowY, LowZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int x = LowX; x <= HighX; x++){
Location loc = new Location(player.getWorld(), x, LowY, HighZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int z = LowZ; z <= HighZ; z++){
Location loc = new Location(player.getWorld(), LowX, LowY, z);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int z = LowZ; z <= HighZ; z++){
Location loc = new Location(player.getWorld(), HighX, LowY, z);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int y = LowY; y <= HighY; y++){
Location loc = new Location(player.getWorld(), LowX, y, LowZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int y = LowY; y <= HighY; y++){
Location loc = new Location(player.getWorld(), LowX, y, HighZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int y = LowY; y <= HighY; y++){
Location loc = new Location(player.getWorld(), HighX, y, LowZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int y = LowY; y <= HighY; y++){
Location loc = new Location(player.getWorld(), HighX, y, HighZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int x = LowX; x <= HighX; x++){
Location loc = new Location(player.getWorld(), x, HighY, HighZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int x = LowX; x <= HighX; x++){
Location loc = new Location(player.getWorld(), x, HighY, LowZ);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int z = LowZ; z <= HighZ; z++){
Location loc = new Location(player.getWorld(), LowX, HighY, z);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
for(int z = LowZ; z <= HighZ; z++){
Location loc = new Location(player.getWorld(), HighX, HighY, z);
player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
player.sendBlockChange(loc, loc.getBlock().getType(), loc.getBlock().getData());
}
}

View File

@ -1,21 +1,19 @@
package com.sekwah.advancedportals;
import com.sekwah.advancedportals.destinations.Destination;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import com.sekwah.advancedportals.destinations.Destination;
public class WarpCommand implements CommandExecutor, TabCompleter {
@SuppressWarnings("unused")
private AdvancedPortalsPlugin plugin;
public WarpCommand(AdvancedPortalsPlugin plugin) {
@ -30,18 +28,18 @@ public class WarpCommand implements CommandExecutor, TabCompleter {
if(args.length > 0){
if(Destination.warp(sender, args[0], false)){
sender.sendMessage("");
sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[0] + ".");
sender.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been warped to \u00A7e" + args[0] + ".");
sender.sendMessage("");
}
else{
sender.sendMessage("");
sender.sendMessage("§c[§7AdvancedPortals§c] The destination you tried to warp to does not exist!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The destination you tried to warp to does not exist!");
sender.sendMessage("");
}
}
else{
sender.sendMessage("");
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type a destination after /" + command + "!");
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You need to type a destination after /" + command + "!");
sender.sendMessage("");
}
return true;
@ -52,7 +50,7 @@ public class WarpCommand implements CommandExecutor, TabCompleter {
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
LinkedList<String> autoComplete = new LinkedList<String>();
if(sender.hasPermission("AdvancedPortals.CreatePortal")){
/**if(sender.hasPermission("AdvancedPortals.CreatePortal")){
if(args.length == 1){
autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
}
@ -64,7 +62,7 @@ public class WarpCommand implements CommandExecutor, TabCompleter {
if(!result.toString().startsWith(args[args.length - 1])){
autoComplete.remove(result);
}
}
}*/
return autoComplete;
}

View File

@ -3,7 +3,6 @@ package com.sekwah.advancedportals.compat;
import net.minecraft.server.v1_7_R1.ChatSerializer;
import net.minecraft.server.v1_7_R1.IChatBaseComponent;
import net.minecraft.server.v1_7_R1.PacketPlayOutChat;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;

View File

@ -3,10 +3,10 @@ package com.sekwah.advancedportals.compat;
import net.minecraft.server.v1_7_R2.ChatSerializer;
import net.minecraft.server.v1_7_R2.IChatBaseComponent;
import net.minecraft.server.v1_7_R2.PacketPlayOutChat;
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
@SuppressWarnings("unused")
public class v1_7_R2 implements NMS {
@Override

View File

@ -3,10 +3,10 @@ package com.sekwah.advancedportals.compat;
import net.minecraft.server.v1_7_R3.ChatSerializer;
import net.minecraft.server.v1_7_R3.IChatBaseComponent;
import net.minecraft.server.v1_7_R3.PacketPlayOutChat;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
@SuppressWarnings("unused")
public class v1_7_R3 implements NMS {
@Override

View File

@ -3,10 +3,10 @@ package com.sekwah.advancedportals.compat;
import net.minecraft.server.v1_7_R4.ChatSerializer;
import net.minecraft.server.v1_7_R4.IChatBaseComponent;
import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
@SuppressWarnings("unused")
public class v1_7_R4 implements NMS {
@Override

View File

@ -1,26 +1,21 @@
package com.sekwah.advancedportals.destinations;
import java.util.Arrays;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.effects.WarpEffects;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import com.mysql.jdbc.Util;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.effects.WarpEffects;
public class Destination {
private static AdvancedPortalsPlugin plugin;
@ -131,7 +126,7 @@ public class Destination {
}
else{
if(senderror){
player.sendMessage("§c[§7AdvancedPortals§c] The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\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!");
}
@ -140,7 +135,7 @@ public class Destination {
}
else{
if(senderror){
player.sendMessage("§c[§7AdvancedPortals§c] There has been a problem warping you to the selected destination!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] There has been a problem warping you to the selected destination!");
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!");
}
@ -152,7 +147,7 @@ public class Destination {
/**
* Same as other warp but changes sender to player for you.
*
* @param sender
* @param player
* @param name
* @return
*/
@ -194,8 +189,8 @@ public class Destination {
LinkedList<String> destiList = new LinkedList<String>();
Set<String> destiSet = config.getConfig().getKeys(false);
if(destiSet.size() > 0){;
for(Object desti: destiSet.toArray()){
if(destiSet.size() > 0){
for(Object desti: destiSet.toArray()){
destiSet.add(desti.toString());
}
}

View File

@ -1,16 +1,12 @@
package com.sekwah.advancedportals.effects;
import com.sekwah.advancedportals.Assets;
import org.bukkit.Effect;
import org.bukkit.Instrument;
import org.bukkit.Location;
import org.bukkit.Note;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.Note.Tone;
import org.bukkit.entity.Player;
import com.sekwah.advancedportals.Assets;
public class WarpEffects {
public static void activateParticles(Player player) {

View File

@ -1,11 +1,9 @@
package com.sekwah.advancedportals.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Cancellable;
import com.sekwah.advancedportals.portalcontrolls.Portal;
public final class WarpEvent extends Event implements Cancellable {
@ -18,7 +16,10 @@ public final class WarpEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private Player player;
@SuppressWarnings("unused")
private String portalName;
private boolean hasWarped = false;
@ -47,6 +48,7 @@ public final class WarpEvent extends Event implements Cancellable {
*
* @param warped
*/
@SuppressWarnings("unused")
public void setHasWarped(boolean warped){
this.hasWarped = warped;
}

View File

@ -34,23 +34,12 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;

View File

@ -1,21 +1,18 @@
package com.sekwah.advancedportals.portalcontrolls;
import java.util.Set;
import java.util.logging.Level;
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.destinations.Destination;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
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.DataCollector.DataCollector;
import com.sekwah.advancedportals.destinations.Destination;
import com.sekwah.advancedportals.events.WarpEvent;
import java.util.Set;
import java.util.logging.Level;
public class Portal {
@ -100,7 +97,7 @@ public class Portal {
if(!pos1.getWorld().equals(pos2.getWorld())){
plugin.getLogger().log(Level.WARNING, "pos1 and pos2 must be in the same world!");
return "§cPortal creation error, pos1 and pos2 must be in the same world!";
return "\u00A7cPortal creation error, pos1 and pos2 must be in the same world!";
}
int LowX = 0;
@ -141,7 +138,7 @@ public class Portal {
if(checkPortalOverlap(checkpos1, checkpos2)){
plugin.getLogger().log(Level.WARNING, "Portals must not overlap!");
return "§cPortal creation error, portals must not overlap!";
return "\u00A7cPortal creation error, portals must not overlap!";
}
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
@ -166,7 +163,7 @@ public class Portal {
loadPortals();
return "§aPortal creation successful!";
return "\u00A7aPortal creation successful!";
}
// make this actually work!
@ -327,7 +324,7 @@ public class Portal {
if(config.getConfig().getString(portalName + ".bungee") != null){
if(ShowBungeeMessage){
player.sendMessage("§a[§eAdvancedPortals§a] Attempting to warp to §e" + config.getConfig().getString(portalName + ".bungee") + "§a.");
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] Attempting to warp to \u00A7e" + config.getConfig().getString(portalName + ".bungee") + "\u00A7a.");
}
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
@ -345,7 +342,7 @@ public class Portal {
return warped;
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] The destination you are currently attempting to warp to doesnt exist!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The destination you are currently attempting to warp to doesnt exist!");
plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
+ "attempt and either the data is corrupt or that destination listed doesn't exist!");
return false;
@ -353,7 +350,7 @@ public class Portal {
}
else{
player.sendMessage("§c[§7AdvancedPortals§c] The portal you are trying to use doesn't have a destination!");
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] The portal you are trying to use doesn't have a destination!");
plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
+ "attempt and either the data is corrupt or portal doesn't exist!");
return false;