Skip to content

Commit

Permalink
more works
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Dec 4, 2023
1 parent dc984bb commit 39a31e8
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 112 deletions.
40 changes: 40 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
ij_any_block_comment_add_space = false
ij_any_block_comment_at_first_column = false
ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true

[*.tiny]
indent_style=tab

[*.bat]
end_of_line=crlf

[*.yml]
indent_size=2

[*.patch]
trim_trailing_whitespace=false

[*.java]
ij_continuation_indent_size = 4
ij_java_class_count_to_use_import_on_demand = 999999
ij_java_insert_inner_class_imports = false
ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *,|,$*
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true

[test-plugin/**/*.java]
ij_java_use_fq_class_names = false

[Paper-Server/src/main/resources/data/**/*.json]
indent_size = 2

[paper-api-generator/generated/**/*.java]
ij_java_imports_layout = $*,|,*
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test Gradle build script

on:
push:
branches: [ "ver/*", "feat/*", "dev/*", "expr/*", "ench/*", "impl/*" ]
branches: [ "ver/*", "dev/*", "feat/**/*" ]
workflow_dispatch:

jobs:
Expand Down
7 changes: 4 additions & 3 deletions patches/server/0006-Plazma-Configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Plazma Configurations


diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index c01b4393439838976965823298f12e4762e72eff..e16b64d9780b5b1607ca3a207d27a5ae80dbfaf5 100644
index c01b4393439838976965823298f12e4762e72eff..9b1859f1fda37b2e39d29523cec8660cfb2f8540 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -41,6 +41,16 @@ public abstract class Configurations<G, W> {
Expand Down Expand Up @@ -102,7 +102,7 @@ index c01b4393439838976965823298f12e4762e72eff..e16b64d9780b5b1607ca3a207d27a5ae
Files.createFile(worldConfigFile); // create empty file as template
newFile = true;
}
@@ -275,6 +306,38 @@ public abstract class Configurations<G, W> {
@@ -275,6 +306,39 @@ public abstract class Configurations<G, W> {
return level.convertable.levelDirectory.path().resolve(this.worldConfigFileName);
}

Expand All @@ -128,12 +128,13 @@ index c01b4393439838976965823298f12e4762e72eff..e16b64d9780b5b1607ca3a207d27a5ae
+ return createWorldContextMap(level.convertable.levelDirectory.path(), level.serverLevelData.getLevelName(), level.dimension().location(), level.spigotConfig);
+ }
+
+ public static ContextMap createWorldContextMap(Path dir, String levelName, ResourceLocation worldKey, org.spigotmc.SpigotWorldConfig spigotConfig) {
+ public static ContextMap createWorldContextMap(Path dir, String levelName, ResourceLocation worldKey, org.spigotmc.SpigotWorldConfig spigotConfig, RegistryAccess registryAccess) {
+ return ContextMap.builder()
+ .put(WORLD_DIRECTORY, dir)
+ .put(WORLD_NAME, levelName)
+ .put(WORLD_KEY, worldKey)
+ .put(SPIGOT_WORLD_CONFIG_CONTEXT_KEY, com.google.common.base.Suppliers.ofInstance(spigotConfig))
+ .put(REGISTRY_ACCESS, registryAccess)
+ .build();
+ }
+ // Plazma end
Expand Down
5 changes: 4 additions & 1 deletion patches/server/0010-Optimize-default-configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 27 Sep 2023 16:42:17 +0900
Subject: [PATCH] Optimize default configurations

Reference: YouHaveTrouble/minecraft-optimization, AkiraDevelopment/SimplyMC
[REFERENCE]
- YouHaveTrouble/minecraft-optimization
- AkiraDevelopment/SimplyMC
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them

diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index 9ca1494497ae53e56b1f81fda51b0b8bd02a6d03..ccd7b964aa149482a129c8a45378c38db07b984e 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,8 @@ index e7554ec800f321e4e34c926c53f2375a8c3aa979..fc3c0ea41563995b1b115271cda4e9ca
}

// CraftBukkit start - return boolean
diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index f6fa9e121fc7daa036219a4ac0daf711d644f8e3..6cfdf5a745256774c714d201604d06ff1c7adf7a 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -11,6 +11,7 @@ import static org.spongepowered.configurate.NodePath.path;
interface ChangedConfigurations {

Map<NodePath, String> MOVED_WORLD_PATH = new HashMap<>() {{
+ put(path("structure", "portal", "nether-portal", "size"), "structure.nether-portal");
}};
NodePath[] REMOVED_WORLD_PATHS = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 5e706773d2f64c81a5d3bbf41b8217a343a5d77e..921d4bd66f399adcb0d5e3bde9a871b4120b9a8e 100644
index f189af938e8c083197d38e8abe7313f3bc2badbe..38b59499053bee3347a2445ec75ba249c4887415 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -41,6 +41,21 @@ public class WorldConfigurations extends ConfigurationPart {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index f5bc3497831877e0c2b7dc1cbd8abe3a67d7695b..e27867a95d49531507de63be09604d47
double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a19c2d10385d3bc81061f188e2874fe118ddd425..a692803763961c9b622d35bcc3d5d9b913e06002 100644
index 7b72be8dcaf3fc5c7151c847faa2dfc75ef9eeb7..9a818c8f1450d31d29fd72cda45a14eec9034615 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -449,7 +449,7 @@ public class ServerPlayer extends Player {
Expand Down Expand Up @@ -131,7 +131,7 @@ index a5443f92786427c42092aec8350e7ab37704db7a..0383c9e75a12c5832cf69daf14b80373
private int tickDelay;
private int spawnDelay;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..460be6c59cbaa18df871adc7840b8e0b34815257 100644
index a2093158e57d5f43c4afa66386481b82b3c4c3c4..2b75115caf82b9c4ccdd813b98af569e80ac2629 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -86,7 +86,7 @@ public class FishingHook extends Projectile {
Expand Down Expand Up @@ -317,24 +317,11 @@ index bb86260deca1a16795728b8fdec4c9e2da2c221c..5573d6e7c04a3d8d398218d23081f7ab
+ boolean REDUCE_RANDOM = !Boolean.getBoolean("Plazma.doNotReduceRandom");

}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index 6cfdf5a745256774c714d201604d06ff1c7adf7a..78e7583bca7570520264ff880cb112b52d708d5b 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -12,6 +12,8 @@ interface ChangedConfigurations {

Map<NodePath, String> MOVED_WORLD_PATH = new HashMap<>() {{
put(path("structure", "portal", "nether-portal", "size"), "structure.nether-portal");
+ put(path("misc", "reduce-create-random-instance"), "misc.reduce-random");
+ put(path("misc", "suppress-thread-safe-random"), "misc.ignore-thread-safe-random");
}};
NodePath[] REMOVED_WORLD_PATHS = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index ceaf9005336ce229d04df98ae97816846941aa75..71da49901756e379d56a5f24c436a3782d2c230f 100644
index 6a3f454cd3f1ccb3fec9a1e7f5a6411f06f631f0..1b5be3caf97c260799abd7cadec35f776f8890e8 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -43,6 +43,8 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -39,6 +39,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {

Expand All @@ -344,7 +331,7 @@ index ceaf9005336ce229d04df98ae97816846941aa75..71da49901756e379d56a5f24c436a378
}

diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 921d4bd66f399adcb0d5e3bde9a871b4120b9a8e..dbb27a0d5861e81b59d2c54b1f0ba10d12d3b412 100644
index 38b59499053bee3347a2445ec75ba249c4887415..b1409a5312a872b8eb7f7d5cdba1863f0bf51bcf 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -21,6 +21,7 @@ public class WorldConfigurations extends ConfigurationPart {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Subject: [PATCH] Apply various optimizations
Akarin - Swaps the predicate order of collision

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d61d7ae47285d9779221011212f871c4ef7de830..2cc94ddf0b7e45a22a787abbc120efb0fdadf50c 100644
index a13e6d41584a55e3e17d55d568b23f48082750ef..23eb620351ee08cac97e0408f1fc6cee33f036d0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2139,8 +2139,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,22 @@ Subject: [PATCH] Don't refresh LootTable for non player interaction


diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index 765ee7f78532a363813286ef7db2a7e48605cb06..6568aae5ac10b01ffe70ffc26d607fbb6413cbf8 100644
index 02364a148b347e3669275553004391e31d77c0b5..cd2d3707c8e4a313ad15958b2f926be6e05bcd4d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -70,6 +70,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
}

public void unpackLootTable(@Nullable Player player) {
+ if (player == null && org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.refreshLootTableForNonPlayerInteraction) return; // Plazma
if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
if (this.level != null && this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper - don't unpack loot table if not in world
LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable);
if (player instanceof ServerPlayer) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index 78e7583bca7570520264ff880cb112b52d708d5b..48096b0be09c6e99d22e0f3b330d2abf18903dce 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -19,6 +19,7 @@ interface ChangedConfigurations {
};

Map<NodePath, String> MOVED_GLOBAL_PATH = new HashMap<>() {{
+ put(path("misc", "do-not-trigger-loot-table-refresh-for-non-player-interaction"), "misc.refresh-loot-table-for-non-player-interaction");
}};
NodePath[] REMOVED_GLOBAL_PATH = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 71da49901756e379d56a5f24c436a3782d2c230f..2ce8bcb92360f5c93494ccbb21133d980934cbc7 100644
index 1b5be3caf97c260799abd7cadec35f776f8890e8..4e1780d7d6dda6cc38b7d7f7fb735a36352ffb28 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -45,6 +45,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -41,6 +41,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public boolean reduceRandom = OPTIMIZE;
public boolean ignoreThreadSafeRandom = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@ index f74c5eda91a3d521763ec7bc33f23e0c62458cc2..49a8a81c586908278d1e3cbd51dea307
BlockState iblockdata = world.getBlockState(blockposition1);
FluidState fluid = world.getFluidState(blockposition1);

diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index 48096b0be09c6e99d22e0f3b330d2abf18903dce..16bf2bc81d67e28ddb17187eb168b89055ea2994 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -14,6 +14,7 @@ interface ChangedConfigurations {
put(path("structure", "portal", "nether-portal", "size"), "structure.nether-portal");
put(path("misc", "reduce-create-random-instance"), "misc.reduce-random");
put(path("misc", "suppress-thread-safe-random"), "misc.ignore-thread-safe-random");
+ put(path("entity", "monster", "phantom", "dont-load-chunks-to-spawn"), "entity.phantom.load-chunks-to-spawn");
}};
NodePath[] REMOVED_WORLD_PATHS = {
};
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 6331ea8ccce59512f0a5f69e9db929bd6b66a050..50c78bb76c130e228f9160f09c09b0fb6877a040 100644
index b1409a5312a872b8eb7f7d5cdba1863f0bf51bcf..db3460f1ba68f2f8aff5ff2988349a51b353b7d1 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,22 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bf74dd38b5d495f8d2ac6a2072fd95dbdd2f44e4..bec8e400c7eb51a67cfbb775fd9dbb778c18cbd9 100644
index a7e82f95db5c6c054175192f019072006a3ef31f..21def42f813f00c9fbc9c920b9ba61efc5928ef6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1438,6 +1438,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1439,6 +1439,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;

+ if (this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator()) return; // Plazma
+ if (!this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !(org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator())) // Plazma
if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
// Paper start - Add fail move event
diff --git a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
index 16bf2bc81d67e28ddb17187eb168b89055ea2994..5d61009f67df2de88b467d646de624e3f4e5d787 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/ChangedConfigurations.java
@@ -17,6 +17,7 @@ interface ChangedConfigurations {
put(path("entity", "monster", "phantom", "dont-load-chunks-to-spawn"), "entity.phantom.load-chunks-to-spawn");
}};
NodePath[] REMOVED_WORLD_PATHS = {
+ path("misc", "check-spectator-moved-to-quickly")
};

Map<NodePath, String> MOVED_GLOBAL_PATH = new HashMap<>() {{
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 2ce8bcb92360f5c93494ccbb21133d980934cbc7..e053ac807246f9ab636270feb62ac36308012110 100644
index 4e1780d7d6dda6cc38b7d7f7fb735a36352ffb28..ca4f71597118742f3fbbcae24f8a1b3389795996 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -30,6 +30,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -26,6 +26,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Player extends ConfigurationPart {

public boolean allowAnyUsername = false;
Expand Down
Loading

0 comments on commit 39a31e8

Please sign in to comment.