Added the start of the code to log portals in the portal.yml

This commit is contained in:
sekwah41 2013-11-20 21:36:01 +00:00
parent dbabcdb27d
commit bd42f930ac
2 changed files with 30 additions and 3 deletions

View File

@ -2,6 +2,8 @@ package com.sekwah.advancedportals;
import org.bukkit.plugin.java.JavaPlugin;
import com.sekwah.advancedportals.portalcontrolls.Portal;
public class AdvancedPortalsPlugin extends JavaPlugin {
public void onEnable() {
@ -17,6 +19,9 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
// Loads the current portal data
new Portals(this);
// Loads the portal and destination editors
new Portal(this);
// These register the commands
new AdvancedPortalsCommand(this);
new DestinationCommand(this);

View File

@ -1,19 +1,41 @@
package com.sekwah.advancedportals.portalcontrolls;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
public class Portal {
private static AdvancedPortalsPlugin plugin;
public Portal(AdvancedPortalsPlugin plugin) {
this.plugin = plugin;
}
public static void create(Player player, Material triggerBlockId, Location pos1, Location pos2 , String name) {
// TODO Auto-generated method stub
}
public static void create(Player player, Location pos1, Location pos2, String name) {
// TODO Auto-generated method stub
public static void create(Player player, Location pos1, Location pos2, String name) { // add stuff for destination names or coordinates
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
config.getConfig().set("portals." + name + ".world", pos1.getWorld().getName());
config.getConfig().set("portals." + name + ".hastriggerblock", false);
config.getConfig().set("portals." + name + ".pos1.X", pos1.getX());
config.getConfig().set("portals." + name + ".pos1.Y", pos1.getY());
config.getConfig().set("portals." + name + ".pos1.Z", pos1.getZ());
config.getConfig().set("portals." + name + ".pos2.X", pos2.getX());
config.getConfig().set("portals." + name + ".pos2.Y", pos2.getY());
config.getConfig().set("portals." + name + ".pos2.Z", pos2.getZ());
config.getConfig().set("portals." + name + ".creator", player.getName());
}
public static void redefine(Player player, Location pos1, Location pos2, String name){