mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-09-27 14:52:59 +02:00
Merge branch 'master' into portals-rewrite
# Conflicts: # src/com/sekwah/advancedportals/listeners/PortalProtect.java
This commit is contained in:
commit
b94ec07573
@ -1,6 +1,6 @@
|
|||||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||||
name: AdvancedPortals
|
name: AdvancedPortals
|
||||||
version: 0.0.20
|
version: 0.0.21
|
||||||
author: sekwah41
|
author: sekwah41
|
||||||
description: An advanced portals plugin for bukkit.
|
description: An advanced portals plugin for bukkit.
|
||||||
commands:
|
commands:
|
||||||
@ -10,7 +10,7 @@ commands:
|
|||||||
usage: /<command>
|
usage: /<command>
|
||||||
destination:
|
destination:
|
||||||
description: Can be used to access portal destinations.
|
description: Can be used to access portal destinations.
|
||||||
aliases: [desti, awarp]
|
aliases: [desti]
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permissions:
|
permissions:
|
||||||
advancedportals.*:
|
advancedportals.*:
|
||||||
|
2
pom.xml
2
pom.xml
@ -16,7 +16,7 @@
|
|||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<version>0.0.20-snapshot</version>
|
<version>0.0.21-snapshot</version>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
|
@ -65,8 +65,9 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
inventory.addItem(regionselector);
|
inventory.addItem(regionselector);
|
||||||
sender.sendMessage(PluginMessages.customPrefix + " You have been given a \u00A7ePortal Region Selector\u00A7a!");
|
sender.sendMessage(PluginMessages.customPrefix + " You have been given a \u00A7ePortal Region Selector\u00A7a!");
|
||||||
break;
|
break;
|
||||||
case "portal":
|
|
||||||
case "portalblock":
|
case "portalblock":
|
||||||
|
// TODO change this to a purple wool block and give it a name with a color. Then listen to when its placed.
|
||||||
|
// Also do this for other blocks such as gateways and end portals just in case they want it.
|
||||||
ItemStack portalBlock = new ItemStack(Material.PORTAL, 1);
|
ItemStack portalBlock = new ItemStack(Material.PORTAL, 1);
|
||||||
|
|
||||||
inventory.addItem(portalBlock);
|
inventory.addItem(portalBlock);
|
||||||
@ -75,7 +76,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
break;
|
break;
|
||||||
case "create":
|
case "create":
|
||||||
if (player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")) {
|
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())) {
|
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())) {
|
||||||
if (args.length >= 2) { // may make this next piece of code more efficient, maybe check against a list of available variables or something
|
if (args.length >= 2) { // may make this next piece of code more efficient, maybe check against a list of available variables or something
|
||||||
// TODO change system to use arrays and hashmaps
|
// TODO change system to use arrays and hashmaps
|
||||||
boolean hasName = false;
|
boolean hasName = false;
|
||||||
@ -210,7 +212,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "variables" :
|
case "variables" :
|
||||||
sender.sendMessage(PluginMessages.customPrefix + " Currently available variables: name, triggerBlock, destination");
|
sender.sendMessage(PluginMessages.customPrefix + " \u00A77Variables \u00A7c: \u00A7aname, triggerBlock, destination");
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage("\u00A7aExample command: \u00A7e/portal create name:test triggerId:portal");
|
sender.sendMessage("\u00A7aExample command: \u00A7e/portal create name:test triggerId:portal");
|
||||||
break;
|
break;
|
||||||
@ -239,8 +241,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(PluginMessages.customPrefixFail + " Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
|
sender.sendMessage(PluginMessages.customPrefixFail + " Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
plugin.compat.sendRawMessage("{\"text\":\" \",\"extra\":[{\"text\":\"\u00A7e[Yes]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Confirm removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal remove " + args[2] + "\"}}, " +
|
plugin.compat.sendRawMessage("{\"text\":\" \",\"extra\":[{\"text\":\"\u00A7e[Yes]\",\"hoverEvent\":{\"action\":\"show_text\"," +
|
||||||
"{\"text\":\" \"},{\"text\":\"\u00A7e[No]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Cancel removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal edit " + args[2] + "\"}}]}", player);
|
"\"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("");
|
sender.sendMessage("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,6 +370,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
sender.sendMessage("\u00A76/" + command + " portal \u00A7a- gives you a portal block");
|
sender.sendMessage("\u00A76/" + command + " portal \u00A7a- gives you a portal block");
|
||||||
sender.sendMessage("\u00A76/" + command + " select \u00A7a- selects an existing portal");
|
sender.sendMessage("\u00A76/" + command + " select \u00A7a- selects an existing portal");
|
||||||
sender.sendMessage("\u00A76/" + command + " remove \u00A7a- removes a portal");
|
sender.sendMessage("\u00A76/" + command + " remove \u00A7a- removes a portal");
|
||||||
|
sender.sendMessage("\u00A76/" + command + " list \u00A7a- lists all the current portals");
|
||||||
sender.sendMessage("\u00A76/" + command + " variables \u00A7a- lists all available tags");
|
sender.sendMessage("\u00A76/" + command + " variables \u00A7a- lists all available tags");
|
||||||
sender.sendMessage("\u00A7e\u00A7m-----------------------------------");
|
sender.sendMessage("\u00A7e\u00A7m-----------------------------------");
|
||||||
break;
|
break;
|
||||||
@ -382,7 +387,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
player.sendMessage(PluginMessages.customPrefix + " Your currently selected portal has been shown, it will dissapear shortly!");
|
player.sendMessage(PluginMessages.customPrefix + " Your currently selected portal has been shown, it will dissapear shortly!");
|
||||||
Selection.Show(player, this.plugin, player.getMetadata("selectedPortal").get(0).asString());
|
Selection.Show(player, this.plugin, player.getMetadata("selectedPortal").get(0).asString());
|
||||||
} else if (player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")) {
|
} 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())) {
|
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(PluginMessages.customPrefix + " Your currently selected area has been shown, it will dissapear shortly!");
|
player.sendMessage(PluginMessages.customPrefix + " Your currently selected area has been shown, it will dissapear shortly!");
|
||||||
Selection.Show(player, this.plugin, null);
|
Selection.Show(player, this.plugin, null);
|
||||||
}
|
}
|
||||||
@ -397,15 +403,20 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
Portal.loadPortals();
|
Portal.loadPortals();
|
||||||
break;
|
break;
|
||||||
case "list" :
|
case "list" :
|
||||||
String message = PluginMessages.customPrefix + " \u00A7c:\u00A7a";
|
String message = PluginMessages.customPrefix + " \u00A77Portals \u00A7c:\u00A7a";
|
||||||
|
LinkedList<String> portals = new LinkedList<>();
|
||||||
for (AdvancedPortal portal : Portal.Portals) {
|
for (AdvancedPortal portal : Portal.Portals) {
|
||||||
message = message + " " + portal.portalName;
|
portals.add(portal.portalName);
|
||||||
|
}
|
||||||
|
Collections.sort(portals);
|
||||||
|
for (Object portalName : portals.toArray()) {
|
||||||
|
message = message + " " + portalName;
|
||||||
}
|
}
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PluginMessages.UnknownCommand(sender, command);
|
PluginMessages.UnknownCommand(sender, command);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PluginMessages.UnknownCommand(sender, command);
|
PluginMessages.UnknownCommand(sender, command);
|
||||||
}
|
}
|
||||||
@ -449,8 +460,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(PluginMessages.customPrefix + " Editing: \u00A7e" + portalName);
|
sender.sendMessage(PluginMessages.customPrefix + " Editing: \u00A7e" + portalName);
|
||||||
|
|
||||||
sender.sendMessage(" \u00A7apos1\u00A7e: " + portalConfig.getConfig().getString(portalName + ".pos1.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos1.Z"));
|
sender.sendMessage(" \u00A7apos1\u00A7e: " + portalConfig.getConfig().getString(portalName + ".pos1.X")
|
||||||
sender.sendMessage(" \u00A7apos2\u00A7e: " + portalConfig.getConfig().getString(portalName + ".pos2.X") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Y") + ", " + portalConfig.getConfig().getString(portalName + ".pos2.Z"));
|
+ ", " + 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");
|
String destination = portalConfig.getConfig().getString(portalName + ".destination");
|
||||||
if (destination != null) {
|
if (destination != null) {
|
||||||
@ -485,7 +498,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
plugin.compat.sendRawMessage("{\"text\":\"\u00A7aFunctions\u00A7e: \",\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal gui remove " + portalName + "\"}}"
|
plugin.compat.sendRawMessage("{\"text\":\"\u00A7aFunctions\u00A7e: \"," +
|
||||||
|
"\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal gui remove " + portalName + "\"}}"
|
||||||
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal show " + portalName + "\"}}"
|
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"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\":\"clickEvent\",\"value\":\"/warp " + destination + "\"}}]}", player);
|
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eActivate\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Teleport to the set destination\n(same as entering the portal)\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/warp " + destination + "\"}}]}", player);
|
||||||
@ -499,7 +513,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
LinkedList<String> autoComplete = new LinkedList<String>();
|
LinkedList<String> autoComplete = new LinkedList<String>();
|
||||||
if (sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
if (sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
autoComplete.addAll(Arrays.asList("create", "portal", "portalblock", "select", "selector"
|
autoComplete.addAll(Arrays.asList("create", "list", "portalblock", "select", "selector"
|
||||||
, "show", "variables", "wand", "remove", "rename", "help", "bukkitpage", "helppage"));
|
, "show", "variables", "wand", "remove", "rename", "help", "bukkitpage", "helppage"));
|
||||||
} else if (args[0].toLowerCase().equals("create")) {
|
} else if (args[0].toLowerCase().equals("create")) {
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class CraftBukkit {
|
|||||||
|
|
||||||
playerConnection.getClass().getMethod("sendPacket", this.packet).invoke(playerConnection, packet);
|
playerConnection.getClass().getMethod("sendPacket", this.packet).invoke(playerConnection, packet);
|
||||||
|
|
||||||
} catch (IllegalAccessException |InvocationTargetException | NoSuchMethodException | NoSuchFieldException
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | NoSuchFieldException
|
||||||
| InstantiationException e) {
|
| InstantiationException e) {
|
||||||
this.plugin.getLogger().warning("Error creating raw message, something must be wrong with reflection");
|
this.plugin.getLogger().warning("Error creating raw message, something must be wrong with reflection");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -9,10 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DestinationCommand implements CommandExecutor, TabCompleter {
|
public class DestinationCommand implements CommandExecutor, TabCompleter {
|
||||||
|
|
||||||
@ -67,22 +64,36 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
break;
|
break;
|
||||||
case "list":
|
case "list":
|
||||||
String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a";
|
String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a";
|
||||||
for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti;
|
List<Object> destiObj = Arrays.asList(config.getConfig().getKeys(false).toArray());
|
||||||
|
LinkedList<String> destis = new LinkedList<>();
|
||||||
|
for (Object object : destiObj.toArray()) {
|
||||||
|
destis.add(object.toString());
|
||||||
|
}
|
||||||
|
Collections.sort(destis);
|
||||||
|
for (Object desti : destis.toArray()) message = message + " " + desti;
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
break;
|
break;
|
||||||
case "help":
|
case "help":
|
||||||
sender.sendMessage(PluginMessages.customPrefix + " Destination Help Menu");
|
sender.sendMessage(PluginMessages.customPrefix + " Destination Help Menu");
|
||||||
sender.sendMessage("\u00A7e\u00A7m----------------------------");
|
sender.sendMessage("\u00A7e\u00A7m----------------------------");
|
||||||
sender.sendMessage("\u00A76/" + command + " \u00A7c[name] \u00A7a- teleport to destination");
|
|
||||||
sender.sendMessage("\u00A76/" + command + " create \u00A7c[name] \u00A7a- create destination at your location");
|
sender.sendMessage("\u00A76/" + command + " create \u00A7c[name] \u00A7a- create destination at your location");
|
||||||
sender.sendMessage("\u00A76/" + command + " remove \u00A7c[name] \u00A7a- remove destination");
|
sender.sendMessage("\u00A76/" + command + " remove \u00A7c[name] \u00A7a- remove destination");
|
||||||
|
sender.sendMessage("\u00A76/" + command + " warp \u00A7c[name] \u00A7a- teleport to destination");
|
||||||
sender.sendMessage("\u00A76/" + command + " list \u00A7a- list all destinations");
|
sender.sendMessage("\u00A76/" + command + " list \u00A7a- list all destinations");
|
||||||
sender.sendMessage("\u00A7e\u00A7m----------------------------");
|
sender.sendMessage("\u00A7e\u00A7m----------------------------");
|
||||||
break;
|
break;
|
||||||
default:
|
case "warp":
|
||||||
Destination.warp((Player) sender, args[0]);
|
if(args.length >= 2){
|
||||||
|
Destination.warp((Player) sender, args[1]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sender.sendMessage(PluginMessages.customPrefixFail + " You must specify a warp location!");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
PluginMessages.UnknownCommand(sender, command);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PluginMessages.UnknownCommand(sender, command);
|
PluginMessages.UnknownCommand(sender, command);
|
||||||
}
|
}
|
||||||
@ -92,11 +103,13 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
||||||
LinkedList<String> autoComplete = new LinkedList<String>();
|
LinkedList<String> autoComplete = new LinkedList<>();
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
for (String string : config.getConfig().getKeys(false)) {
|
if(args.length > 1 && args[0].equalsIgnoreCase("warp")){
|
||||||
if (sender.hasPermission("advancedportals.desti.*") | sender.hasPermission("advancedportals.desti." + string))
|
for (String string : config.getConfig().getKeys(false)) {
|
||||||
autoComplete.add(string);
|
if (sender.hasPermission("advancedportals.desti.*") | sender.hasPermission("advancedportals.desti." + string))
|
||||||
|
autoComplete.add(string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sender.hasPermission("advancedportals.desti") | sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
if (sender.hasPermission("advancedportals.desti") | sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
@ -104,6 +117,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
} else if (args[0].toLowerCase().equals("create")) {
|
} else if (args[0].toLowerCase().equals("create")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
autoComplete.add("warp");
|
||||||
Collections.sort(autoComplete);
|
Collections.sort(autoComplete);
|
||||||
for (Object result : autoComplete.toArray()) {
|
for (Object result : autoComplete.toArray()) {
|
||||||
if (!result.toString().startsWith(args[args.length - 1])) {
|
if (!result.toString().startsWith(args[args.length - 1])) {
|
||||||
|
12
src/com/sekwah/advancedportals/destinations/PortalWarp.java
Normal file
12
src/com/sekwah/advancedportals/destinations/PortalWarp.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.sekwah.advancedportals.destinations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by on 04/08/2016.
|
||||||
|
*
|
||||||
|
* TODO load the destinations into memory rather than constantly reading from the yml.
|
||||||
|
*
|
||||||
|
* @author sekwah41
|
||||||
|
*/
|
||||||
|
public class PortalWarp {
|
||||||
|
|
||||||
|
}
|
@ -25,9 +25,8 @@ public class Listeners implements Listener {
|
|||||||
// an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("\u00A7eP...
|
// 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 boolean UseOnlyServerAxe = false;
|
||||||
private static Material WandMaterial;
|
private static Material WandMaterial;
|
||||||
private static boolean ShowBungeeMessage;
|
|
||||||
private final AdvancedPortalsPlugin plugin;
|
private final AdvancedPortalsPlugin plugin;
|
||||||
private int PortalMessagesDisplay = 2;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public Listeners(AdvancedPortalsPlugin plugin) {
|
public Listeners(AdvancedPortalsPlugin plugin) {
|
||||||
@ -38,8 +37,6 @@ public class Listeners implements Listener {
|
|||||||
|
|
||||||
String ItemID = config.getConfig().getString("AxeItemId");
|
String ItemID = config.getConfig().getString("AxeItemId");
|
||||||
|
|
||||||
PortalMessagesDisplay = config.getConfig().getInt("WarpMessageDisplay");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
|
WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -55,8 +52,6 @@ public class Listeners implements Listener {
|
|||||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||||
UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
|
UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
|
||||||
|
|
||||||
ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
|
|
||||||
|
|
||||||
String ItemID = config.getConfig().getString("AxeItemId");
|
String ItemID = config.getConfig().getString("AxeItemId");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -83,7 +78,7 @@ public class Listeners implements Listener {
|
|||||||
Location loc = event.getTo();
|
Location loc = event.getTo();
|
||||||
Location eyeLoc = new Location(loc.getWorld(), loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ());
|
Location eyeLoc = new Location(loc.getWorld(), loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ());
|
||||||
for (AdvancedPortal portal : Portal.Portals) {
|
for (AdvancedPortal portal : Portal.Portals) {
|
||||||
if (Portal.locationInPortalTrigger(portal, loc) | Portal.locationInPortalTrigger(portal, eyeLoc)) {
|
if (Portal.locationInPortalTrigger(portal, loc) || Portal.locationInPortalTrigger(portal, eyeLoc)) {
|
||||||
if (portal.trigger.equals(Material.PORTAL)) {
|
if (portal.trigger.equals(Material.PORTAL)) {
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE)) {
|
if (player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||||
player.setMetadata("hasWarped", new FixedMetadataValue(plugin, true));
|
player.setMetadata("hasWarped", new FixedMetadataValue(plugin, true));
|
||||||
|
Loading…
Reference in New Issue
Block a user