mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 10:12:06 -07:00
Update to Minecraft 1.3 beta
This commit is contained in:
@@ -34,10 +34,13 @@ public class ServerConfigurationManager {
|
||||
private Set f = new HashSet();
|
||||
private Set g = new HashSet();
|
||||
private Set h = new HashSet();
|
||||
private File i;
|
||||
private Set i = new HashSet();
|
||||
private File j;
|
||||
private File k;
|
||||
private PlayerNBTManager l;
|
||||
private File l;
|
||||
private File m;
|
||||
private PlayerFileData n;
|
||||
private boolean o;
|
||||
|
||||
// CraftBukkit start
|
||||
private CraftServer server;
|
||||
@@ -48,23 +51,27 @@ public class ServerConfigurationManager {
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = minecraftserver;
|
||||
this.i = minecraftserver.a("banned-players.txt");
|
||||
this.j = minecraftserver.a("banned-ips.txt");
|
||||
this.k = minecraftserver.a("ops.txt");
|
||||
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");
|
||||
// this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed!
|
||||
this.e = minecraftserver.d.a("max-players", 20);
|
||||
this.e();
|
||||
this.o = minecraftserver.d.a("white-list", false);
|
||||
this.g();
|
||||
this.i();
|
||||
this.f();
|
||||
this.k();
|
||||
this.m();
|
||||
this.h();
|
||||
this.j();
|
||||
this.l();
|
||||
this.n();
|
||||
}
|
||||
|
||||
public void a(WorldServer worldserver) {
|
||||
// Craftbukkit start
|
||||
if (this.l == null) {
|
||||
this.l = new PlayerNBTManager(new File(worldserver.t, "players"));
|
||||
if (this.n == null) {
|
||||
this.n = worldserver.m().d();
|
||||
}
|
||||
// Craftbukkit end
|
||||
}
|
||||
@@ -75,10 +82,10 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
this.b.add(entityplayer);
|
||||
this.l.b(entityplayer);
|
||||
this.n.b(entityplayer);
|
||||
|
||||
// Craftbukkit start
|
||||
((WorldServer)entityplayer.world).A.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
((WorldServer)entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
|
||||
while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
|
||||
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
|
||||
@@ -97,7 +104,7 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void c(EntityPlayer entityplayer) {
|
||||
this.l.a(entityplayer);
|
||||
this.n.a(entityplayer);
|
||||
entityplayer.world.d(entityplayer); // Craftbukkit
|
||||
this.b.remove(entityplayer);
|
||||
|
||||
@@ -123,6 +130,8 @@ public class ServerConfigurationManager {
|
||||
|
||||
if (this.f.contains(s.trim().toLowerCase())) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
|
||||
} else if (!this.g(s)) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are not white-listed on this server!");
|
||||
} else if (this.g.contains(s2)) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
|
||||
} else if (this.b.size() >= this.e) {
|
||||
@@ -158,7 +167,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
entityplayer1.id = entityplayer.id;
|
||||
entityplayer1.a = entityplayer.a;
|
||||
((WorldServer)entityplayer.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
((WorldServer)entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
|
||||
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
||||
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
||||
@@ -177,7 +186,7 @@ public class ServerConfigurationManager {
|
||||
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch();
|
||||
entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle());
|
||||
entityplayer1.c.a = entityplayer1;
|
||||
((WorldServer)entityplayer1.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
((WorldServer)entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
// CraftBukkit end
|
||||
|
||||
entityplayer1.a.b((Packet) (new Packet9Respawn()));
|
||||
@@ -186,6 +195,7 @@ public class ServerConfigurationManager {
|
||||
entityplayer.world.a(entityplayer1);
|
||||
this.b.add(entityplayer1);
|
||||
entityplayer1.l();
|
||||
entityplayer1.s();
|
||||
return entityplayer1;
|
||||
// Craftbukkit end
|
||||
}
|
||||
@@ -200,7 +210,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
// Craftbukkit - changed signature
|
||||
public void a(int i, int j, int k, WorldServer world) {
|
||||
world.manager.a(i, j, k, world); // Craftbukkit
|
||||
world.manager.a(i, j, k);
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
@@ -227,18 +237,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void a(String s) {
|
||||
this.f.add(s.toLowerCase());
|
||||
this.f();
|
||||
this.h();
|
||||
}
|
||||
|
||||
public void b(String s) {
|
||||
this.f.remove(s.toLowerCase());
|
||||
this.f();
|
||||
this.h();
|
||||
}
|
||||
|
||||
private void e() {
|
||||
private void g() {
|
||||
try {
|
||||
this.f.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.i));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@@ -251,9 +261,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void f() {
|
||||
private void h() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.i, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
|
||||
Iterator iterator = this.f.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -270,18 +280,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void c(String s) {
|
||||
this.g.add(s.toLowerCase());
|
||||
this.h();
|
||||
this.j();
|
||||
}
|
||||
|
||||
public void d(String s) {
|
||||
this.g.remove(s.toLowerCase());
|
||||
this.h();
|
||||
this.j();
|
||||
}
|
||||
|
||||
private void g() {
|
||||
private void i() {
|
||||
try {
|
||||
this.g.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@@ -294,9 +304,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void h() {
|
||||
private void j() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
|
||||
Iterator iterator = this.g.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -313,18 +323,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void e(String s) {
|
||||
this.h.add(s.toLowerCase());
|
||||
this.j();
|
||||
this.l();
|
||||
}
|
||||
|
||||
public void f(String s) {
|
||||
this.h.remove(s.toLowerCase());
|
||||
this.j();
|
||||
this.l();
|
||||
}
|
||||
|
||||
private void i() {
|
||||
private void k() {
|
||||
try {
|
||||
this.h.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@@ -337,9 +347,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void j() {
|
||||
private void l() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
|
||||
Iterator iterator = this.h.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -354,11 +364,49 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void m() {
|
||||
try {
|
||||
this.i.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
this.i.add(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
bufferedreader.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning("Failed to load white-list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void n() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
|
||||
Iterator iterator = this.i.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 g(String s) {
|
||||
s = s.trim().toLowerCase();
|
||||
return !this.o || this.h.contains(s) || this.i.contains(s);
|
||||
}
|
||||
|
||||
public boolean h(String s) {
|
||||
return this.h.contains(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
public EntityPlayer h(String s) {
|
||||
public EntityPlayer i(String s) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
@@ -371,7 +419,7 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void a(String s, String s1) {
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
EntityPlayer entityplayer = this.i(s);
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b((Packet) (new Packet3Chat(s1)));
|
||||
@@ -391,20 +439,20 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void i(String s) {
|
||||
public void j(String s) {
|
||||
Packet3Chat packet3chat = new Packet3Chat(s);
|
||||
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (this.g(entityplayer.name)) {
|
||||
if (this.h(entityplayer.name)) {
|
||||
entityplayer.a.b((Packet) packet3chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(String s, Packet packet) {
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
EntityPlayer entityplayer = this.i(s);
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b(packet);
|
||||
@@ -416,9 +464,27 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void d() {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
this.l.a((EntityPlayer) this.b.get(i));
|
||||
this.n.a((EntityHuman) this.b.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {}
|
||||
}
|
||||
|
||||
public void k(String s) {
|
||||
this.i.add(s);
|
||||
this.n();
|
||||
}
|
||||
|
||||
public void l(String s) {
|
||||
this.i.remove(s);
|
||||
this.n();
|
||||
}
|
||||
|
||||
public Set e() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
this.m();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user