Ejemplo n.º 1
0
  public void ban(Long time, Text.Literal reason, CommandSource source) {
    JsonConfig conf = getPlayerConfig();
    if (time == null || time == 0L) {
      time = -1L;
    }
    if (reason == null) {
      reason = r.mes("banDefaultReason");
    }
    if (time >= 1) {
      time = time + System.currentTimeMillis();
    }
    conf.set("banned", true);
    conf.set("bantime", time);
    conf.set("banreason", reason);
    conf.save();
    BanData d = getPlayer().getBanData();

    if (time != -1L) {
      d.bans()
          .get()
          .add(
              (Ban.User)
                  Bans.builder()
                      .user(getPlayer())
                      .expirationDate(new Date(time))
                      .reason(reason)
                      .source(source)
                      .build());
    } else {
      d.bans()
          .get()
          .add((Ban.User) Bans.builder().user(getPlayer()).reason(reason).source(source).build());
    }
    save();
  }
Ejemplo n.º 2
0
 public void setTeleportEnabled(Boolean tpe) {
   teleportEnabled = tpe;
   JsonConfig conf = getPlayerConfig();
   conf.set("teleportenabled", tpe);
   conf.save();
   save();
 }
Ejemplo n.º 3
0
 public void setLastLocation(RLocation loc) {
   lastLocation = loc;
   JsonConfig conf = getPlayerConfig();
   conf.set("lastLocation", loc == null ? null : LocationUtil.convertLocationToString(loc));
   conf.save();
   save();
 }
Ejemplo n.º 4
0
 public void setReply(Player pl) {
   reply = pl.getUniqueId();
   JsonConfig conf = getPlayerConfig();
   conf.set("reply", pl.getUniqueId().toString());
   conf.save();
   save();
 }
Ejemplo n.º 5
0
 public void setLastIp(String ip) {
   lastip = ip;
   final JsonConfig conf = getPlayerConfig();
   conf.set("ip", ip);
   conf.save();
   save();
 }
Ejemplo n.º 6
0
 public void setLastHostname(String ip) {
   lasthostname = ip;
   final JsonConfig conf = getPlayerConfig();
   conf.set("hostname", ip);
   conf.save();
   save();
 }
Ejemplo n.º 7
0
 public void updateLastConnectMillis(Long millis) {
   lastconnect = millis;
   final JsonConfig conf = getPlayerConfig();
   conf.set("lastconnect", millis);
   conf.save();
   save();
 }
Ejemplo n.º 8
0
 public void updateLastConnectMillis() {
   lastconnect = System.currentTimeMillis();
   final JsonConfig conf = getPlayerConfig();
   conf.set("lastconnect", System.currentTimeMillis());
   conf.save();
   save();
 }
Ejemplo n.º 9
0
 public void setSpy(Boolean sp) {
   spy = sp;
   JsonConfig conf = getPlayerConfig();
   conf.set("spy", sp);
   conf.save();
   save();
 }
Ejemplo n.º 10
0
 public void unjail() {
   jailed = false;
   jail = null;
   jailtime = null;
   JsonConfig conf = getPlayerConfig();
   conf.set("jailed", false);
   conf.set("jail", null);
   conf.set("jailtime", null);
   conf.save();
   save();
   if (tpspawn && getOnlinePlayer() != null) {
     if (bammerbom.ultimatecore.spongeapi.api.UC.getPlayer(getPlayer()).getSpawn(false) == null) {
       LocationUtil.teleport(
           getOnlinePlayer(),
           getOnlinePlayer().getWorld().getSpawnLocation(),
           Cause.of("unjail"),
           false,
           false);
     } else {
       LocationUtil.teleport(
           getOnlinePlayer(),
           bammerbom.ultimatecore.spongeapi.api.UC.getPlayer(getPlayer()).getSpawn(false),
           Cause.of("unjail"),
           false,
           false);
     }
   }
 }
Ejemplo n.º 11
0
 public void setHomes(HashMap<String, RLocation> nh) {
   homes = nh;
   save();
   JsonConfig conf = getPlayerConfig();
   conf.set("homes", null);
   for (String s : nh.keySet()) {
     conf.set("homes." + s.toLowerCase(), LocationUtil.convertLocationToString(nh.get(s)));
   }
   conf.save();
 }
Ejemplo n.º 12
0
 public void unban() {
   save();
   JsonConfig conf = getPlayerConfig();
   conf.set("banned", false);
   conf.set("bantime", null);
   conf.set("banreason", null);
   conf.save();
   BanData d = getPlayer().getBanData();
   while (!d.bans().get().isEmpty()) {
     d.bans().get().remove(0);
   }
   getPlayer().offer(d);
 }
Ejemplo n.º 13
0
 public void jail(String n, Long l) {
   jailed = true;
   jail = n;
   if (l >= 1) {
     l = l + System.currentTimeMillis();
   }
   jailtime = l;
   JsonConfig conf = getPlayerConfig();
   conf.set("jailed", true);
   conf.set("jail", n);
   conf.set("jailtime", l == null ? 0L : l);
   conf.save();
   save();
 }
Ejemplo n.º 14
0
 public void setDeaf(Boolean dea, Long time) {
   JsonConfig conf = getPlayerConfig();
   if (deaftime == null || deaftime == 0L) {
     deaftime = -1L;
   }
   if (time >= 1) {
     time = time + System.currentTimeMillis();
   }
   conf.set("deaf", dea);
   conf.set("deaftime", time);
   conf.save();
   deaf = dea;
   deaftime = deaf ? time : 0L;
   save();
 }
Ejemplo n.º 15
0
 public void setFrozen(Boolean fr, Long time) {
   JsonConfig conf = getPlayerConfig();
   if (freezetime == null || freezetime == 0L) {
     freezetime = -1L;
   }
   if (time >= 1) {
     time = time + System.currentTimeMillis();
   }
   conf.set("freeze", fr);
   conf.set("freezetime", time);
   conf.save();
   freeze = fr;
   freezetime = fr ? time : 0L;
   save();
 }
Ejemplo n.º 16
0
 public void setMuted(Boolean fr, Long time) {
   JsonConfig conf = getPlayerConfig();
   if (mutetime == null || mutetime == 0L) {
     mutetime = -1L;
   }
   if (time >= 1) {
     time = time + System.currentTimeMillis();
   }
   conf.set("mute", fr);
   conf.set("mutetime", time);
   conf.save();
   mute = fr;
   mutetime = fr ? time : -1L;
   save();
 }
Ejemplo n.º 17
0
 public void setGod(Boolean fr, Long time) {
   JsonConfig conf = getPlayerConfig();
   if (godtime == null || godtime == 0L) {
     godtime = -1L;
   }
   if (time >= 1) {
     time = time + System.currentTimeMillis();
   }
   conf.set("god", fr);
   conf.set("godtime", time);
   conf.save();
   god = fr;
   godtime = fr ? time : 0L;
   save();
 }
Ejemplo n.º 18
0
 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();
 }
Ejemplo n.º 19
0
 public void setVanish(Boolean fr, Long time) {
   JsonConfig conf = getPlayerConfig();
   if (vanishtime == null || vanishtime == 0L) {
     vanishtime = -1L;
   }
   if (time >= 1) {
     time = time + System.currentTimeMillis();
   }
   conf.set("vanish", fr);
   conf.set("vanishtime", time);
   conf.save();
   vanish = fr;
   vanishtime = fr ? time : 0L;
   if (getOnlinePlayer() != null) {
     getOnlinePlayer().offer(Keys.INVISIBLE, true);
   }
   save();
 }
Ejemplo n.º 20
0
 public void setNick(Text.Literal str) {
   nickname = str == null ? null : str + TextColors.RESET;
   save();
   if (str != null) {
     if (getPlayer().isOnline()) {
       getOnlinePlayer()
           .offer(
               getOnlinePlayer().getDisplayNameData().setDisplayName(nickname.replace("&y", "")));
     }
   } else {
     if (getPlayer().isOnline()) {
       getPlayer().getPlayer().setDisplayName(getPlayer().getPlayer().getName());
     }
   }
   JsonConfig data = getPlayerConfig();
   data.set("nick", str);
   data.save(UltimateFileLoader.getPlayerFile(getPlayer()));
 }
Ejemplo n.º 21
0
 public void updateLastInventory() {
   JsonConfig conf = getPlayerConfig();
   conf.set(
       "lastinventory", InventoryUtil.convertInventoryToString(getOnlinePlayer().getInventory()));
   conf.save();
 }