Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-30 01:50:08 +01:00
Implemented new ban and unban methods
Dieser Commit ist enthalten in:
Ursprung
598be22800
Commit
09d90e639b
src/main/java
net/minecraft/server
org/bukkit/craftbukkit
@ -33,7 +33,7 @@ public class ServerConfigurationManager {
|
|||||||
public MinecraftServer server; // CraftBukkit - private -> public
|
public MinecraftServer server; // CraftBukkit - private -> public
|
||||||
// private PlayerManager[] d = new PlayerManager[2]; // CraftBukkit - removed
|
// private PlayerManager[] d = new PlayerManager[2]; // CraftBukkit - removed
|
||||||
public int maxPlayers; // CraftBukkit - private -> public
|
public int maxPlayers; // CraftBukkit - private -> public
|
||||||
private Set banByName = new HashSet();
|
public Set banByName = new HashSet(); // CraftBukkit - private -> public
|
||||||
public Set banByIP = new HashSet(); // CraftBukkit - private -> public
|
public Set banByIP = new HashSet(); // CraftBukkit - private -> public
|
||||||
private Set h = new HashSet();
|
private Set h = new HashSet();
|
||||||
private Set i = new HashSet();
|
private Set i = new HashSet();
|
||||||
|
@ -25,16 +25,28 @@ public class CraftOfflinePlayer implements OfflinePlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return server.getHandle().isOp(getName());
|
return server.getHandle().isOp(getName().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOp(boolean value) {
|
public void setOp(boolean value) {
|
||||||
if (value == isOp()) return;
|
if (value == isOp()) return;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
server.getHandle().e(getName());
|
server.getHandle().e(getName().toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
server.getHandle().f(getName());
|
server.getHandle().f(getName().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBanned() {
|
||||||
|
return server.getHandle().banByName.contains(name.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBanned(boolean value) {
|
||||||
|
if (value) {
|
||||||
|
server.getHandle().a(name.toLowerCase());
|
||||||
|
} else {
|
||||||
|
server.getHandle().b(name.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -829,4 +829,14 @@ public final class CraftServer implements Server {
|
|||||||
public void unbanIP(String address) {
|
public void unbanIP(String address) {
|
||||||
server.d(address);
|
server.d(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<OfflinePlayer> getBannedPlayers() {
|
||||||
|
Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();
|
||||||
|
|
||||||
|
for (Object name : server.banByName) {
|
||||||
|
result.add(getOfflinePlayer((String)name));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,4 +354,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
public void resetPlayerTime() {
|
public void resetPlayerTime() {
|
||||||
setPlayerTime(0, true);
|
setPlayerTime(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBanned() {
|
||||||
|
return server.getHandle().banByName.contains(getName().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBanned(boolean value) {
|
||||||
|
if (value) {
|
||||||
|
server.getHandle().a(getName().toLowerCase());
|
||||||
|
} else {
|
||||||
|
server.getHandle().b(getName().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren