mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-23 02:55:39 +01:00
Added the warp messages from the portals and also updated the edit menu
This commit is contained in:
parent
4846530568
commit
a68014c5e6
@ -40,8 +40,10 @@ ShowSelectionShowDuration: 10
|
||||
|
||||
WarpRiddenEntity: true
|
||||
|
||||
# Use plugin name in the warp messages
|
||||
# Use the default warp messages for portals
|
||||
portalWarpMessages: true
|
||||
|
||||
# Use plugin name in the warp messages
|
||||
useWarpPrefix: true
|
||||
|
||||
# If this is true a custom prefix can be used
|
||||
|
@ -433,7 +433,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
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:\"§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 + "\"}}]}");
|
||||
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
sender.sendMessage("");
|
||||
|
@ -22,6 +22,8 @@ public class Listeners implements Listener {
|
||||
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
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...
|
||||
private static boolean UseOnlyServerAxe = false;
|
||||
@ -37,6 +39,8 @@ public class Listeners implements Listener {
|
||||
|
||||
String ItemID = config.getConfig().getString("AxeItemId");
|
||||
|
||||
defaultPortalMessages = config.getConfig().getBoolean("portalWarpMessages");
|
||||
|
||||
try
|
||||
{
|
||||
WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
|
||||
@ -86,8 +90,14 @@ public class Listeners implements Listener {
|
||||
if((Portal.pos1[portalId].getX() + 1D) >= loc.getX() && (Portal.pos1[portalId].getY() + 1D) >= loc.getY() && (Portal.pos1[portalId].getZ() + 1D) >= loc.getZ()){
|
||||
if(Portal.pos2[portalId].getX() <= loc.getX() && Portal.pos2[portalId].getY() <= loc.getY() && Portal.pos2[portalId].getZ() <= loc.getZ()){
|
||||
|
||||
boolean warped = Portal.activate(player, portal.toString());
|
||||
|
||||
boolean warped = Portal.activate(player, portal.toString());
|
||||
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.toString() + ".destination") + ".");
|
||||
player.sendMessage("");
|
||||
}
|
||||
|
||||
if(!warped){
|
||||
player.teleport(fromloc);
|
||||
@ -105,7 +115,7 @@ public class Listeners implements Listener {
|
||||
public void run(){
|
||||
finalplayer.removeMetadata("HasWarped", plugin);
|
||||
}
|
||||
}, 40);
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,14 +29,20 @@ public class WarpCommand implements CommandExecutor, TabCompleter {
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
||||
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("");
|
||||
}
|
||||
else{
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage("§c[§7AdvancedPortals§c] 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("");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class Portal {
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(config.getConfig().getString(portalName + ".bungee"));
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
else{
|
||||
|
Loading…
Reference in New Issue
Block a user