Skip to content

Commit

Permalink
Release 2.5.6 (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs authored Jan 8, 2024
2 parents 8ae24a2 + 281a59d commit 77c4a91
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/javadocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_nexus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "de.eldoria"
version = "2.5.5"
version = "2.5.6"

var publishModules = setOf("schematicbrushreborn-api",
"schematicbrushreborn-core",
Expand Down Expand Up @@ -67,7 +67,7 @@ allprojects {
}
compileOnly(libs.fawe.bukkit)

testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation(platform("org.junit:junit-bom:5.10.1"))
testImplementation("org.junit.jupiter", "junit-jupiter")
testImplementation(testlibs.mockbukkit)
testImplementation(libs.worldedit) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ default boolean isOutOfRenderRange(Location origin, Location other) {
* @return the effective render size in blocks
*/
int maxEffectiveRenderSize();

int pasteBreak();
}
4 changes: 3 additions & 1 deletion schematicbrushreborn-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ dependencies {
compileOnly(libs.jackson.yaml)
compileOnly(libs.adventure.bukkit)
compileOnly(libs.adventure.minimessage)
compileOnly("org.apache.logging.log4j", "log4j-slf4j2-impl", "2.22.1")
compileOnly("org.apache.logging.log4j", "log4j-core", "2.22.1")

testImplementation(project(":schematicbrushreborn-api"))
testImplementation(libs.jetbrains.annotations)
testImplementation("org.mockito", "mockito-core", "5.6.0")
testImplementation("org.mockito", "mockito-core", "5.8.0")
testImplementation(libs.jackson.databind)
}
publishData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@
import de.eldoria.schematicbrush.storage.StorageRegistryImpl;
import de.eldoria.schematicbrush.storage.YamlStorage;
import de.eldoria.schematicbrush.storage.preset.Preset;
import de.eldoria.schematicbrush.util.InternalLogger;
import de.eldoria.schematicbrush.util.Permissions;
import org.apache.logging.log4j.LogManager;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.jetbrains.annotations.NotNull;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.*;

import java.io.File;
import java.util.Arrays;
Expand Down Expand Up @@ -110,6 +114,9 @@ public SchematicBrushRebornImpl(@NotNull JavaPluginLoader loader, @NotNull Plugi

@Override
public void onPluginLoad() throws Throwable {
InternalLogger.init(this);
getLogger().config("Test");

settingsRegistry = new BrushSettingsRegistryImpl();
schematics = new SchematicRegistryImpl();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class GeneralConfigImpl implements GeneralConfig {
private int maxRenderSize = 2500;
private int maxEffectiveRenderSize = maxRenderSize;
private int renderDistance = 100;
private int pasteBreak = 20;

public GeneralConfigImpl() {
}
Expand All @@ -43,6 +44,7 @@ public GeneralConfigImpl(Map<String, Object> objectMap) {
maxEffectiveRenderSize = map.getValueOrDefault("maxEffectiveRenderSize", maxRenderSize);
renderDistance = map.getValueOrDefault("renderDistance", 100);
storageType = map.getValueOrDefault("storageType", StorageRegistry.YAML.name());
pasteBreak = map.getValueOrDefault("pasteBreak", pasteBreak);
}

@Override
Expand All @@ -58,6 +60,7 @@ public GeneralConfigImpl(Map<String, Object> objectMap) {
.add("maxEffectiveRenderSize", maxEffectiveRenderSize)
.add("renderDistance", renderDistance)
.add("storageType", storageType)
.add("pasteBreak", pasteBreak)
.build();
}

Expand Down Expand Up @@ -116,4 +119,9 @@ public int maxEffectiveRenderSize() {
return maxEffectiveRenderSize;
}

@Override
public int pasteBreak() {
return pasteBreak;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ private void resolveBlocked(Player player) {
public void onPostPaste(PostPasteEvent event) {
if (!players.contains(event.player())) return;

// Remove the player from the block after a second aka 20 ticks
plugin.getServer().getScheduler().runTaskLater(plugin, () -> skip.remove(event.player().getUniqueId()), 20);
// Remove the player from the block after a second aka 20 ticks by default
plugin.getServer().getScheduler().runTaskLater(plugin, () -> skip.remove(event.player().getUniqueId()), configuration.general().pasteBreak());
}

@Override
Expand Down Expand Up @@ -155,6 +155,8 @@ private void handlePlayerTick(Player player) {
render(player);
} else if (sinks.containsKey(player.getUniqueId())) {
resolveBlocked(player);
}else {
getSink(player).skipped();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class RenderSink {
private final Configuration configuration;
private long flushed = System.currentTimeMillis();
private final RollingQueue<Integer> batchSize = new RollingQueue<>(1200);
private final RollingQueue<Integer> skipped = new RollingQueue<>(1200);

public RenderSink(Player sinkOwner, PacketWorker worker, Configuration configuration) {
this.sinkOwner = sinkOwner.getUniqueId();
Expand Down Expand Up @@ -150,6 +151,7 @@ public void push(Changes newChanges) {
oldChanges = this.newChanges;
this.newChanges = newChanges;
dirty = true;
skipped.add(0);
}

public int pushAndSend(Changes newChanges) {
Expand Down Expand Up @@ -220,11 +222,18 @@ public String info() {
%s
Batch Size:
%s
Skipped ticks:
%s
""".stripIndent()
.formatted(player.map(Player::getName).orElse("none"),
size(),
subscribers.stream().map(Player::getName).map(" %s"::formatted).collect(Collectors.joining("\n")),
player.flatMap(WorldEditBrush::getSchematicBrush).map(SchematicBrush::info).orElse("non").indent(2),
Text.inlineEntries(batchSize.values(), 20).indent(2));
Text.inlineEntries(batchSize.values(), 20).indent(2),
Text.inlineEntries(skipped.values(), 20).indent(2));
}

public void skipped() {
skipped.add(1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
*
* Copyright (C) EldoriaRPG Team and Contributor
*/

package de.eldoria.schematicbrush.util;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.RollingFileAppender;
import org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy;
import org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.bukkit.plugin.Plugin;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Set;
import java.util.zip.Deflater;

public class InternalLogger {
public static void init(Plugin plugin) {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
org.apache.logging.log4j.core.config.Configuration config = context.getConfiguration();

Path logfile = plugin.getDataFolder().toPath().resolve("logs").resolve("latest.log");
try {
Files.createDirectories(logfile.getParent());
plugin.getLogger().info("Created directory");
} catch (IOException e) {
plugin.getLogger().log(java.util.logging.Level.SEVERE, "Could not create directory for logs", e);
}
// Create a new RollingFileAppender
RollingFileAppender appender = RollingFileAppender.newBuilder()
.withFileName(logfile.toString())
.withFilePattern("logs/log-%d{yyyy-MM-dd}.log.gz")
.withPolicy(TimeBasedTriggeringPolicy.newBuilder().withInterval(1).withModulate(true).build())
.withStrategy(DefaultRolloverStrategy.newBuilder().withMin("1").withCompressionLevelStr(String.valueOf(Deflater.DEFAULT_COMPRESSION)).build())
.setLayout(PatternLayout.newBuilder().withPattern("[%d{HH:mm:ss]}[%p{length=4}][%logger] %msg%ex%n").build())
.setName(plugin.getName())
.build();
appender.start();

config.addAppender(appender);
config.getRootLogger().addAppender(appender, Level.ALL, new NameFilter(Set.of("SchematicBrushReborn")));

context.updateLoggers();
}

static class NameFilter extends AbstractFilter {
private final Set<String> whitelist;

public NameFilter(Set<String> whitelist) {
this.whitelist = whitelist;
}

@Override
public Result filter(LogEvent event) {
if (whitelist.contains(event.getLoggerName())) return Result.ACCEPT;
for (String s : whitelist) {
if (event.getLoggerName().startsWith(s)) return Result.ACCEPT;
}
return Result.DENY;
}
}
}
2 changes: 1 addition & 1 deletion schematicbrushreborn-paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bukkit {
apiVersion = "1.16"
main = "de.eldoria.schematicbrush.SchematicBrushRebornImpl"
authors = listOf("RainbowDashLabs", "SirYwell", "LuftigerLuca")
website = "https://www.spigotmc.org/resources/98499/"
website = "https://sbr.discord.eldoria.de"
depend = listOf("WorldEdit")
softDepend = listOf("ProtocolLib")

Expand Down
12 changes: 6 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ dependencyResolutionManagement {
bundle("jackson", listOf("jackson-databind", "jackson-annotations", "jackson-yaml"))

// adventure
library("adventure-bukkit", "net.kyori:adventure-platform-bukkit:4.3.1")
library("adventure-minimessage", "net.kyori:adventure-text-minimessage:4.14.0")
library("adventure-bukkit", "net.kyori:adventure-platform-bukkit:4.3.2")
library("adventure-minimessage", "net.kyori:adventure-text-minimessage:4.15.0")
// utilities
library("eldoutil-legacy", "de.eldoria:eldo-util:1.14.4")
library("eldoutil-jackson", "de.eldoria.util:jackson-configuration:2.0.3")
library("messageblocker", "de.eldoria:messageblocker:1.1.2")
// misc
library("jetbrains-annotations", "org.jetbrains:annotations:24.0.1")
library("jetbrains-annotations", "org.jetbrains:annotations:24.1.0")
// minecraft
version("minecraft-latest", "1.20.1-R0.1-SNAPSHOT")
library("paper-latest", "io.papermc.paper", "paper-api").version("minecraft-latest")
Expand All @@ -45,14 +45,14 @@ dependencyResolutionManagement {
library("paper-v17", "io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
library("spigot-v16", "io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
// world edit
library("worldedit", "com.sk89q.worldedit:worldedit-bukkit:7.2.17")
version("fawe", "2.8.1")
library("worldedit", "com.sk89q.worldedit:worldedit-bukkit:7.2.18")
version("fawe", "2.8.4")
library("fawe-core", "com.fastasyncworldedit","FastAsyncWorldEdit-Core").versionRef("fawe")
library("fawe-bukkit", "com.fastasyncworldedit","FastAsyncWorldEdit-Bukkit").versionRef("fawe")

// plugins
plugin("publishdata", "de.chojo.publishdata").version("1.2.5")
plugin("spotless", "com.diffplug.spotless").version("6.22.0")
plugin("spotless", "com.diffplug.spotless").version("6.23.3")
plugin("shadow", "com.github.johnrengelman.shadow").version("8.1.1")
plugin("pluginyml-bukkit", "net.minecrell.plugin-yml.bukkit").version("0.6.0")
//plugin("pluginyml-paper","net.minecrell.plugin-yml.paper").version( "0.5.3")
Expand Down

0 comments on commit 77c4a91

Please sign in to comment.