Fixed some bugs and merged some files
This commit is contained in:
parent
0eba0ccf41
commit
6f04300dd8
|
@ -13,4 +13,5 @@ ShowSelectionBlockData: 14
|
|||
|
||||
|
||||
# This changes how long the show seletion lasts in seconds
|
||||
ShowSelectionShowDuration: 3
|
||||
|
||||
ShowSelectionShowDuration: 10
|
|
@ -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{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package com.sekwah.advancedportals.destinations;
|
||||
|
||||
public class CreateDestination {
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package com.sekwah.advancedportals.destinations;
|
||||
|
||||
public class DestroyDestination {
|
||||
|
||||
}
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package com.sekwah.advancedportals.portalcontrolls;
|
||||
|
||||
public class DestroyPortal {
|
||||
|
||||
}
|
Loading…
Reference in New Issue