mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 10:36:17 +01:00
Some bug fixes and minor changes
This commit is contained in:
parent
3e8305a85f
commit
06ced651a1
@ -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")){
|
||||||
|
@ -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
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user