mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-09-30 08:07:40 +02:00
the text gui menus now work even better
This commit is contained in:
parent
7f806a0c55
commit
c987143838
@ -244,8 +244,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage("§c[§7AdvancedPortals§c] Are you sure you would like to remove the portal §e" + args[2] + "§c?");
|
sender.sendMessage("§c[§7AdvancedPortals§c] Are you sure you would like to remove the portal §e" + args[2] + "§c?");
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
IChatBaseComponent comp = ChatSerializer.a("{text:\" \",extra:[{text:\"§e[Yes]\",clickEvent:{action:run_command,value:\"/portal remove " + args[2] + "\",hoverEvent:{action:show_text,value:\"This is a test\"}}}, " +
|
IChatBaseComponent comp = ChatSerializer.a("{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]\",clickEvent:{action:run_command,value:\"/portal edit " + args[2] + "\",hoverEvent:{action:show_text,value:\"This is a test\"}}}]}");
|
"{text:\" \"},{text:\"§e[No]\",hoverEvent:{action:show_text,value:\"Cancel removing this portal\"},clickEvent:{action:run_command,value:\"/portal edit " + args[2] + "\"}}]}");
|
||||||
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
|
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
@ -350,6 +350,17 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
player.sendMessage("§a[§eAdvancedPortals§a] Help page: (insert bitly link)!");
|
player.sendMessage("§a[§eAdvancedPortals§a] Help page: (insert bitly link)!");
|
||||||
}
|
}
|
||||||
else if(args[0].toLowerCase().equals("show")){
|
else if(args[0].toLowerCase().equals("show")){
|
||||||
|
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
|
||||||
|
if(args.length > 1){
|
||||||
|
String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
|
||||||
|
if(posX != null){
|
||||||
|
Selection.Show(player, this.plugin, args[1]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
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())){
|
||||||
player.sendMessage("§a[§eAdvancedPortals§a] Your currently selected area has been shown, it will dissapear shortly!");
|
player.sendMessage("§a[§eAdvancedPortals§a] Your currently selected area has been shown, it will dissapear shortly!");
|
||||||
@ -363,6 +374,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
player.sendMessage("§c[§7AdvancedPortals§c] You need to have both points selected!");
|
player.sendMessage("§c[§7AdvancedPortals§c] You need to have both points selected!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(args[0].toLowerCase().equals("help")) {
|
else if(args[0].toLowerCase().equals("help")) {
|
||||||
player.sendMessage("§a[§eAdvancedPortals§a] Reloaded values!");
|
player.sendMessage("§a[§eAdvancedPortals§a] Reloaded values!");
|
||||||
Listeners.reloadValues(plugin);
|
Listeners.reloadValues(plugin);
|
||||||
@ -412,11 +424,12 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
else{
|
else{
|
||||||
sender.sendMessage(" §ctriggerBlock§e: null");
|
sender.sendMessage(" §ctriggerBlock§e: null");
|
||||||
}
|
}
|
||||||
sender.sendMessage(" ");
|
sender.sendMessage("");
|
||||||
|
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
|
|
||||||
IChatBaseComponent comp = ChatSerializer.a("{text:\"§aFunctions§e: \",extra:[{text:\"§eRemove\",clickEvent:{action:run_command,value:\"/portal gui remove " + portalName + "\",hoverEvent:{action:show_text,value:\"This is a test\"}}}]}");
|
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 + "\"}}]}");
|
||||||
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
|
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.sekwah.advancedportals.destinations.Destination;
|
import com.sekwah.advancedportals.destinations.Destination;
|
||||||
|
import com.sekwah.advancedportals.portalcontrolls.Portal;
|
||||||
|
|
||||||
public class DestinationCommand implements CommandExecutor, TabCompleter {
|
public class DestinationCommand implements CommandExecutor, TabCompleter {
|
||||||
|
|
||||||
@ -50,6 +51,22 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
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("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(args[0].toLowerCase().equals("remove")) {
|
||||||
|
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Destinations.yml");
|
||||||
|
if(args.length > 1){
|
||||||
|
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!");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sender.sendMessage("§c[§7AdvancedPortals§c] 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!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n"
|
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n"
|
||||||
|
@ -34,6 +34,85 @@ public class Selection {
|
|||||||
metadata = (byte) config.getConfig().getInt("ShowSelectionBlockData");
|
metadata = (byte) config.getConfig().getInt("ShowSelectionBlockData");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static void Show(final Player player, final AdvancedPortalsPlugin plugin, String portalName) {
|
||||||
|
|
||||||
|
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
|
||||||
|
|
||||||
|
int LowX = portalConfig.getConfig().getInt(portalName + ".pos2.X");
|
||||||
|
int LowY = portalConfig.getConfig().getInt(portalName + ".pos2.Y");
|
||||||
|
int LowZ = portalConfig.getConfig().getInt(portalName + ".pos2.Z");
|
||||||
|
|
||||||
|
int HighX = portalConfig.getConfig().getInt(portalName + ".pos1.X");
|
||||||
|
int HighY = portalConfig.getConfig().getInt(portalName + ".pos1.Y");
|
||||||
|
int HighZ = portalConfig.getConfig().getInt(portalName + ".pos1.Z");
|
||||||
|
|
||||||
|
final Location pos1 = new Location(player.getWorld(), LowX, LowY, LowZ);
|
||||||
|
final Location pos2 = new Location(player.getWorld(), HighX, HighY, HighZ);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There are alot of for loops at the moment, when i find an easier way to do these other that a load of if statements
|
||||||
|
* then i will change it, but for now its the best way i can think of for doing this.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for(int x = LowX; x <= HighX; x++){
|
||||||
|
Location loc = new Location(player.getWorld(), x, LowY, LowZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int x = LowX; x <= HighX; x++){
|
||||||
|
Location loc = new Location(player.getWorld(), x, LowY, HighZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int z = LowZ; z <= HighZ; z++){
|
||||||
|
Location loc = new Location(player.getWorld(), LowX, LowY, z);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int z = LowZ; z <= HighZ; z++){
|
||||||
|
Location loc = new Location(player.getWorld(), HighX, LowY, z);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int y = LowY; y <= HighY; y++){
|
||||||
|
Location loc = new Location(player.getWorld(), LowX, y, LowZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int y = LowY; y <= HighY; y++){
|
||||||
|
Location loc = new Location(player.getWorld(), LowX, y, HighZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int y = LowY; y <= HighY; y++){
|
||||||
|
Location loc = new Location(player.getWorld(), HighX, y, LowZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int y = LowY; y <= HighY; y++){
|
||||||
|
Location loc = new Location(player.getWorld(), HighX, y, HighZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int x = LowX; x <= HighX; x++){
|
||||||
|
Location loc = new Location(player.getWorld(), x, HighY, HighZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int x = LowX; x <= HighX; x++){
|
||||||
|
Location loc = new Location(player.getWorld(), x, HighY, LowZ);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int z = LowZ; z <= HighZ; z++){
|
||||||
|
Location loc = new Location(player.getWorld(), LowX, HighY, z);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
for(int z = LowZ; z <= HighZ; z++){
|
||||||
|
Location loc = new Location(player.getWorld(), HighX, HighY, z);
|
||||||
|
player.sendBlockChange(loc, blockType, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
|
public void run(){
|
||||||
|
Selection.Hide(player, plugin, pos1, pos2);
|
||||||
|
}
|
||||||
|
}, timeout * 20);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void Show(final Player player, final AdvancedPortalsPlugin plugin) {
|
public static void Show(final Player player, final AdvancedPortalsPlugin plugin) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user