コード例 #1
0
 @Override
 public void setOnline(boolean b) {
   if (showMessages) {
     Util.sendMessage(this, getName() + " is " + (b ? "connecting" : "disconnecting"));
   }
   online = b;
 }
コード例 #2
0
 @Override
 public void sendMessage(String s) {
   if (showMessages) {
     Util.sendMessage(
         this, (!isOnline() ? "&4(Offline)&b" : "") + getName() + " gettingMessage= " + s);
   }
 }
コード例 #3
0
 @Override
 public boolean teleport(Location l, boolean respawn) {
   if (isDead()) {
     return false;
   }
   try {
     boolean changedWorlds = !this.loc.getWorld().getName().equals(l.getWorld().getName());
     final String teleporting = respawn ? "respawning" : "teleporting";
     if (showTeleports && showMessages) {
       String fromWorld = "";
       String toWorld = "";
       if (changedWorlds) {
         fromWorld = "&5" + loc.getWorld().getName() + "&4,";
         toWorld = "&5" + l.getWorld().getName() + "&4,";
       }
       Util.sendMessage(
           this,
           getName()
               + "&e "
               + teleporting
               + " from &4"
               + fromWorld
               + Util.getLocString(loc)
               + " &e-> &4"
               + toWorld
               + Util.getLocString(l));
     }
     this.loc = l.clone();
     if (changedWorlds) {
       PlayerChangedWorldEvent pcwe = new PlayerChangedWorldEvent(this, l.getWorld());
       CraftServer cserver = (CraftServer) Bukkit.getServer();
       cserver.getPluginManager().callEvent(pcwe);
       /// For some reason, world doesnt get changed, so lets explicitly set it
       this.entity.world = ((CraftWorld) loc.getWorld()).getHandle();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return true;
 }
コード例 #4
0
 @Override
 public String toString() {
   String world = "&5" + this.loc.getWorld().getName() + ",";
   return getName()
       + "&e h=&2"
       + getHealth()
       + "&e o=&5"
       + isOnline()
       + "&e d=&7"
       + isDead()
       + "&e loc=&4"
       + world
       + "&4"
       + Util.getLocString(loc)
       + "&e gm=&8"
       + getGameMode();
 }