1058 lines
43 KiB
Java
1058 lines
43 KiB
Java
package net.minecraft.server;
|
|
|
|
import java.io.File;
|
|
import java.net.SocketAddress;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Map.Entry;
|
|
|
|
// CraftBukkit start
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.TravelAgent;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
|
import org.bukkit.event.player.PlayerPortalEvent;
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
|
import org.bukkit.event.player.PlayerLoginEvent;
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
import org.bukkit.util.Vector;
|
|
// CraftBukkit end
|
|
|
|
public abstract class PlayerList {
|
|
|
|
private static final SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
|
private final MinecraftServer server;
|
|
public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
|
|
private final BanList banByName = new BanList(new File("banned-players.txt"));
|
|
private final BanList banByIP = new BanList(new File("banned-ips.txt"));
|
|
private Set operators = new HashSet();
|
|
private Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
|
|
public IPlayerFileData playerFileData; // CraftBukkit - private -> public
|
|
public boolean hasWhitelist; // CraftBukkit - private -> public
|
|
protected int maxPlayers;
|
|
protected int c;
|
|
private EnumGamemode l;
|
|
private boolean m;
|
|
private int n;
|
|
|
|
// CraftBukkit start
|
|
private CraftServer cserver;
|
|
|
|
public PlayerList(MinecraftServer minecraftserver) {
|
|
minecraftserver.server = new CraftServer(minecraftserver, this);
|
|
minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
|
|
this.cserver = minecraftserver.server;
|
|
// CraftBukkit end
|
|
|
|
this.server = minecraftserver;
|
|
this.banByName.setEnabled(false);
|
|
this.banByIP.setEnabled(false);
|
|
this.maxPlayers = 8;
|
|
}
|
|
|
|
public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) {
|
|
NBTTagCompound nbttagcompound = this.a(entityplayer);
|
|
|
|
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
|
|
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
|
|
String s = "local";
|
|
|
|
if (inetworkmanager.getSocketAddress() != null) {
|
|
s = inetworkmanager.getSocketAddress().toString();
|
|
}
|
|
|
|
// CraftBukkit - add world and location to 'logged in' message.
|
|
this.server.getLogger().info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
|
|
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
|
|
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
|
|
|
|
this.a(entityplayer, (EntityPlayer) null, worldserver);
|
|
PlayerConnection playerconnection = new PlayerConnection(this.server, inetworkmanager, entityplayer);
|
|
|
|
// CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly.
|
|
int maxPlayers = this.getMaxPlayers();
|
|
if (maxPlayers > 60) {
|
|
maxPlayers = 60;
|
|
}
|
|
playerconnection.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers));
|
|
entityplayer.getBukkitEntity().sendSupportedChannels();
|
|
// CraftBukkit end
|
|
|
|
playerconnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
|
|
playerconnection.sendPacket(new Packet202Abilities(entityplayer.abilities));
|
|
playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
|
|
this.a((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
|
|
this.b(entityplayer, worldserver);
|
|
// this.sendMessage(ChatMessage.b("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()}).a(EnumChatFormat.YELLOW)); // CraftBukkit - handled in event
|
|
this.c(entityplayer);
|
|
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
|
this.server.ag().a(playerconnection);
|
|
playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
|
|
if (this.server.getTexturePack().length() > 0) {
|
|
entityplayer.a(this.server.getTexturePack(), this.server.U());
|
|
}
|
|
|
|
Iterator iterator = entityplayer.getEffects().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
MobEffect mobeffect = (MobEffect) iterator.next();
|
|
|
|
playerconnection.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
|
|
}
|
|
|
|
entityplayer.syncInventory();
|
|
if (nbttagcompound != null && nbttagcompound.hasKey("Riding")) {
|
|
Entity entity = EntityTypes.a(nbttagcompound.getCompound("Riding"), worldserver);
|
|
|
|
if (entity != null) {
|
|
entity.p = true;
|
|
worldserver.addEntity(entity);
|
|
entityplayer.mount(entity);
|
|
entity.p = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void a(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { // CraftBukkit - protected -> public
|
|
HashSet hashset = new HashSet();
|
|
Iterator iterator = scoreboardserver.getTeams().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
|
|
|
|
entityplayer.playerConnection.sendPacket(new Packet209SetScoreboardTeam(scoreboardteam, 0));
|
|
}
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
ScoreboardObjective scoreboardobjective = scoreboardserver.getObjectiveForSlot(i);
|
|
|
|
if (scoreboardobjective != null && !hashset.contains(scoreboardobjective)) {
|
|
List list = scoreboardserver.getScoreboardScorePacketsForObjective(scoreboardobjective);
|
|
Iterator iterator1 = list.iterator();
|
|
|
|
while (iterator1.hasNext()) {
|
|
Packet packet = (Packet) iterator1.next();
|
|
|
|
entityplayer.playerConnection.sendPacket(packet);
|
|
}
|
|
|
|
hashset.add(scoreboardobjective);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setPlayerFileData(WorldServer[] aworldserver) {
|
|
if (this.playerFileData != null) return; // CraftBukkit
|
|
this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData();
|
|
}
|
|
|
|
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
|
|
WorldServer worldserver1 = entityplayer.p();
|
|
|
|
if (worldserver != null) {
|
|
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
|
|
}
|
|
|
|
worldserver1.getPlayerChunkMap().addPlayer(entityplayer);
|
|
worldserver1.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
|
}
|
|
|
|
public int a() {
|
|
return PlayerChunkMap.getFurthestViewableBlock(this.o());
|
|
}
|
|
|
|
public NBTTagCompound a(EntityPlayer entityplayer) {
|
|
NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit
|
|
NBTTagCompound nbttagcompound1;
|
|
|
|
if (entityplayer.getName().equals(this.server.J()) && nbttagcompound != null) {
|
|
entityplayer.f(nbttagcompound);
|
|
nbttagcompound1 = nbttagcompound;
|
|
System.out.println("loading single player");
|
|
} else {
|
|
nbttagcompound1 = this.playerFileData.load(entityplayer);
|
|
}
|
|
|
|
return nbttagcompound1;
|
|
}
|
|
|
|
protected void b(EntityPlayer entityplayer) {
|
|
this.playerFileData.save(entityplayer);
|
|
}
|
|
|
|
public void c(EntityPlayer entityplayer) {
|
|
cserver.detectListNameConflict(entityplayer); // CraftBukkit
|
|
// this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
|
|
this.players.add(entityplayer);
|
|
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
|
|
|
|
// CraftBukkit start
|
|
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
|
|
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
|
|
|
String joinMessage = playerJoinEvent.getJoinMessage();
|
|
|
|
if ((joinMessage != null) && (joinMessage.length() > 0)) {
|
|
this.server.getPlayerList().sendAll(new Packet3Chat(ChatMessage.d(joinMessage)));
|
|
}
|
|
this.cserver.onPlayerJoin(playerJoinEvent.getPlayer());
|
|
|
|
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount());
|
|
// CraftBukkit end
|
|
|
|
// CraftBukkit start - Only add if the player wasn't moved in the event
|
|
if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) {
|
|
worldserver.addEntity(entityplayer);
|
|
this.a(entityplayer, (WorldServer) null);
|
|
}
|
|
// CraftBukkit end
|
|
|
|
// CraftBukkit start - sendAll above replaced with this loop
|
|
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000);
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
|
|
|
if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
|
entityplayer1.playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
|
|
|
// CraftBukkit start - .name -> .listName
|
|
if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
|
|
entityplayer.playerConnection.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
}
|
|
|
|
public void d(EntityPlayer entityplayer) {
|
|
entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer);
|
|
}
|
|
|
|
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
|
|
if (entityplayer.playerConnection.disconnected) return null; // CraftBukkit - exploitsies fix
|
|
|
|
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer);
|
|
|
|
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
|
|
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
|
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
|
// CraftBukkit end
|
|
|
|
this.b(entityplayer);
|
|
WorldServer worldserver = entityplayer.p();
|
|
|
|
if (entityplayer.vehicle != null) {
|
|
worldserver.removeEntity(entityplayer.vehicle);
|
|
System.out.println("removing player mount");
|
|
}
|
|
|
|
worldserver.kill(entityplayer);
|
|
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
|
|
this.players.remove(entityplayer);
|
|
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit
|
|
|
|
// CraftBukkit start - .name -> .listName, replace sendAll with loop
|
|
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, false, 9999);
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
|
|
|
if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
|
entityplayer1.playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
// This removes the scoreboard (and player reference) for the specific player in the manager
|
|
this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
|
|
|
|
return playerQuitEvent.getQuitMessage();
|
|
// CraftBukkit end
|
|
}
|
|
|
|
// CraftBukkit start - Whole method and signature
|
|
public EntityPlayer attemptLogin(PendingConnection pendingconnection, String s, String hostname) {
|
|
// Instead of kicking then returning, we need to store the kick reason
|
|
// in the event, check with plugins to see if it's ok, and THEN kick
|
|
// depending on the outcome.
|
|
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.O() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0)));
|
|
Player player = entity.getBukkitEntity();
|
|
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress());
|
|
|
|
SocketAddress socketaddress = pendingconnection.networkManager.getSocketAddress();
|
|
|
|
if (this.banByName.isBanned(s)) {
|
|
BanEntry banentry = (BanEntry) this.banByName.getEntries().get(s);
|
|
String s1 = "You are banned from this server!\nReason: " + banentry.getReason();
|
|
|
|
if (banentry.getExpires() != null) {
|
|
s1 = s1 + "\nYour ban will be removed on " + d.format(banentry.getExpires());
|
|
}
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1);
|
|
} else if (!this.isWhitelisted(s)) {
|
|
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
|
|
} else {
|
|
String s2 = socketaddress.toString();
|
|
|
|
s2 = s2.substring(s2.indexOf("/") + 1);
|
|
s2 = s2.substring(0, s2.indexOf(":"));
|
|
if (this.banByIP.isBanned(s2)) {
|
|
BanEntry banentry1 = (BanEntry) this.banByIP.getEntries().get(s2);
|
|
String s3 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason();
|
|
|
|
if (banentry1.getExpires() != null) {
|
|
s3 = s3 + "\nYour ban will be removed on " + d.format(banentry1.getExpires());
|
|
}
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3);
|
|
} else if (this.players.size() >= this.maxPlayers) {
|
|
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
|
|
} else {
|
|
event.disallow(PlayerLoginEvent.Result.ALLOWED, s2);
|
|
}
|
|
}
|
|
|
|
this.cserver.getPluginManager().callEvent(event);
|
|
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
|
pendingconnection.disconnect(event.getKickMessage());
|
|
return null;
|
|
}
|
|
|
|
return entity;
|
|
// CraftBukkit end
|
|
}
|
|
|
|
public EntityPlayer processLogin(EntityPlayer player) { // CraftBukkit - String -> EntityPlayer
|
|
String s = player.name; // CraftBukkit
|
|
ArrayList arraylist = new ArrayList();
|
|
|
|
EntityPlayer entityplayer;
|
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
entityplayer = (EntityPlayer) this.players.get(i);
|
|
if (entityplayer.getName().equalsIgnoreCase(s)) {
|
|
arraylist.add(entityplayer);
|
|
}
|
|
}
|
|
|
|
Iterator iterator = arraylist.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
entityplayer = (EntityPlayer) iterator.next();
|
|
entityplayer.playerConnection.disconnect("You logged in from another location");
|
|
}
|
|
|
|
/* CraftBukkit start
|
|
Object object;
|
|
|
|
if (this.server.O()) {
|
|
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
|
|
} else {
|
|
object = new PlayerInteractManager(this.server.getWorldServer(0));
|
|
}
|
|
|
|
return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (PlayerInteractManager) object);
|
|
*/
|
|
return player;
|
|
// CraftBukkit end
|
|
}
|
|
|
|
// CraftBukkit start
|
|
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag) {
|
|
return this.moveToWorld(entityplayer, i, flag, null, true);
|
|
}
|
|
|
|
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
|
|
// CraftBukkit end
|
|
entityplayer.p().getTracker().untrackPlayer(entityplayer);
|
|
// entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit
|
|
entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer);
|
|
this.players.remove(entityplayer);
|
|
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
|
|
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
|
|
boolean flag1 = entityplayer.isRespawnForced();
|
|
|
|
// CraftBukkit start
|
|
EntityPlayer entityplayer1 = entityplayer;
|
|
org.bukkit.World fromWorld = entityplayer1.getBukkitEntity().getWorld();
|
|
entityplayer1.viewingCredits = false;
|
|
entityplayer1.copyTo(entityplayer, flag);
|
|
|
|
ChunkCoordinates chunkcoordinates1;
|
|
|
|
if (location == null) {
|
|
boolean isBedSpawn = false;
|
|
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
|
if (cworld != null && chunkcoordinates != null) {
|
|
chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates, flag1);
|
|
if (chunkcoordinates1 != null) {
|
|
isBedSpawn = true;
|
|
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
|
|
} else {
|
|
entityplayer1.setRespawnPosition(null, true);
|
|
entityplayer1.playerConnection.sendPacket(new Packet70Bed(0, 0));
|
|
}
|
|
}
|
|
|
|
if (location == null) {
|
|
cworld = (CraftWorld) this.server.server.getWorlds().get(0);
|
|
chunkcoordinates = cworld.getHandle().getSpawn();
|
|
location = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
|
|
}
|
|
|
|
Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
|
|
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
|
|
this.cserver.getPluginManager().callEvent(respawnEvent);
|
|
|
|
location = respawnEvent.getRespawnLocation();
|
|
entityplayer.reset();
|
|
} else {
|
|
location.setWorld(this.server.getWorldServer(i).getWorld());
|
|
}
|
|
WorldServer worldserver = ((CraftWorld) location.getWorld()).getHandle();
|
|
entityplayer1.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
|
// CraftBukkit end
|
|
|
|
worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
|
|
|
while (avoidSuffocation && !worldserver.getCubes(entityplayer1, entityplayer1.boundingBox).isEmpty()) { // CraftBukkit
|
|
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
|
}
|
|
|
|
// CraftBukkit start
|
|
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
|
|
// Force the client to refresh their chunk cache.
|
|
entityplayer1.playerConnection.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
|
|
entityplayer1.playerConnection.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
|
|
entityplayer1.spawnIn(worldserver);
|
|
entityplayer1.dead = false;
|
|
entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
|
|
entityplayer1.setSneaking(false);
|
|
chunkcoordinates1 = worldserver.getSpawn();
|
|
// CraftBukkit end
|
|
entityplayer1.playerConnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
|
|
entityplayer1.playerConnection.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
|
|
this.b(entityplayer1, worldserver);
|
|
worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
|
|
worldserver.addEntity(entityplayer1);
|
|
this.players.add(entityplayer1);
|
|
// CraftBukkit start - Added from changeDimension
|
|
this.updateClient(entityplayer1); // CraftBukkit
|
|
entityplayer1.updateAbilities();
|
|
Iterator iterator = entityplayer1.getEffects().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
MobEffect mobeffect = (MobEffect) iterator.next();
|
|
|
|
entityplayer1.playerConnection.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect));
|
|
}
|
|
// entityplayer1.syncInventory();
|
|
// CraftBukkit end
|
|
entityplayer1.setHealth(entityplayer1.getHealth());
|
|
|
|
// CraftBukkit start - Don't fire on respawn
|
|
if (fromWorld != location.getWorld()) {
|
|
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
|
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
}
|
|
// CraftBukkit end
|
|
|
|
return entityplayer1;
|
|
}
|
|
|
|
// CraftBukkit start - Replaced the standard handling of portals with a more customised method.
|
|
public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) {
|
|
WorldServer exitWorld = null;
|
|
if (entityplayer.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds
|
|
// only target existing worlds (compensate for allow-nether/allow-end as false)
|
|
for (WorldServer world : this.server.worlds) {
|
|
if (world.dimension == i) {
|
|
exitWorld = world;
|
|
}
|
|
}
|
|
}
|
|
|
|
Location enter = entityplayer.getBukkitEntity().getLocation();
|
|
Location exit = null;
|
|
boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
|
|
if (exitWorld != null) {
|
|
if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
|
|
// THE_END -> NORMAL; use bed if available, otherwise default spawn
|
|
exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
|
|
if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) {
|
|
exit = exitWorld.getWorld().getSpawnLocation();
|
|
}
|
|
} else {
|
|
// NORMAL <-> NETHER or NORMAL -> THE_END
|
|
exit = this.calculateTarget(enter, exitWorld);
|
|
useTravelAgent = true;
|
|
}
|
|
}
|
|
|
|
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
|
|
PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause);
|
|
event.useTravelAgent(useTravelAgent);
|
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
if (event.isCancelled() || event.getTo() == null) {
|
|
return;
|
|
}
|
|
|
|
exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
|
|
if (exit == null) {
|
|
return;
|
|
}
|
|
exitWorld = ((CraftWorld) exit.getWorld()).getHandle();
|
|
|
|
Vector velocity = entityplayer.getBukkitEntity().getVelocity();
|
|
boolean before = exitWorld.chunkProviderServer.forceChunkLoad;
|
|
exitWorld.chunkProviderServer.forceChunkLoad = true;
|
|
exitWorld.t().adjustExit(entityplayer, exit, velocity); // Should be getTravelAgent
|
|
exitWorld.chunkProviderServer.forceChunkLoad = before;
|
|
|
|
this.moveToWorld(entityplayer, exitWorld.dimension, true, exit, false); // Vanilla doesn't check for suffocation when handling portals, so neither should we
|
|
if (entityplayer.motX != velocity.getX() || entityplayer.motY != velocity.getY() || entityplayer.motZ != velocity.getZ()) {
|
|
entityplayer.getBukkitEntity().setVelocity(velocity);
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
|
|
public void a(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
|
|
// CraftBukkit start - Split into modular functions
|
|
Location exit = this.calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1);
|
|
this.repositionEntity(entity, exit, true);
|
|
}
|
|
|
|
// Copy of original a(Entity, int, WorldServer, WorldServer) method with only location calculation logic
|
|
public Location calculateTarget(Location enter, World target) {
|
|
WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle();
|
|
WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle();
|
|
int i = worldserver.dimension;
|
|
|
|
double y = enter.getY();
|
|
float yaw = enter.getYaw();
|
|
float pitch = enter.getPitch();
|
|
double d0 = enter.getX();
|
|
double d1 = enter.getZ();
|
|
double d2 = 8.0D;
|
|
/*
|
|
double d3 = entity.locX;
|
|
double d4 = entity.locY;
|
|
double d5 = entity.locZ;
|
|
float f = entity.yaw;
|
|
|
|
worldserver.methodProfiler.a("moving");
|
|
*/
|
|
if (worldserver1.dimension == -1) {
|
|
d0 /= d2;
|
|
d1 /= d2;
|
|
/*
|
|
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
*/
|
|
} else if (worldserver1.dimension == 0) {
|
|
d0 *= d2;
|
|
d1 *= d2;
|
|
/*
|
|
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
*/
|
|
} else {
|
|
ChunkCoordinates chunkcoordinates;
|
|
|
|
if (i == 1) {
|
|
// use default NORMAL world spawn instead of target
|
|
worldserver1 = this.server.worlds.get(0);
|
|
chunkcoordinates = worldserver1.getSpawn();
|
|
} else {
|
|
chunkcoordinates = worldserver1.getDimensionSpawn();
|
|
}
|
|
|
|
d0 = (double) chunkcoordinates.x;
|
|
y = (double) chunkcoordinates.y;
|
|
d1 = (double) chunkcoordinates.z;
|
|
yaw = 90.0F;
|
|
pitch = 0.0F;
|
|
/*
|
|
entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
*/
|
|
}
|
|
|
|
// worldserver.methodProfiler.b();
|
|
if (i != 1) {
|
|
// worldserver.methodProfiler.a("placing");
|
|
d0 = (double) MathHelper.a((int) d0, -29999872, 29999872);
|
|
d1 = (double) MathHelper.a((int) d1, -29999872, 29999872);
|
|
/*
|
|
if (entity.isAlive()) {
|
|
worldserver1.addEntity(entity);
|
|
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
|
|
worldserver1.entityJoinedWorld(entity, false);
|
|
worldserver1.t().a(entity, d3, d4, d5, f);
|
|
}
|
|
|
|
worldserver.methodProfiler.b();
|
|
*/
|
|
}
|
|
|
|
// entity.spawnIn(worldserver1);
|
|
return new Location(worldserver1.getWorld(), d0, y, d1, yaw, pitch);
|
|
}
|
|
|
|
// copy of original a(Entity, int, WorldServer, WorldServer) method with only entity repositioning logic
|
|
public void repositionEntity(Entity entity, Location exit, boolean portal) {
|
|
int i = entity.dimension;
|
|
WorldServer worldserver = (WorldServer) entity.world;
|
|
WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
|
|
/*
|
|
double d0 = entity.locX;
|
|
double d1 = entity.locZ;
|
|
double d2 = 8.0D;
|
|
double d3 = entity.locX;
|
|
double d4 = entity.locY;
|
|
double d5 = entity.locZ;
|
|
float f = entity.yaw;
|
|
*/
|
|
|
|
worldserver.methodProfiler.a("moving");
|
|
entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
/*
|
|
if (entity.dimension == -1) {
|
|
d0 /= d2;
|
|
d1 /= d2;
|
|
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
} else if (entity.dimension == 0) {
|
|
d0 *= d2;
|
|
d1 *= d2;
|
|
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
} else {
|
|
ChunkCoordinates chunkcoordinates;
|
|
|
|
if (i == 1) {
|
|
chunkcoordinates = worldserver1.getSpawn();
|
|
} else {
|
|
chunkcoordinates = worldserver1.getDimensionSpawn();
|
|
}
|
|
|
|
d0 = (double) chunkcoordinates.x;
|
|
entity.locY = (double) chunkcoordinates.y;
|
|
d1 = (double) chunkcoordinates.z;
|
|
entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F);
|
|
if (entity.isAlive()) {
|
|
worldserver.entityJoinedWorld(entity, false);
|
|
}
|
|
}
|
|
*/
|
|
|
|
worldserver.methodProfiler.b();
|
|
if (i != 1) {
|
|
worldserver.methodProfiler.a("placing");
|
|
/*
|
|
d0 = (double) MathHelper.a((int) d0, -29999872, 29999872);
|
|
d1 = (double) MathHelper.a((int) d1, -29999872, 29999872);
|
|
*/
|
|
if (entity.isAlive()) {
|
|
worldserver1.addEntity(entity);
|
|
// entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch)
|
|
worldserver1.entityJoinedWorld(entity, false);
|
|
// worldserver1.s().a(entity, d3, d4, d5, f);
|
|
if (portal) {
|
|
Vector velocity = entity.getBukkitEntity().getVelocity();
|
|
worldserver1.t().adjustExit(entity, exit, velocity); // Should be getTravelAgent
|
|
entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
|
|
if (entity.motX != velocity.getX() || entity.motY != velocity.getY() || entity.motZ != velocity.getZ()) {
|
|
entity.getBukkitEntity().setVelocity(velocity);
|
|
}
|
|
}
|
|
}
|
|
|
|
worldserver.methodProfiler.b();
|
|
}
|
|
|
|
entity.spawnIn(worldserver1);
|
|
// CraftBukkit end
|
|
}
|
|
|
|
public void tick() {
|
|
if (++this.n > 600) {
|
|
this.n = 0;
|
|
}
|
|
|
|
/* CraftBukkit start - Remove updating of lag to players -- it spams way to much on big servers.
|
|
if (this.n < this.players.size()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
|
|
|
|
this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, entityplayer.ping));
|
|
}
|
|
// CraftBukkit end */
|
|
}
|
|
|
|
public void sendAll(Packet packet) {
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
|
|
public void a(Packet packet, int i) {
|
|
for (int j = 0; j < this.players.size(); ++j) {
|
|
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
|
|
|
if (entityplayer.dimension == i) {
|
|
entityplayer.playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
}
|
|
|
|
public String c() {
|
|
String s = "";
|
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
if (i > 0) {
|
|
s = s + ", ";
|
|
}
|
|
|
|
s = s + ((EntityPlayer) this.players.get(i)).getName();
|
|
}
|
|
|
|
return s;
|
|
}
|
|
|
|
public String[] d() {
|
|
String[] astring = new String[this.players.size()];
|
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
astring[i] = ((EntityPlayer) this.players.get(i)).getName();
|
|
}
|
|
|
|
return astring;
|
|
}
|
|
|
|
public BanList getNameBans() {
|
|
return this.banByName;
|
|
}
|
|
|
|
public BanList getIPBans() {
|
|
return this.banByIP;
|
|
}
|
|
|
|
public void addOp(String s) {
|
|
this.operators.add(s.toLowerCase());
|
|
|
|
// CraftBukkit start
|
|
Player player = server.server.getPlayer(s);
|
|
if (player != null) {
|
|
player.recalculatePermissions();
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
|
|
public void removeOp(String s) {
|
|
this.operators.remove(s.toLowerCase());
|
|
|
|
// CraftBukkit start
|
|
Player player = server.server.getPlayer(s);
|
|
if (player != null) {
|
|
player.recalculatePermissions();
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
|
|
public boolean isWhitelisted(String s) {
|
|
s = s.trim().toLowerCase();
|
|
return !this.hasWhitelist || this.operators.contains(s) || this.whitelist.contains(s);
|
|
}
|
|
|
|
public boolean isOp(String s) {
|
|
// CraftBukkit
|
|
return this.operators.contains(s.trim().toLowerCase()) || this.server.K() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.J().equalsIgnoreCase(s) || this.m;
|
|
}
|
|
|
|
public EntityPlayer getPlayer(String s) {
|
|
Iterator iterator = this.players.iterator();
|
|
|
|
EntityPlayer entityplayer;
|
|
|
|
do {
|
|
if (!iterator.hasNext()) {
|
|
return null;
|
|
}
|
|
|
|
entityplayer = (EntityPlayer) iterator.next();
|
|
} while (!entityplayer.getName().equalsIgnoreCase(s));
|
|
|
|
return entityplayer;
|
|
}
|
|
|
|
public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1, Map map, String s, String s1, World world) {
|
|
if (this.players.isEmpty()) {
|
|
return null;
|
|
} else {
|
|
Object object = new ArrayList();
|
|
boolean flag = k < 0;
|
|
boolean flag1 = s != null && s.startsWith("!");
|
|
boolean flag2 = s1 != null && s1.startsWith("!");
|
|
int k1 = i * i;
|
|
int l1 = j * j;
|
|
|
|
k = MathHelper.a(k);
|
|
if (flag1) {
|
|
s = s.substring(1);
|
|
}
|
|
|
|
if (flag2) {
|
|
s1 = s1.substring(1);
|
|
}
|
|
|
|
for (int i2 = 0; i2 < this.players.size(); ++i2) {
|
|
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i2);
|
|
|
|
if ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getLocalizedName()))) {
|
|
if (s1 != null) {
|
|
ScoreboardTeam scoreboardteam = entityplayer.getScoreboardTeam();
|
|
String s2 = scoreboardteam == null ? "" : scoreboardteam.getName();
|
|
|
|
if (flag2 == s1.equalsIgnoreCase(s2)) {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
if (chunkcoordinates != null && (i > 0 || j > 0)) {
|
|
float f = chunkcoordinates.e(entityplayer.b());
|
|
|
|
if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
if (this.a((EntityHuman) entityplayer, map) && (l == EnumGamemode.NONE.a() || l == entityplayer.playerInteractManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) {
|
|
((List) object).add(entityplayer);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (chunkcoordinates != null) {
|
|
Collections.sort((List) object, new PlayerDistanceComparator(chunkcoordinates));
|
|
}
|
|
|
|
if (flag) {
|
|
Collections.reverse((List) object);
|
|
}
|
|
|
|
if (k > 0) {
|
|
object = ((List) object).subList(0, Math.min(k, ((List) object).size()));
|
|
}
|
|
|
|
return (List) object;
|
|
}
|
|
}
|
|
|
|
private boolean a(EntityHuman entityhuman, Map map) {
|
|
if (map != null && map.size() != 0) {
|
|
Iterator iterator = map.entrySet().iterator();
|
|
|
|
Entry entry;
|
|
boolean flag;
|
|
int i;
|
|
|
|
do {
|
|
if (!iterator.hasNext()) {
|
|
return true;
|
|
}
|
|
|
|
entry = (Entry) iterator.next();
|
|
String s = (String) entry.getKey();
|
|
|
|
flag = false;
|
|
if (s.endsWith("_min") && s.length() > 4) {
|
|
flag = true;
|
|
s = s.substring(0, s.length() - 4);
|
|
}
|
|
|
|
Scoreboard scoreboard = entityhuman.getScoreboard();
|
|
ScoreboardObjective scoreboardobjective = scoreboard.getObjective(s);
|
|
|
|
if (scoreboardobjective == null) {
|
|
return false;
|
|
}
|
|
|
|
ScoreboardScore scoreboardscore = entityhuman.getScoreboard().getPlayerScoreForObjective(entityhuman.getLocalizedName(), scoreboardobjective);
|
|
|
|
i = scoreboardscore.getScore();
|
|
if (i < ((Integer) entry.getValue()).intValue() && flag) {
|
|
return false;
|
|
}
|
|
} while (i <= ((Integer) entry.getValue()).intValue() || flag);
|
|
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) {
|
|
this.sendPacketNearby((EntityHuman) null, d0, d1, d2, d3, i, packet);
|
|
}
|
|
|
|
public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) {
|
|
for (int j = 0; j < this.players.size(); ++j) {
|
|
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
|
|
|
// CraftBukkit start - Test if player receiving packet can see the source of the packet
|
|
if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
|
|
continue;
|
|
}
|
|
// CraftBukkit end
|
|
if (entityplayer != entityhuman && entityplayer.dimension == i) {
|
|
double d4 = d0 - entityplayer.locX;
|
|
double d5 = d1 - entityplayer.locY;
|
|
double d6 = d2 - entityplayer.locZ;
|
|
|
|
if (d4 * d4 + d5 * d5 + d6 * d6 < d3 * d3) {
|
|
entityplayer.playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void savePlayers() {
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
this.b((EntityPlayer) this.players.get(i));
|
|
}
|
|
}
|
|
|
|
public void addWhitelist(String s) {
|
|
this.whitelist.add(s);
|
|
}
|
|
|
|
public void removeWhitelist(String s) {
|
|
this.whitelist.remove(s);
|
|
}
|
|
|
|
public Set getWhitelisted() {
|
|
return this.whitelist;
|
|
}
|
|
|
|
public Set getOPs() {
|
|
return this.operators;
|
|
}
|
|
|
|
public void reloadWhitelist() {}
|
|
|
|
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
|
|
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
|
|
if (worldserver.Q()) {
|
|
entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather
|
|
}
|
|
}
|
|
|
|
public void updateClient(EntityPlayer entityplayer) {
|
|
entityplayer.updateInventory(entityplayer.defaultContainer);
|
|
entityplayer.triggerHealthUpdate();
|
|
entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
|
|
}
|
|
|
|
public int getPlayerCount() {
|
|
return this.players.size();
|
|
}
|
|
|
|
public int getMaxPlayers() {
|
|
return this.maxPlayers;
|
|
}
|
|
|
|
public String[] getSeenPlayers() {
|
|
return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit
|
|
}
|
|
|
|
public boolean getHasWhitelist() {
|
|
return this.hasWhitelist;
|
|
}
|
|
|
|
public void setHasWhitelist(boolean flag) {
|
|
this.hasWhitelist = flag;
|
|
}
|
|
|
|
public List i(String s) {
|
|
ArrayList arraylist = new ArrayList();
|
|
Iterator iterator = this.players.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
|
|
if (entityplayer.q().equals(s)) {
|
|
arraylist.add(entityplayer);
|
|
}
|
|
}
|
|
|
|
return arraylist;
|
|
}
|
|
|
|
public int o() {
|
|
return this.c;
|
|
}
|
|
|
|
public MinecraftServer getServer() {
|
|
return this.server;
|
|
}
|
|
|
|
public NBTTagCompound q() {
|
|
return null;
|
|
}
|
|
|
|
private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) {
|
|
if (entityplayer1 != null) {
|
|
entityplayer.playerInteractManager.setGameMode(entityplayer1.playerInteractManager.getGameMode());
|
|
} else if (this.l != null) {
|
|
entityplayer.playerInteractManager.setGameMode(this.l);
|
|
}
|
|
|
|
entityplayer.playerInteractManager.b(world.getWorldData().getGameType());
|
|
}
|
|
|
|
public void r() {
|
|
while (!this.players.isEmpty()) {
|
|
((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
|
}
|
|
}
|
|
|
|
public void sendMessage(ChatMessage chatmessage, boolean flag) {
|
|
this.server.sendMessage(chatmessage);
|
|
this.sendAll(new Packet3Chat(chatmessage, flag));
|
|
}
|
|
|
|
public void sendMessage(ChatMessage chatmessage) {
|
|
this.sendMessage(chatmessage, true);
|
|
}
|
|
}
|