Configurable Player Collision

This commit is contained in:
Aikar 2016-04-13 02:10:49 -04:00
parent 3c1c4ab059
commit a99426b5fe
4 changed files with 144 additions and 98 deletions

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
@@ -200,7 +200,7 @@
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.displayName);
buf.writeByte(this.options);
buf.writeUtf(this.nametagVisibility);
- buf.writeUtf(this.collisionRule);
+ buf.writeUtf(!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions ? "never" : this.collisionRule); // Paper - Configurable player collision
buf.writeEnum(this.color);
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerPrefix);
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerSuffix);

View File

@ -274,7 +274,7 @@
if (profiledduration != null) {
profiledduration.finish(true);
}
@@ -387,23 +456,218 @@
@@ -387,23 +456,232 @@
protected void forceDifficulty() {}
@ -489,6 +489,20 @@
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
+ }
+
+ // Paper start - Configurable player collision; Handle collideRule team for player collision toggle
+ final ServerScoreboard scoreboard = this.getScoreboard();
+ final java.util.Collection<String> toRemove = scoreboard.getPlayerTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(net.minecraft.world.scores.PlayerTeam::getName).collect(java.util.stream.Collectors.toList());
+ for (String teamName : toRemove) {
+ scoreboard.removePlayerTeam(scoreboard.getPlayerTeam(teamName)); // Clean up after ourselves
+ }
+
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) {
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16);
+ net.minecraft.world.scores.PlayerTeam collideTeam = scoreboard.addPlayerTeam(this.getPlayerList().collideRuleTeamName);
+ collideTeam.setSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
+ }
+ // Paper end - Configurable player collision
+
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
+ if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
@ -507,7 +521,7 @@
if (!iworlddataserver.isInitialized()) {
try {
@@ -427,30 +691,8 @@
@@ -427,30 +705,8 @@
iworlddataserver.setInitialized(true);
}
@ -539,7 +553,7 @@
private static void setInitialSpawn(ServerLevel world, ServerLevelData worldProperties, boolean bonusChest, boolean debugWorld) {
if (debugWorld) {
@@ -458,6 +700,21 @@
@@ -458,6 +714,21 @@
} else {
ServerChunkCache chunkproviderserver = world.getChunkSource();
ChunkPos chunkcoordintpair = new ChunkPos(chunkproviderserver.randomState().sampler().findSpawnPosition());
@ -561,7 +575,7 @@
int i = chunkproviderserver.getGenerator().getSpawnHeight(world);
if (i < world.getMinY()) {
@@ -516,31 +773,36 @@
@@ -516,31 +787,36 @@
iworlddataserver.setGameType(GameType.SPECTATOR);
}
@ -609,7 +623,7 @@
ForcedChunksSavedData forcedchunk = (ForcedChunksSavedData) worldserver1.getDataStorage().get(ForcedChunksSavedData.factory(), "chunks");
if (forcedchunk != null) {
@@ -555,10 +817,17 @@
@@ -555,10 +831,17 @@
}
}
@ -631,7 +645,7 @@
}
public GameType getDefaultGameType() {
@@ -588,12 +857,16 @@
@@ -588,12 +871,16 @@
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force);
}
@ -650,7 +664,7 @@
if (flush) {
Iterator iterator1 = this.getAllLevels().iterator();
@@ -628,18 +901,41 @@
@@ -628,18 +915,41 @@
this.stopServer();
}
@ -692,7 +706,7 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -693,6 +989,15 @@
@@ -693,6 +1003,15 @@
} catch (IOException ioexception1) {
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
}
@ -708,15 +722,10 @@
}
@@ -715,10 +1020,68 @@
this.serverThread.join();
} catch (InterruptedException interruptedexception) {
MinecraftServer.LOGGER.error("Error while shutting down", interruptedexception);
+ }
+ }
+
+ }
+
@@ -720,6 +1039,64 @@
}
+ // Spigot Start
+ private static double calcTps(double avg, double exp, double tps)
+ {
@ -749,9 +758,9 @@
+ for (int i = 0; i < size; i++) {
+ this.samples[i] = dec(TPS);
+ this.times[i] = SEC_IN_NANO;
}
}
+ }
+ }
+
+ private static java.math.BigDecimal dec(long t) {
+ return new java.math.BigDecimal(t);
+ }
@ -770,14 +779,15 @@
+ public double getAverage() {
+ return total.divide(dec(time), 30, java.math.RoundingMode.HALF_UP).doubleValue();
+ }
}
+ }
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
+ // Paper end
+ // Spigot End
+
protected void runServer() {
try {
@@ -727,9 +1090,15 @@
if (!this.initServer()) {
@@ -727,9 +1104,15 @@
}
this.nextTickTimeNanos = Util.getNanos();
@ -794,7 +804,7 @@
while (this.running) {
long i;
@@ -744,11 +1113,30 @@
@@ -744,11 +1127,30 @@
if (j > MinecraftServer.OVERLOADED_THRESHOLD_NANOS + 20L * i && this.nextTickTimeNanos - this.lastOverloadWarningNanos >= MinecraftServer.OVERLOADED_WARNING_INTERVAL_NANOS + 100L * i) {
long k = j / i;
@ -825,7 +835,7 @@
boolean flag = i == 0L;
@@ -757,6 +1145,8 @@
@@ -757,6 +1159,8 @@
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
}
@ -834,7 +844,7 @@
this.nextTickTimeNanos += i;
try {
@@ -830,6 +1220,13 @@
@@ -830,6 +1234,13 @@
this.services.profileCache().clearExecutor();
}
@ -848,25 +858,23 @@
this.onServerExit();
}
@@ -889,9 +1286,16 @@
@@ -889,7 +1300,14 @@
}
private boolean haveTime() {
- return this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
+ // CraftBukkit start
+ return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
}
+ }
+
+ private void executeModerately() {
+ this.runAllTasks();
+ java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
+ // CraftBukkit end
+ }
+
public static boolean throwIfFatalException() {
RuntimeException runtimeexception = (RuntimeException) MinecraftServer.fatalException.get();
}
@@ -903,7 +1307,7 @@
public static boolean throwIfFatalException() {
@@ -903,7 +1321,7 @@
}
public static void setFatalException(RuntimeException exception) {
@ -875,7 +883,7 @@
}
@Override
@@ -977,7 +1381,7 @@
@@ -977,7 +1395,7 @@
}
}
@ -884,7 +892,7 @@
Profiler.get().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1025,6 +1429,7 @@
@@ -1025,6 +1443,7 @@
}
public void tickServer(BooleanSupplier shouldKeepTicking) {
@ -892,7 +900,7 @@
long i = Util.getNanos();
int j = this.pauseWhileEmptySeconds() * 20;
@@ -1041,6 +1446,7 @@
@@ -1041,6 +1460,7 @@
this.autoSave();
}
@ -900,7 +908,7 @@
this.tickConnection();
return;
}
@@ -1055,12 +1461,13 @@
@@ -1055,12 +1475,13 @@
}
--this.ticksUntilAutosave;
@ -915,7 +923,7 @@
gameprofilerfiller.push("tallying");
long k = Util.getNanos() - i;
int l = this.tickCount % 100;
@@ -1074,7 +1481,7 @@
@@ -1074,7 +1495,7 @@
}
private void autoSave() {
@ -924,7 +932,7 @@
MinecraftServer.LOGGER.debug("Autosave started");
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -1123,7 +1530,7 @@
@@ -1123,7 +1544,7 @@
private ServerStatus buildServerStatus() {
ServerStatus.Players serverping_serverpingplayersample = this.buildPlayerStatus();
@ -933,7 +941,7 @@
}
private ServerStatus.Players buildPlayerStatus() {
@@ -1154,24 +1561,43 @@
@@ -1154,24 +1575,43 @@
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@ -977,7 +985,7 @@
gameprofilerfiller.push("tick");
@@ -1186,6 +1612,7 @@
@@ -1186,6 +1626,7 @@
gameprofilerfiller.pop();
gameprofilerfiller.pop();
@ -985,7 +993,7 @@
}
gameprofilerfiller.popPush("connection");
@@ -1265,7 +1692,23 @@
@@ -1265,7 +1706,23 @@
@Nullable
public ServerLevel getLevel(ResourceKey<Level> key) {
return (ServerLevel) this.levels.get(key);
@ -1009,7 +1017,7 @@
public Set<ResourceKey<Level>> levelKeys() {
return this.levels.keySet();
@@ -1296,7 +1739,7 @@
@@ -1296,7 +1753,7 @@
@DontObfuscate
public String getServerModName() {
@ -1018,7 +1026,7 @@
}
public SystemReport fillSystemReport(SystemReport details) {
@@ -1347,7 +1790,7 @@
@@ -1347,7 +1804,7 @@
@Override
public void sendSystemMessage(Component message) {
@ -1027,7 +1035,7 @@
}
public KeyPair getKeyPair() {
@@ -1481,10 +1924,20 @@
@@ -1481,10 +1938,20 @@
@Override
public String getMotd() {
@ -1049,7 +1057,7 @@
this.motd = motd;
}
@@ -1507,7 +1960,7 @@
@@ -1507,7 +1974,7 @@
}
public ServerConnectionListener getConnection() {
@ -1058,7 +1066,7 @@
}
public boolean isReady() {
@@ -1634,11 +2087,11 @@
@@ -1634,11 +2101,11 @@
public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -1072,7 +1080,7 @@
}, this).thenCompose((immutablelist) -> {
MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist);
List<Registry.PendingTags<?>> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess());
@@ -1654,6 +2107,7 @@
@@ -1654,6 +2121,7 @@
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
this.resources.close();
this.resources = minecraftserver_reloadableresources;
@ -1080,7 +1088,7 @@
this.packRepository.setSelected(dataPacks);
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(MinecraftServer.getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures());
@@ -1952,7 +2406,7 @@
@@ -1952,7 +2420,7 @@
final List<String> list = Lists.newArrayList();
final GameRules gamerules = this.getGameRules();
@ -1089,7 +1097,7 @@
@Override
public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> key, GameRules.Type<T> type) {
list.add(String.format(Locale.ROOT, "%s=%s\n", key.getId(), gamerules.getRule(key)));
@@ -2058,7 +2512,7 @@
@@ -2058,7 +2526,7 @@
try {
label51:
{
@ -1098,10 +1106,13 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -2108,6 +2562,22 @@
}
@@ -2105,8 +2573,24 @@
if (bufferedwriter != null) {
bufferedwriter.close();
}
+
+ }
+
+ // CraftBukkit start
+ public boolean isDebugging() {
+ return false;
@ -1111,17 +1122,16 @@
+ public static MinecraftServer getServer() {
+ return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
+ }
+
+ @Deprecated
+ public static RegistryAccess getDefaultRegistryAccess() {
+ return CraftRegistry.getMinecraftRegistry();
+ }
}
+ // CraftBukkit end
+
private ProfilerFiller createProfiler() {
if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -2225,18 +2695,24 @@
@@ -2225,18 +2709,24 @@
}
public void logChatMessage(Component message, ChatType.Bound params, @Nullable String prefix) {

View File

@ -63,13 +63,14 @@
public final PlayerDataStorage playerIo;
private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -134,13 +156,23 @@
@@ -134,13 +156,24 @@
private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn;
+ // CraftBukkit start
+ private CraftServer cserver;
+ private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>();
+ public @Nullable String collideRuleTeamName; // Paper - Configurable player collision
+
public PlayerList(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registryManager, PlayerDataStorage saveHandler, int maxPlayers) {
+ this.cserver = server.server = new CraftServer((DedicatedServer) server, this);
@ -89,7 +90,7 @@
this.server = server;
this.registries = registryManager;
this.maxPlayers = maxPlayers;
@@ -148,27 +180,37 @@
@@ -148,27 +181,37 @@
}
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
@ -132,7 +133,7 @@
ServerLevel worldserver = this.server.getLevel(resourcekey);
ServerLevel worldserver1;
@@ -182,10 +224,27 @@
@@ -182,10 +225,27 @@
player.setServerLevel(worldserver1);
String s1 = connection.getLoggableAddress(this.server.logIPs());
@ -162,7 +163,7 @@
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
connection.setupInboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())), playerconnection);
@@ -194,7 +253,9 @@
@@ -194,7 +254,9 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
@ -173,7 +174,7 @@
playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected));
@@ -213,8 +274,10 @@
@@ -213,8 +275,10 @@
} else {
ichatmutablecomponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), s);
}
@ -185,7 +186,7 @@
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
ServerStatus serverping = this.server.getStatus();
@@ -222,17 +285,70 @@
@@ -222,17 +286,77 @@
player.sendServerStatus(serverping);
}
@ -256,11 +257,18 @@
player.loadAndSpawnParentVehicle(optional);
player.initInventoryMenu();
+ // CraftBukkit - Moved from above, added world
+ // Paper start - Configurable player collision; Add to collideRule team if needed
+ final net.minecraft.world.scores.Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam collideRuleTeam = scoreboard.getPlayerTeam(this.collideRuleTeamName);
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && player.getTeam() == null) {
+ scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
+ }
+ // Paper end - Configurable player collision
+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
}
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
@@ -269,30 +385,31 @@
@@ -269,30 +393,31 @@
}
public void addWorldborderListener(ServerLevel world) {
@ -297,7 +305,7 @@
}
@Override
@@ -319,14 +436,15 @@
@@ -319,14 +444,15 @@
}
protected void save(ServerPlayer player) {
@ -315,7 +323,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.save();
@@ -334,95 +452,176 @@
@@ -334,95 +460,186 @@
}
@ -343,6 +351,16 @@
+ entityplayer.doTick(); // SPIGOT-924
+ // CraftBukkit end
+
+ // Paper start - Configurable player collision; Remove from collideRule team if needed
+ if (this.collideRuleTeamName != null) {
+ final net.minecraft.world.scores.Scoreboard scoreBoard = this.server.getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam team = scoreBoard.getPlayersTeam(this.collideRuleTeamName);
+ if (entityplayer.getTeam() == team && team != null) {
+ scoreBoard.removePlayerFromTeam(entityplayer.getScoreboardName(), team);
+ }
+ }
+ // Paper end - Configurable player collision
+
+ this.save(entityplayer);
+ if (entityplayer.isPassenger()) {
+ Entity entity = entityplayer.getRootVehicle();
@ -530,7 +548,7 @@
if (entityplayer1 != null) {
set.add(entityplayer1);
@@ -431,30 +630,50 @@
@@ -431,30 +648,50 @@
Iterator iterator1 = set.iterator();
while (iterator1.hasNext()) {
@ -594,7 +612,7 @@
while (iterator.hasNext()) {
String s = (String) iterator.next();
@@ -462,41 +681,88 @@
@@ -462,41 +699,88 @@
entityplayer1.addTag(s);
}
@ -691,7 +709,7 @@
return entityplayer1;
}
@@ -524,7 +790,18 @@
@@ -524,7 +808,18 @@
public void tick() {
if (++this.sendAllPlayerInfoIn > 600) {
@ -711,14 +729,10 @@
this.sendAllPlayerInfoIn = 0;
}
@@ -537,9 +814,28 @@
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -541,6 +836,25 @@
}
entityplayer.connection.send(packet);
+ }
+
+ }
+
+ // CraftBukkit start - add a world/entity limited version
+ public void broadcastAll(Packet packet, net.minecraft.world.entity.player.Player entityhuman) {
+ for (int i = 0; i < this.players.size(); ++i) {
@ -733,14 +747,15 @@
+ public void broadcastAll(Packet packet, Level world) {
+ for (int i = 0; i < world.players().size(); ++i) {
+ ((ServerPlayer) world.players().get(i)).connection.send(packet);
}
}
+ }
+
+ }
+ // CraftBukkit end
+
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
Iterator iterator = this.players.iterator();
@@ -554,7 +850,7 @@
@@ -554,7 +868,7 @@
}
@ -749,7 +764,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam != null) {
@@ -573,7 +869,7 @@
@@ -573,7 +887,7 @@
}
}
@ -758,7 +773,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam == null) {
@@ -619,7 +915,7 @@
@@ -619,7 +933,7 @@
}
public void deop(GameProfile profile) {
@ -767,7 +782,7 @@
ServerPlayer entityplayer = this.getPlayer(profile.getId());
if (entityplayer != null) {
@@ -643,6 +939,7 @@
@@ -643,6 +957,7 @@
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@ -775,7 +790,7 @@
this.server.getCommands().sendCommands(player);
}
@@ -656,23 +953,19 @@
@@ -656,23 +971,19 @@
@Nullable
public ServerPlayer getPlayerByName(String name) {
@ -807,7 +822,7 @@
if (entityplayer != player && entityplayer.level().dimension() == worldKey) {
double d4 = x - entityplayer.getX();
double d5 = y - entityplayer.getY();
@@ -712,15 +1005,19 @@
@@ -712,15 +1023,19 @@
public void reloadWhiteList() {}
public void sendLevelInfo(ServerPlayer player, ServerLevel world) {
@ -831,7 +846,7 @@
}
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -729,8 +1026,16 @@
@@ -729,8 +1044,16 @@
public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote();
@ -849,7 +864,7 @@
}
public int getPlayerCount() {
@@ -786,12 +1091,22 @@
@@ -786,12 +1109,29 @@
}
public void removeAll() {
@ -861,6 +876,13 @@
}
+ // CraftBukkit end
+ // Paper start - Configurable player collision; Remove collideRule team if it exists
+ if (this.collideRuleTeamName != null) {
+ final net.minecraft.world.scores.Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
+ final PlayerTeam team = scoreboard.getPlayersTeam(this.collideRuleTeamName);
+ if (team != null) scoreboard.removePlayerTeam(team);
+ }
+ // Paper end - Configurable player collision
}
+ // CraftBukkit start
@ -874,7 +896,7 @@
public void broadcastSystemMessage(Component message, boolean overlay) {
this.broadcastSystemMessage(message, (entityplayer) -> {
return message;
@@ -819,24 +1134,43 @@
@@ -819,24 +1159,43 @@
}
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) {
@ -921,7 +943,7 @@
}
if (flag1 && sender != null) {
@@ -845,20 +1179,27 @@
@@ -845,20 +1204,27 @@
}
@ -954,7 +976,7 @@
Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -867,7 +1208,7 @@
@@ -867,7 +1233,7 @@
}
serverstatisticmanager = new ServerStatsCounter(this.server, file1);
@ -963,7 +985,7 @@
}
return serverstatisticmanager;
@@ -875,13 +1216,13 @@
@@ -875,13 +1241,13 @@
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID();
@ -979,7 +1001,7 @@
}
advancementdataplayer.setPlayer(player);
@@ -932,15 +1273,28 @@
@@ -932,15 +1298,28 @@
}
public void reloadResources() {

View File

@ -12,12 +12,15 @@
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max;
@@ -43,7 +48,7 @@
@@ -43,9 +48,9 @@
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();
return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> {
- if (!entity1.isPushable()) {
+ if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
return false;
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
- } else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
+ } else if (entity1 instanceof Player && entity instanceof Player && !io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { // Paper - Configurable player collision
return false;
} else {
PlayerTeam scoreboardteam1 = entity1.getTeam();