public RLocation getSpawn(Boolean firstjoin) { JsonConfig conf = new JsonConfig(UltimateFileLoader.Dspawns); String loc; Player p = r.searchPlayer(uuid); Boolean world = conf.contains("worlds.world." + p.getWorld().getName() + ".global"); String world_ = world ? conf.getString("worlds.world." + p.getWorld().getName() + ".global") : null; Boolean group = r.getVault() != null && r.getVault().getPermission() != null && r.getVault().getPermission().getPrimaryGroup(p) != null && conf.contains("global.group." + r.getVault().getPermission().getPrimaryGroup(p)); String group_ = r.getVault() != null && r.getVault().getPermission() != null && r.getVault().getPermission().getPrimaryGroup(p) != null ? (group ? conf.getString("global.group." + r.getVault().getPermission().getPrimaryGroup(p)) : null) : null; Boolean gw = r.getVault() != null && r.getVault().getPermission() != null && r.getVault().getPermission().getPrimaryGroup(p) != null && conf.contains( "worlds.world." + p.getWorld().getName() + ".group." + r.getVault().getPermission().getPrimaryGroup(p)); String gw_ = r.getVault() != null && r.getVault().getPermission() != null && r.getVault().getPermission().getPrimaryGroup(p) != null ? conf.getString( "worlds.world." + p.getWorld().getName() + ".group." + r.getVault().getPermission().getPrimaryGroup(p)) : null; if (firstjoin && conf.contains("global.firstjoin")) { loc = conf.getString("global.firstjoin"); } else if (gw) { loc = gw_; } else if (world && group) { if (r.getCnfg().getBoolean("Command.Spawn.WorldOrGroup")) { loc = world_; } else { loc = group_; } } else if (world) { loc = world_; } else if (group) { loc = group_; } else if (conf.contains("global")) { loc = conf.getString("global"); } else { return null; } return LocationUtil.convertStringToLocation(loc); }
public HashMap<String, RLocation> getHomes() { if (homes != null) { return homes; } homes = new HashMap<>(); JsonConfig conf = getPlayerConfig(); if (!conf.contains("homes")) { return homes; } for (String hname : conf.listKeys("homes", false)) { try { homes.put(hname, LocationUtil.convertStringToLocation(conf.getString("homes." + hname))); } catch (Exception ex) { r.log( r.negative + "Home " + getPlayer().getName() + ":" + hname + " has been removed. (Invalid location)"); } } save(); return homes; }
public Inventory getLastInventory() { JsonConfig conf = getPlayerConfig(); if (!conf.contains("lastinventory")) { return null; } return InventoryUtil.convertStringToInventory( conf.getString("lastinventory"), r.mes("inventoryOfflineTitle", "%Name", name)); }
public boolean hasPowertool(ItemType mat) { if (pts == null) { JsonConfig data = getPlayerConfig(); pts = new HashMap<>(); if (data.contains("powertool")) { for (String s : data.listKeys("powertool", false)) { ArrayList<String> l = (ArrayList<String>) data.getStringList("powertool." + s); pts.put(ItemDatabase.getItem(s).getItem(), l); } } save(); } return pts.containsKey(mat); }
public void setPowertool(ItemType mat, List<String> cmds) { JsonConfig data = getPlayerConfig(); if (pts == null) { pts = new HashMap<>(); if (data.contains("powertool")) { for (String s : data.listKeys("powertool", false)) { ArrayList<String> l = (ArrayList<String>) data.getStringList("powertool." + s); pts.put(ItemDatabase.getItem(s).getItem(), l); } } } pts.put(mat, cmds); data.set("powertool." + mat.toString(), cmds); data.save(); save(); }