Remap CraftBukkit to Mojang+Yarn Mappings

By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:55 +01:00
parent a265d64138
commit 30e4583dbe
1780 changed files with 44628 additions and 41274 deletions

View File

@@ -4,8 +4,8 @@ import com.google.common.net.InetAddresses;
import java.net.InetAddress;
import java.time.Instant;
import java.util.Date;
import net.minecraft.server.players.IpBanEntry;
import net.minecraft.server.players.IpBanList;
import net.minecraft.server.players.IpBanListEntry;
import org.bukkit.BanEntry;
public final class CraftIpBanEntry implements BanEntry<InetAddress> {
@@ -17,7 +17,7 @@ public final class CraftIpBanEntry implements BanEntry<InetAddress> {
private Date expiration;
private String reason;
public CraftIpBanEntry(String target, IpBanEntry entry, IpBanList list) {
public CraftIpBanEntry(String target, IpBanListEntry entry, IpBanList list) {
this.list = list;
this.target = target;
this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
@@ -63,7 +63,7 @@ public final class CraftIpBanEntry implements BanEntry<InetAddress> {
@Override
public void setExpiration(Date expiration) {
if (expiration != null && expiration.getTime() == minorDate.getTime()) {
if (expiration != null && expiration.getTime() == CraftIpBanEntry.minorDate.getTime()) {
expiration = null; // Forces "forever"
}
@@ -82,12 +82,12 @@ public final class CraftIpBanEntry implements BanEntry<InetAddress> {
@Override
public void save() {
IpBanEntry entry = new IpBanEntry(this.target, this.created, this.source, this.expiration, this.reason);
IpBanListEntry entry = new IpBanListEntry(this.target, this.created, this.source, this.expiration, this.reason);
this.list.add(entry);
}
@Override
public void remove() {
this.list.remove(target);
this.list.remove(this.target);
}
}

View File

@@ -8,8 +8,8 @@ import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.Set;
import net.minecraft.server.players.IpBanEntry;
import net.minecraft.server.players.IpBanList;
import net.minecraft.server.players.IpBanListEntry;
import org.bukkit.BanEntry;
public class CraftIpBanList implements org.bukkit.ban.IpBanList {
@@ -23,12 +23,12 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
public BanEntry<InetAddress> getBanEntry(String target) {
Preconditions.checkArgument(target != null, "Target cannot be null");
IpBanEntry entry = this.list.get(target);
IpBanListEntry entry = this.list.get(target);
if (entry == null) {
return null;
}
return new CraftIpBanEntry(target, entry, list);
return new CraftIpBanEntry(target, entry, this.list);
}
@Override
@@ -40,13 +40,13 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
public BanEntry<InetAddress> addBan(String target, String reason, Date expires, String source) {
Preconditions.checkArgument(target != null, "Ban target cannot be null");
IpBanEntry entry = new IpBanEntry(target, new Date(),
IpBanListEntry entry = new IpBanListEntry(target, new Date(),
(source == null || source.isBlank()) ? null : source, expires,
(reason == null || reason.isBlank()) ? null : reason);
this.list.add(entry);
return new CraftIpBanEntry(target, entry, list);
return new CraftIpBanEntry(target, entry, this.list);
}
@Override
@@ -57,22 +57,22 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
@Override
public BanEntry<InetAddress> addBan(InetAddress target, String reason, Instant expires, String source) {
Date date = expires != null ? Date.from(expires) : null;
return addBan(target, reason, date, source);
return this.addBan(target, reason, date, source);
}
@Override
public BanEntry<InetAddress> addBan(InetAddress target, String reason, Duration duration, String source) {
Instant instant = duration != null ? Instant.now().plus(duration) : null;
return addBan(target, reason, instant, source);
return this.addBan(target, reason, instant, source);
}
@Override
public Set<BanEntry> getBanEntries() {
ImmutableSet.Builder<BanEntry> builder = ImmutableSet.builder();
for (String target : list.getUserList()) {
IpBanEntry ipBanEntry = list.get(target);
for (String target : this.list.getUserList()) {
IpBanListEntry ipBanEntry = this.list.get(target);
if (ipBanEntry != null) {
builder.add(new CraftIpBanEntry(target, ipBanEntry, list));
builder.add(new CraftIpBanEntry(target, ipBanEntry, this.list));
}
}
return builder.build();
@@ -81,10 +81,10 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
@Override
public Set<BanEntry<InetAddress>> getEntries() {
ImmutableSet.Builder<BanEntry<InetAddress>> builder = ImmutableSet.builder();
for (String target : list.getUserList()) {
IpBanEntry ipBanEntry = list.get(target);
for (String target : this.list.getUserList()) {
IpBanListEntry ipBanEntry = this.list.get(target);
if (ipBanEntry != null) {
builder.add(new CraftIpBanEntry(target, ipBanEntry, list));
builder.add(new CraftIpBanEntry(target, ipBanEntry, this.list));
}
}
return builder.build();
@@ -98,7 +98,7 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
@Override
public boolean isBanned(InetAddress target) {
return this.isBanned(getIpFromAddress(target));
return this.isBanned(this.getIpFromAddress(target));
}
@Override
@@ -109,7 +109,7 @@ public class CraftIpBanList implements org.bukkit.ban.IpBanList {
@Override
public void pardon(InetAddress target) {
this.pardon(getIpFromAddress(target));
this.pardon(this.getIpFromAddress(target));
}
private String getIpFromAddress(InetAddress address) {

View File

@@ -3,22 +3,22 @@ package org.bukkit.craftbukkit.ban;
import com.mojang.authlib.GameProfile;
import java.time.Instant;
import java.util.Date;
import net.minecraft.server.players.GameProfileBanEntry;
import net.minecraft.server.players.GameProfileBanList;
import net.minecraft.server.players.UserBanList;
import net.minecraft.server.players.UserBanListEntry;
import org.bukkit.BanEntry;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.profile.PlayerProfile;
public final class CraftProfileBanEntry implements BanEntry<PlayerProfile> {
private static final Date minorDate = Date.from(Instant.parse("1899-12-31T04:00:00Z"));
private final GameProfileBanList list;
private final UserBanList list;
private final GameProfile profile;
private Date created;
private String source;
private Date expiration;
private String reason;
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
public CraftProfileBanEntry(GameProfile profile, UserBanListEntry entry, UserBanList list) {
this.list = list;
this.profile = profile;
this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
@@ -64,7 +64,7 @@ public final class CraftProfileBanEntry implements BanEntry<PlayerProfile> {
@Override
public void setExpiration(Date expiration) {
if (expiration != null && expiration.getTime() == minorDate.getTime()) {
if (expiration != null && expiration.getTime() == CraftProfileBanEntry.minorDate.getTime()) {
expiration = null; // Forces "forever"
}
@@ -83,7 +83,7 @@ public final class CraftProfileBanEntry implements BanEntry<PlayerProfile> {
@Override
public void save() {
GameProfileBanEntry entry = new GameProfileBanEntry(this.profile, this.created, this.source, this.expiration, this.reason);
UserBanListEntry entry = new UserBanListEntry(this.profile, this.created, this.source, this.expiration, this.reason);
this.list.add(entry);
}

View File

@@ -9,17 +9,17 @@ import java.util.Date;
import java.util.Set;
import java.util.UUID;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.players.GameProfileBanEntry;
import net.minecraft.server.players.GameProfileBanList;
import net.minecraft.server.players.UserBanList;
import net.minecraft.server.players.UserBanListEntry;
import org.bukkit.BanEntry;
import org.bukkit.ban.ProfileBanList;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.profile.PlayerProfile;
public class CraftProfileBanList implements ProfileBanList {
private final GameProfileBanList list;
private final UserBanList list;
public CraftProfileBanList(GameProfileBanList list) {
public CraftProfileBanList(UserBanList list) {
this.list = list;
}
@@ -27,7 +27,7 @@ public class CraftProfileBanList implements ProfileBanList {
public BanEntry<PlayerProfile> getBanEntry(String target) {
Preconditions.checkArgument(target != null, "Target cannot be null");
return this.getBanEntry(getProfile(target));
return this.getBanEntry(CraftProfileBanList.getProfile(target));
}
@Override
@@ -41,7 +41,7 @@ public class CraftProfileBanList implements ProfileBanList {
public BanEntry<PlayerProfile> addBan(String target, String reason, Date expires, String source) {
Preconditions.checkArgument(target != null, "Ban target cannot be null");
return this.addBan(getProfileByName(target), reason, expires, source);
return this.addBan(CraftProfileBanList.getProfileByName(target), reason, expires, source);
}
@Override
@@ -55,21 +55,21 @@ public class CraftProfileBanList implements ProfileBanList {
@Override
public BanEntry<PlayerProfile> addBan(PlayerProfile target, String reason, Instant expires, String source) {
Date date = expires != null ? Date.from(expires) : null;
return addBan(target, reason, date, source);
return this.addBan(target, reason, date, source);
}
@Override
public BanEntry<PlayerProfile> addBan(PlayerProfile target, String reason, Duration duration, String source) {
Instant instant = duration != null ? Instant.now().plus(duration) : null;
return addBan(target, reason, instant, source);
return this.addBan(target, reason, instant, source);
}
@Override
public Set<BanEntry> getBanEntries() {
ImmutableSet.Builder<BanEntry> builder = ImmutableSet.builder();
for (GameProfileBanEntry entry : list.getEntries()) {
for (UserBanListEntry entry : this.list.getEntries()) {
GameProfile profile = entry.getUser();
builder.add(new CraftProfileBanEntry(profile, entry, list));
builder.add(new CraftProfileBanEntry(profile, entry, this.list));
}
return builder.build();
@@ -78,9 +78,9 @@ public class CraftProfileBanList implements ProfileBanList {
@Override
public Set<BanEntry<PlayerProfile>> getEntries() {
ImmutableSet.Builder<BanEntry<PlayerProfile>> builder = ImmutableSet.builder();
for (GameProfileBanEntry entry : list.getEntries()) {
for (UserBanListEntry entry : this.list.getEntries()) {
GameProfile profile = entry.getUser();
builder.add(new CraftProfileBanEntry(profile, entry, list));
builder.add(new CraftProfileBanEntry(profile, entry, this.list));
}
return builder.build();
@@ -97,7 +97,7 @@ public class CraftProfileBanList implements ProfileBanList {
public boolean isBanned(String target) {
Preconditions.checkArgument(target != null, "Target cannot be null");
return this.isBanned(getProfile(target));
return this.isBanned(CraftProfileBanList.getProfile(target));
}
@Override
@@ -111,7 +111,7 @@ public class CraftProfileBanList implements ProfileBanList {
public void pardon(String target) {
Preconditions.checkArgument(target != null, "Target cannot be null");
this.pardon(getProfile(target));
this.pardon(CraftProfileBanList.getProfile(target));
}
public BanEntry<PlayerProfile> getBanEntry(GameProfile profile) {
@@ -119,12 +119,12 @@ public class CraftProfileBanList implements ProfileBanList {
return null;
}
GameProfileBanEntry entry = list.get(profile);
UserBanListEntry entry = this.list.get(profile);
if (entry == null) {
return null;
}
return new CraftProfileBanEntry(profile, entry, list);
return new CraftProfileBanEntry(profile, entry, this.list);
}
public BanEntry<PlayerProfile> addBan(GameProfile profile, String reason, Date expires, String source) {
@@ -132,21 +132,21 @@ public class CraftProfileBanList implements ProfileBanList {
return null;
}
GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
UserBanListEntry entry = new UserBanListEntry(profile, new Date(),
(source == null || source.isBlank()) ? null : source, expires,
(reason == null || reason.isBlank()) ? null : reason);
list.add(entry);
this.list.add(entry);
return new CraftProfileBanEntry(profile, entry, list);
return new CraftProfileBanEntry(profile, entry, this.list);
}
private void pardon(GameProfile profile) {
list.remove(profile);
this.list.remove(profile);
}
private boolean isBanned(GameProfile profile) {
return profile != null && list.isBanned(profile);
return profile != null && this.list.isBanned(profile);
}
static GameProfile getProfile(String target) {
@@ -157,7 +157,7 @@ public class CraftProfileBanList implements ProfileBanList {
} catch (IllegalArgumentException ignored) {
}
return (uuid != null) ? getProfileByUUID(uuid) : getProfileByName(target);
return (uuid != null) ? CraftProfileBanList.getProfileByUUID(uuid) : CraftProfileBanList.getProfileByName(target);
}
static GameProfile getProfileByUUID(UUID uuid) {