コード例 #1
0
 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);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 public Inventory getLastInventory() {
   JsonConfig conf = getPlayerConfig();
   if (!conf.contains("lastinventory")) {
     return null;
   }
   return InventoryUtil.convertStringToInventory(
       conf.getString("lastinventory"), r.mes("inventoryOfflineTitle", "%Name", name));
 }
コード例 #4
0
 public String getLastHostname() {
   if (lasthostname != null) {
     return lasthostname;
   }
   final JsonConfig conf = getPlayerConfig();
   if (conf.get("hostname") != null) {
     lastip = conf.getString("hostname");
     save();
     return lastip;
   } else {
     if (getPlayer().isOnline()) {
       setLastHostname(getOnlinePlayer().getConnection().getAddress().getHostName());
       return lastip;
     }
     return null;
   }
 }
コード例 #5
0
 public String getLastIp() {
   if (lastip != null) {
     return lastip;
   }
   final JsonConfig conf = getPlayerConfig();
   if (conf.get("ip") != null) {
     lastip = conf.getString("ip");
     save();
     return lastip;
   } else {
     if (getPlayer().isOnline()) {
       setLastIp(
           getOnlinePlayer().getConnection().getAddress().toString().split("/")[1].split(":")[0]);
       return lastip;
     }
     return null;
   }
 }
コード例 #6
0
 public Text.Literal getNick() {
   if (nickname != null) {
     return nickname;
   }
   JsonConfig data = getPlayerConfig();
   if (data.get("nick") == null) {
     return null;
   }
   String nick = r.translateAlternateColorCodes('&', data.getString("nick"));
   if (getPlayer().isOnline()) {
     getOnlinePlayer()
         .offer(getOnlinePlayer().getDisplayNameData().setDisplayName(nick.replace("&y", "")));
   }
   if (getPlayer().isOnline()
       && r.perm((CommandSource) getPlayer(), "uc.chat.rainbow", false, false)) {
     nick = nick.replaceAll("&y", r.getRandomTextColors() + "");
   }
   nickname = nick + TextColors.RESET;
   save();
   return nick + TextColors.RESET;
 }