コード例 #1
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);
     }
   }
 }
コード例 #2
0
 @Override
 public void run(final CommandSender cs, String label, String[] args) {
   if (!r.perm(cs, "uc.teleporttoggle", true, true)) {
     return;
   }
   if (!r.checkArgs(args, 0)) {
     Player p = (Player) cs;
     UC.getPlayer(p).setTeleportEnabled(!UC.getPlayer(p).hasTeleportEnabled());
     r.sendMes(
         cs,
         "teleporttoggleMessage",
         "%Enabled",
         UC.getPlayer(p).hasTeleportEnabled() ? r.mes("on") : r.mes("off"));
   } else {
     Player t = r.searchPlayer(args[0]);
     if (t == null) {
       r.sendMes(cs, "playerNotFound", "%Player", args[0]);
       return;
     }
     UC.getPlayer(t).setTeleportEnabled(!UC.getPlayer(t).hasTeleportEnabled());
     r.sendMes(
         cs,
         "teleporttoggleOthersSelf",
         "%Player",
         t.getName(),
         "%Enabled",
         UC.getPlayer(t).hasTeleportEnabled() ? r.mes("enabled") : r.mes("disabled"));
     r.sendMes(
         t,
         "teleporttoggleOthersOthers",
         "%Player",
         r.getDisplayName(cs),
         "%Enabled",
         UC.getPlayer(t).hasTeleportEnabled() ? r.mes("enabled") : r.mes("disabled"));
   }
 }