1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
|
package net.minecraft.server;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.Bukkit;
// CraftBukkit end
public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft");
public List players = new ArrayList();
public MinecraftServer server; // CraftBukkit - private -> public
// private PlayerManager[] d = new PlayerManager[3]; // CraftBukkit - removed
public int maxPlayers; // CraftBukkit - private -> public
public Set banByName = new HashSet(); // CraftBukkit - private -> public
public Set banByIP = new HashSet(); // CraftBukkit - private -> public
public Set operators = new HashSet(); // CraftBukkit - private -> public
private Set whitelist = new HashSet();
private File j;
private File k;
private File l;
private File m;
public PlayerFileData playerFileData; // CraftBukkit - private - >public
public boolean hasWhitelist; // CraftBukkit - private -> public
private int p = 0;
// CraftBukkit start
private CraftServer cserver;
public ServerConfigurationManager(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this);
minecraftserver.console = ColouredConsoleSender.getInstance();
this.cserver = minecraftserver.server;
// CraftBukkit end
this.server = minecraftserver;
this.j = minecraftserver.a("banned-players.txt");
this.k = minecraftserver.a("banned-ips.txt");
this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.txt");
int i = minecraftserver.propertyManager.getInt("view-distance", 10);
// CraftBukkit - removed playermanagers
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
this.hasWhitelist = minecraftserver.propertyManager.getBoolean("white-list", false);
this.l();
this.n();
this.p();
this.r();
this.m();
this.o();
this.q();
this.s();
}
public void setPlayerFileData(WorldServer[] aworldserver) {
if (this.playerFileData != null) return; // CraftBukkit
this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData();
}
public void a(EntityPlayer entityplayer) {
// CraftBukkit - removed playermanagers
for (WorldServer world : this.server.worlds) {
if (world.manager.managedPlayers.contains(entityplayer)) {
world.manager.removePlayer(entityplayer);
break;
}
}
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
}
public int a() {
// CraftBukkit start
if (this.server.worlds.size() == 0) {
return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
}
return this.server.worlds.get(0).manager.getFurthestViewableBlock();
// CraftBukkit end
}
private PlayerManager getPlayerManager(int i) {
return this.server.getWorldServer(i).manager; // CraftBukkit
}
public void b(EntityPlayer entityplayer) {
this.playerFileData.load(entityplayer);
}
public void c(EntityPlayer entityplayer) {
// CraftBukkit start
cserver.detectListNameConflict(entityplayer);
this.sendAll(new Packet201PlayerInfo(entityplayer.listName, true, 1000));
// CraftBukkit end
this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
while (worldserver.a(entityplayer, entityplayer.boundingBox).size() != 0) {
entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
}
// 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.serverConfigurationManager.sendAll(new Packet3Chat(joinMessage));
}
// CraftBukkit end
worldserver.addEntity(entityplayer);
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
// CraftBukkit start - .name -> .listName
entityplayer.netServerHandler.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
// CraftBukkit end
}
}
public void d(EntityPlayer entityplayer) {
this.getPlayerManager(entityplayer.dimension).movePlayer(entityplayer);
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - changed return type
if (entityplayer.netServerHandler.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
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent);
// CraftBukkit end
this.playerFileData.save(entityplayer);
this.server.getWorldServer(entityplayer.dimension).kill(entityplayer);
this.players.remove(entityplayer);
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
// CraftBukkit start - .name -> .listName
this.sendAll(new Packet201PlayerInfo(entityplayer.listName, false, 9999));
// CraftBukkit end
return playerQuitEvent.getQuitMessage(); // CraftBukkit
}
public EntityPlayer attemptLogin(NetLoginHandler netloginhandler, String s) {
// CraftBukkit start - note: this entire method needs to be changed
// 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. Also change any reference to this.e.c to entity.world
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, new ItemInWorldManager(this.server.getWorldServer(0)));
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player);
String s1 = netloginhandler.networkManager.getSocketAddress().toString();
s1 = s1.substring(s1.indexOf("/") + 1);
s1 = s1.substring(0, s1.indexOf(":"));
if (this.banByName.contains(s.trim().toLowerCase())) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
// return null // CraftBukkit
} else if (!this.isWhitelisted(s)) {
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
} else if (this.banByIP.contains(s1)) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
} else if (this.players.size() >= this.maxPlayers) {
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
} else {
event.disallow(PlayerLoginEvent.Result.ALLOWED, s1);
}
this.cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
netloginhandler.disconnect(event.getKickMessage());
return null;
}
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.name.equalsIgnoreCase(s)) {
entityplayer.netServerHandler.disconnect("You logged in from another location");
}
}
return entity;
// CraftBukkit end
}
// CraftBukkit start
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag) {
return this.moveToWorld(entityplayer, i, flag, null);
}
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location) {
// CraftBukkit end
this.server.getTracker(entityplayer.dimension).untrackPlayer(entityplayer);
// this.server.getTracker(entityplayer.dimension).untrackEntity(entityplayer); // CraftBukkit
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
// CraftBukkit start
EntityPlayer entityplayer1 = entityplayer;
org.bukkit.World fromWorld = entityplayer1.getBukkitEntity().getWorld();
if (flag) {
entityplayer1.copyTo(entityplayer);
}
if (location == null) {
boolean isBedSpawn = false;
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
if (cworld != null && chunkcoordinates != null) {
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates);
if (chunkcoordinates1 != null) {
isBedSpawn = true;
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
} else {
entityplayer1.netServerHandler.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(entityplayer);
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 (worldserver.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
}
// CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getSeed(), entityplayer1.world.getWorldData().getType(), worldserver.height, entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
// CraftBukkit end
this.a(entityplayer1, worldserver);
this.getPlayerManager(entityplayer1.dimension).addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1);
this.updateClient(entityplayer1); // CraftBukkit
entityplayer1.A();
// CraftBukkit start - don't fire on respawn
if (fromWorld != location.getWorld()) {
org.bukkit.event.player.PlayerChangedWorldEvent event = new org.bukkit.event.player.PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
Bukkit.getServer().getPluginManager().callEvent(event);
}
// CraftBukkit end
return entityplayer1;
}
public void changeDimension(EntityPlayer entityplayer, int i) {
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
int dimension = i;
WorldServer fromWorld = this.server.getWorldServer(entityplayer.dimension);
WorldServer toWorld = null;
if (entityplayer.dimension < 10) {
for (WorldServer world : this.server.worlds) {
if (world.dimension == dimension) {
toWorld = world;
}
}
}
Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
Location toLocation = null;
if (toWorld != null) {
if (((dimension == -1) || (dimension == 0)) && ((entityplayer.dimension == -1) || (entityplayer.dimension == 0))) {
double blockRatio = dimension == 0 ? 8 : 0.125;
toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
} else {
ChunkCoordinates coords = toWorld.d();
if (coords != null) {
toLocation = new Location(toWorld.getWorld(), coords.x, coords.y, coords.z, 90, 0);
}
}
}
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta);
if (entityplayer.dimension == 1) {
event.useTravelAgent(false);
}
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) {
return;
}
Location finalLocation = event.getTo();
if (event.useTravelAgent()) {
finalLocation = event.getPortalTravelAgent().findOrCreate(finalLocation);
}
toWorld = ((CraftWorld) finalLocation.getWorld()).getHandle();
this.moveToWorld(entityplayer, toWorld.dimension, true, finalLocation);
// CraftBukkit end
}
public void tick() {
if (++this.p > 200) {
this.p = 0;
}
/* CraftBukkit start -- remove updating of lag to players -- it spams way to much on big servers.
if (this.p < this.players.size()) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.p);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.i));
}
*/
for (int i = 0; i < this.server.worlds.size(); ++i) {
this.server.worlds.get(i).manager.flush();
// CraftBukkit end
}
}
public void flagDirty(int i, int j, int k, int l) {
this.getPlayerManager(l).flagDirty(i, j, k);
}
public void sendAll(Packet packet) {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
entityplayer.netServerHandler.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.netServerHandler.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)).name;
}
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)).name;
}
return astring;
}
public void addUserBan(String s) {
this.banByName.add(s.toLowerCase());
this.m();
}
public void removeUserBan(String s) {
this.banByName.remove(s.toLowerCase());
this.m();
}
private void l() {
try {
this.banByName.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
this.banByName.add(s.trim().toLowerCase());
}
bufferedreader.close();
} catch (Exception exception) {
a.warning("Failed to load ban list: " + exception);
}
}
private void m() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
Iterator iterator = this.banByName.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
printwriter.println(s);
}
printwriter.close();
} catch (Exception exception) {
a.warning("Failed to save ban list: " + exception);
}
}
public Set getBannedPlayers() {
return this.banByName;
}
public Set getBannedAddresses() {
return this.banByIP;
}
public void addIpBan(String s) {
this.banByIP.add(s.toLowerCase());
this.o();
}
public void removeIpBan(String s) {
this.banByIP.remove(s.toLowerCase());
this.o();
}
private void n() {
try {
this.banByIP.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
this.banByIP.add(s.trim().toLowerCase());
}
bufferedreader.close();
} catch (Exception exception) {
a.warning("Failed to load ip ban list: " + exception);
}
}
private void o() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
Iterator iterator = this.banByIP.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
printwriter.println(s);
}
printwriter.close();
} catch (Exception exception) {
a.warning("Failed to save ip ban list: " + exception);
}
}
public void addOp(String s) {
this.operators.add(s.toLowerCase());
this.q();
// 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());
this.q();
// CraftBukkit start
Player player = server.server.getPlayer(s);
if (player != null) {
player.recalculatePermissions();
}
// CraftBukkit end
}
private void p() {
try {
this.operators.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
this.operators.add(s.trim().toLowerCase());
}
bufferedreader.close();
} catch (Exception exception) {
a.warning("Failed to load operators list: " + exception);
}
}
private void q() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
Iterator iterator = this.operators.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
printwriter.println(s);
}
printwriter.close();
} catch (Exception exception) {
a.warning("Failed to save operators list: " + exception);
}
}
private void r() {
try {
this.whitelist.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
this.whitelist.add(s.trim().toLowerCase());
}
bufferedreader.close();
} catch (Exception exception) {
a.warning("Failed to load white-list: " + exception);
}
}
private void s() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
Iterator iterator = this.whitelist.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
printwriter.println(s);
}
printwriter.close();
} catch (Exception exception) {
a.warning("Failed to save white-list: " + exception);
}
}
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) {
return this.operators.contains(s.trim().toLowerCase());
}
public EntityPlayer i(String s) {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.name.equalsIgnoreCase(s)) {
return entityplayer;
}
}
return null;
}
public void a(String s, String s1) {
EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) {
entityplayer.netServerHandler.sendPacket(new Packet3Chat(s1));
}
}
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);
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.netServerHandler.sendPacket(packet);
}
}
}
}
public void j(String s) {
Packet3Chat packet3chat = new Packet3Chat(s);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
if (this.isOp(entityplayer.name)) {
entityplayer.netServerHandler.sendPacket(packet3chat);
}
}
}
public boolean a(String s, Packet packet) {
EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) {
entityplayer.netServerHandler.sendPacket(packet);
return true;
} else {
return false;
}
}
public void savePlayers() {
for (int i = 0; i < this.players.size(); ++i) {
this.playerFileData.save((EntityHuman) this.players.get(i));
}
}
public void a(int i, int j, int k, TileEntity tileentity) {}
public void addWhitelist(String s) {
this.whitelist.add(s);
this.s();
}
public void removeWhitelist(String s) {
this.whitelist.remove(s);
this.s();
}
public Set getWhitelisted() {
return this.whitelist;
}
public void reloadWhitelist() {
this.r();
}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime()));
if (worldserver.w()) {
entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0));
}
}
public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.t_();
entityplayer.lastSentExp = -1; // CraftBukkit
}
public int getPlayerCount() {
return this.players.size();
}
public int getMaxPlayers() {
return this.maxPlayers;
}
}
|