Commits

Mike Bayer committed e1828a1

support config, will put the URL here

Comments (0)

Files changed (3)

src/main/java/com/zzzcomputing/bukkit/atmcraft/AtmCraft.java

 public class AtmCraft extends JavaPlugin implements Listener{
 
 	
-    private FileConfiguration config;
+    protected FileConfiguration config;
 
 	@Override
     public void onEnable() {
 
         config = getConfig();
+        saveConfig();
         Bukkit.getPluginManager().registerEvents(this, this);        
         Logger.info("AtmCraft online hooray !");
     }
     		Block block = event.getClickedBlock();
     		if (isAtmBlock(block)) {
                 Util.sendPlayerMessage(event.getPlayer(), "seems like an ATM!");
-                AtmSession atmSession = new AtmSession(event.getPlayer());
+                AtmSession atmSession = new AtmSession(this, event.getPlayer());
                 atmSession.display();
     		}
     	}
     }
     
     private boolean isAtmBlock(Block block) {
-    	if (block != null) {
-        	Logger.info("blocktype is chest: " + (block.getType() == Material.CHEST));
-        	Logger.info("above block: " + getBlockTypeAbove(block, 1));
-        	Logger.info("below block: " + getBlockTypeAbove(block, -1));
-    	}
-    	
     	return (
     			block != null &&
     			block.getType() == Material.CHEST &&

src/main/java/com/zzzcomputing/bukkit/atmcraft/AtmSession.java

 public class AtmSession implements InventoryHolder {
 	private Inventory inventory;
 	private Player player;
+	private AtmCraft parent;
 
-	public AtmSession(Player player) {
+	public AtmSession(AtmCraft parent, Player player) {
 		this.player = player;
+		this.parent = parent;
 	}
 
+	public String getBankName() {
+		return this.parent.config.getString("bankname");
+	}
+	
 	@Override
 	public Inventory getInventory() {
 		if (inventory == null) {
-			inventory = Bukkit.createInventory(this, 18, "Welcome " + player.getDisplayName() + "!");
+			inventory = Bukkit.createInventory(this, 18, getBankName() + " - Welcome " + player.getDisplayName() + "!");
 		}
 		return inventory;
 	}

src/main/resources/config.yml

+bankname: My Bank
+
+
+serverurl: http://localhost:8000/
+