diff --git a/Advanced Portals/src/Config.yml b/Advanced Portals/src/Config.yml index e5ed88f..861e4a5 100644 --- a/Advanced Portals/src/Config.yml +++ b/Advanced Portals/src/Config.yml @@ -13,4 +13,5 @@ ShowSelectionBlockData: 14 # This changes how long the show seletion lasts in seconds -ShowSelectionShowDuration: 3 + +ShowSelectionShowDuration: 10 \ No newline at end of file diff --git a/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java b/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java index ab877e5..8fd6af6 100644 --- a/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java +++ b/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java @@ -2,8 +2,6 @@ package com.sekwah.advancedportals; import java.util.Arrays; -import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -12,9 +10,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.metadata.FixedMetadataValue; - -import com.sekwah.advancedportals.portalcontrolls.CreatePortal; public class AdvancedPortalsCommand implements CommandExecutor { @@ -50,15 +45,27 @@ public class AdvancedPortalsCommand implements CommandExecutor { } } else if(args[0].toLowerCase().equals("create")) { - // CreatePortal.CreatePortal(pos1, pos2); need to get pos 1 and 2 + 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!"); + CreatePortal + } + else{ + player.sendMessage("§c[§7AdvancedPortals§c] 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!"); + } } else if(args[0].toLowerCase().equals("show")){ 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!"); Selection.Show(player, this.plugin); } else{ - player.sendMessage("§a[§eAdvancedPortals§a] Your currently selected area has been shown, it will dissapear shortly!"); + player.sendMessage("§c[§7AdvancedPortals§c] The points you have selected need to be in the same world!"); } } else{ diff --git a/Advanced Portals/src/com/sekwah/advancedportals/Selection.java b/Advanced Portals/src/com/sekwah/advancedportals/Selection.java index 310ac8d..b8a583c 100644 --- a/Advanced Portals/src/com/sekwah/advancedportals/Selection.java +++ b/Advanced Portals/src/com/sekwah/advancedportals/Selection.java @@ -7,30 +7,29 @@ import org.bukkit.entity.Player; public class Selection { - public static Material blockType; - public static int timeout; - public static byte metadata; + public static Material blockType = Material.WOOL; + public static int timeout = 10; + public static byte metadata = 14; public static void LoadData(AdvancedPortalsPlugin plugin) { ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml"); - Material blockType; - - timeout = config.getConfig().getInt("ShowSelectionBlockID"); + timeout = config.getConfig().getInt("ShowSelectionShowDuration"); String BlockID = config.getConfig().getString("ShowSelectionBlockID"); - try - { - blockType = Material.getMaterial(Integer.parseInt(BlockID)); - } - catch(Exception e) - { + try + { + blockType = Material.getMaterial(Integer.parseInt(BlockID)); + } + catch(Exception e) + { blockType = Material.getMaterial(BlockID); - } + } metadata = (byte) config.getConfig().getInt("ShowSelectionBlockData"); } + @SuppressWarnings("deprecation") public static void Show(final Player player, final AdvancedPortalsPlugin plugin) { int LowX = 0; @@ -69,9 +68,14 @@ public class Selection { 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); + 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); @@ -127,6 +131,7 @@ public class Selection { } + @SuppressWarnings("deprecation") protected static void Hide(Player player, AdvancedPortalsPlugin plugin, Location pos1, Location pos2) { int LowX = pos1.getBlockX(); diff --git a/Advanced Portals/src/com/sekwah/advancedportals/destinations/CreateDestination.java b/Advanced Portals/src/com/sekwah/advancedportals/destinations/CreateDestination.java deleted file mode 100644 index f7cd3c0..0000000 --- a/Advanced Portals/src/com/sekwah/advancedportals/destinations/CreateDestination.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.sekwah.advancedportals.destinations; - -public class CreateDestination { - -} diff --git a/Advanced Portals/src/com/sekwah/advancedportals/destinations/DestroyDestination.java b/Advanced Portals/src/com/sekwah/advancedportals/destinations/DestroyDestination.java deleted file mode 100644 index 1334e03..0000000 --- a/Advanced Portals/src/com/sekwah/advancedportals/destinations/DestroyDestination.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.sekwah.advancedportals.destinations; - -public class DestroyDestination { - -} diff --git a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/CreatePortal.java b/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/CreatePortal.java deleted file mode 100644 index 2899097..0000000 --- a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/CreatePortal.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sekwah.advancedportals.portalcontrolls; - -import org.bukkit.Location; -import org.bukkit.command.CommandSender; - -public class CreatePortal { - - public static void CreatePortal(Location pos1, Location pos2) { - if(pos1.getWorld() == pos2.getWorld()) { - // creation code - } - else{ - // code to say they have to be in the same world. - } - } - -} diff --git a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/DestroyPortal.java b/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/DestroyPortal.java deleted file mode 100644 index f416fdf..0000000 --- a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/DestroyPortal.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.sekwah.advancedportals.portalcontrolls; - -public class DestroyPortal { - -}