Some bug fixes and minor changes

This commit is contained in:
sekwah41 2013-12-08 20:29:04 +00:00
parent 3e8305a85f
commit 06ced651a1
4 changed files with 36 additions and 3 deletions

View File

@ -92,6 +92,11 @@ public class AdvancedPortalsCommand implements CommandExecutor {
} }
else if(args[0].toLowerCase().equals("select")) { else if(args[0].toLowerCase().equals("select")) {
}
else if(args[0].toLowerCase().equals("reload")) {
player.sendMessage("§a[§eAdvancedPortals§a] Reloaded values!");
Listeners.reloadValues(plugin);
Portal.loadPortals();
} }
else if(args[0].toLowerCase().equals("show")){ else if(args[0].toLowerCase().equals("show")){
if(player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")){ if(player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")){

View File

@ -15,6 +15,9 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
// only copy the file if it doesnt exist! // only copy the file if it doesnt exist!
ConfigAccessor config = new ConfigAccessor(this, "Config.yml"); ConfigAccessor config = new ConfigAccessor(this, "Config.yml");
config.saveDefaultConfig(); config.saveDefaultConfig();
ConfigAccessor portalconfig = new ConfigAccessor(this, "Portals.yml");
portalconfig.saveDefaultConfig();
// Loads the portal and destination editors // Loads the portal and destination editors

View File

@ -18,9 +18,9 @@ public class Listeners implements Listener {
// The needed config values will be stored so they are easier to access later // 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... // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
private boolean UseOnlyServerAxe = false; private static boolean UseOnlyServerAxe = false;
private Material WandMaterial; private static Material WandMaterial;
public Listeners(AdvancedPortalsPlugin plugin) { public Listeners(AdvancedPortalsPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
@ -41,13 +41,30 @@ public class Listeners implements Listener {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
} }
public static void reloadValues(AdvancedPortalsPlugin plugin) {
ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
String ItemID = config.getConfig().getString("AxeItemId");
try
{
WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
}
catch(Exception e)
{
WandMaterial = Material.getMaterial(ItemID);
}
}
@EventHandler @EventHandler
public void onMoveEvent(PlayerMoveEvent event) { public void onMoveEvent(PlayerMoveEvent event) {
// will check if the player is in the portal or not. // will check if the player is in the portal or not.
Object[] portals = Portal.Portals; Object[] portals = Portal.Portals;
for(Object portal : portals){ for(Object portal : portals){
System.out.println(portal.toString()); System.out.println("Checking " + portal.toString());
} }
} }

View File

@ -57,6 +57,8 @@ public class Portal {
config.getConfig().set(name + ".creator", player.getName()); config.getConfig().set(name + ".creator", player.getName());
config.saveConfig(); config.saveConfig();
loadPortals();
} }
public static void create(Player player, Location pos1, Location pos2, String name) { // add stuff for destination names or coordinates public static void create(Player player, Location pos1, Location pos2, String name) { // add stuff for destination names or coordinates
@ -74,6 +76,8 @@ public class Portal {
config.getConfig().set(name + ".pos2.Z", pos2.getZ()); config.getConfig().set(name + ".pos2.Z", pos2.getZ());
config.getConfig().set(name + ".creator", player.getName()); config.getConfig().set(name + ".creator", player.getName());
loadPortals();
} }
public static void redefine(Player player, Location pos1, Location pos2, String name){ public static void redefine(Player player, Location pos1, Location pos2, String name){
@ -90,6 +94,8 @@ public class Portal {
config.saveConfig(); config.saveConfig();
loadPortals();
} }
public static void remove(Player player, String name){ public static void remove(Player player, String name){
@ -109,6 +115,8 @@ public class Portal {
config.getConfig().set(name + ".creator", null); config.getConfig().set(name + ".creator", null);
config.saveConfig(); config.saveConfig();
loadPortals();
} }