Skip to content

Commit

Permalink
Merge branch 'main' into feature/hikari-cp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeinerLP authored Jun 18, 2023
2 parents 9326799 + 9d43434 commit fd68e22
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ body:
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false
options:
- '1.20.1'
- '1.20'
- '1.19.4'
- '1.19.3'
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish core javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
# if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
Expand All @@ -54,7 +54,7 @@ jobs:
target-branch: main
target-directory: v7/core
- name: Publish bukkit javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
# if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.HeightMap;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.World;
import org.bukkit.block.Biome;
Expand All @@ -50,10 +51,12 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;

import static java.util.function.Predicate.not;

public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {

Expand Down Expand Up @@ -287,7 +290,7 @@ public int getBaseHeight(
*/
@SuppressWarnings("deprecation") // The entire method is deprecated, but kept for compatibility with <=1.16.2
@Override
@Deprecated(since = "TODO")
@Deprecated(since = "7.0.0")
public @NonNull ChunkData generateChunkData(
@NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome
) {
Expand Down Expand Up @@ -437,9 +440,16 @@ private final class BukkitPlotBiomeProvider extends BiomeProvider {
private static final List<Biome> BIOMES;

static {
Set<Biome> disabledBiomes = EnumSet.of(Biome.CUSTOM);
if (PlotSquared.platform().serverVersion()[1] <= 19) {
final Biome cherryGrove = Registry.BIOME.get(NamespacedKey.minecraft("cherry_grove"));
if (cherryGrove != null) {
disabledBiomes.add(cherryGrove);
}
}
BIOMES = Arrays.stream(Biome.values())
.filter(b -> Registry.BIOME.get(b.getKey()) != null)
.collect(Collectors.toList());
.filter(not(disabledBiomes::contains))
.toList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* MiniMessage changed the syntax between major releases. To warrant a smooth upgrade, we attempt to replace any occurrences
* while loading PlotSquared.
*
* @since TODO
* @since 7.0.0
*/
@NotPublic
public class TranslationUpdateManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface Caption {
*
* @param localeHolder Locale holder
* @return {@link ComponentLike}
* @since TODO
* @since 7.0.0
*/
@NonNull Component toComponent(@NonNull LocaleHolder localeHolder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Caption get() {
* Get the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
*
* @return The tag resolvers to use.
* @since TODO
* @since 7.0.0
*/
public TagResolver[] getTagResolvers() {
return this.tagResolvers;
Expand All @@ -61,7 +61,7 @@ public TagResolver[] getTagResolvers() {
* Set the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
*
* @param tagResolvers The tag resolvers to use.
* @since TODO
* @since 7.0.0
*/
public void setTagResolvers(TagResolver... tagResolvers) {
this.tagResolvers = tagResolvers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.ParsingException;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Set;
import java.util.regex.Pattern;

import static com.plotsquared.core.configuration.caption.ComponentTransform.nested;
import static com.plotsquared.core.configuration.caption.ComponentTransform.stripClicks;

public class CaptionUtility {

private static final Pattern LEGACY_FORMATTING = Pattern.compile("§[a-gklmnor0-9]");

// flags which values are parsed by minimessage
private static final Set<Class<? extends PlotFlag<?, ?>>> MINI_MESSAGE_FLAGS = Set.of(
GreetingFlag.class,
Expand Down Expand Up @@ -100,7 +104,14 @@ public static String format(
*/
public static String stripClickEvents(final @NonNull String miniMessageString) {
// parse, transform and serialize again
Component component = MiniMessage.miniMessage().deserialize(miniMessageString);
Component component;
try {
component = MiniMessage.miniMessage().deserialize(miniMessageString);
} catch (ParsingException e) {
// if the String cannot be parsed, we try stripping legacy colors
String legacyStripped = LEGACY_FORMATTING.matcher(miniMessageString).replaceAll("");
component = MiniMessage.miniMessage().deserialize(legacyStripped);
}
component = CLICK_STRIP_TRANSFORM.transform(component);
return MiniMessage.miniMessage().serialize(component);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class IndependentPlotGenerator {
* @param result Queue to write to
* @param settings PlotArea (settings)
* @param biomes If biomes should be generated
* @since TODO
* @since 7.0.0
*/
public abstract void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes);

Expand All @@ -55,7 +55,7 @@ public abstract class IndependentPlotGenerator {
*
* @param result Queue to write to
* @param setting PlotArea (settings)
* @since TODO
* @since 7.0.0
*/
public void populateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea setting) {
}
Expand Down Expand Up @@ -108,7 +108,7 @@ public <T> GeneratorWrapper<T> specify(final @NonNull String world) {
* @param y World y position
* @param z World z position
* @return Biome type to be generated
* @since TODO
* @since 7.0.0
*/
public abstract BiomeType getBiome(PlotArea settings, int x, int y, int z);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static <T, F extends PlotFlag<T, F>> String getFlagName(Class<F> flagClas
* Gets the flag name as a Kyori {@link Component}
*
* @see #getFlagName(Class)
* @since TODO
* @since 7.0.0
*/
public static <T, F extends PlotFlag<T, F>> Component getFlagNameComponent(Class<F> flagClass) {
return Component.text(getFlagName(flagClass));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public interface PlotAreaManager {
*
* @param worldName Name of the world to add
* @return {@code true} if successful, {@code false} if world already existed
* @since TODO
* @since 7.0.0
*/
boolean addWorld(@NonNull String worldName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public QueueCoordinator(@Nullable World world) {
* @param x chunk x coordinate
* @param z chunk z coordinate
* @return a new {@link ZeroedDelegateScopedQueueCoordinator}
* @since TODO
* @since 7.0.0
*/
public ZeroedDelegateScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
int bx = x << 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* zero in the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to
* x and z.
*
* @since TODO
* @since 7.0.0
*/
public class ZeroedDelegateScopedQueueCoordinator extends DelegateQueueCoordinator {

Expand All @@ -50,7 +50,7 @@ public class ZeroedDelegateScopedQueueCoordinator extends DelegateQueueCoordinat
/**
* Create a new ScopedQueueCoordinator instance that delegates to a given QueueCoordinator. Locations are inclusive.
*
* @since TODO
* @since 7.0.0
*/
public ZeroedDelegateScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
super(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public abstract class ChunkManager {
private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();

/**
* @since TODO
* @since 7.0.0
*/
public static void setChunkInPlotArea(
RunnableVal<ZeroedDelegateScopedQueueCoordinator> force,
Expand Down Expand Up @@ -76,7 +76,7 @@ public static void setChunkInPlotArea(
}

/**
* @since TODO
* @since 7.0.0
*/
public static boolean preProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
Expand All @@ -89,7 +89,7 @@ public static boolean preProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueu
}

/**
* @since TODO
* @since 7.0.0
*/
public static boolean postProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> addChunk = forceChunks.get(loc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* A utility class for modifying components.
*
* @since TODO
* @since 7.0.0
*/
public class ComponentHelper {

Expand All @@ -37,7 +37,7 @@ public class ComponentHelper {
* @param components The components to join
* @param delimiter The delimiter to use between the components
* @return The joined components
* @since TODO
* @since 7.0.0
*/
public static ComponentLike join(Collection<? extends ComponentLike> components, Component delimiter) {
return join(components.toArray(ComponentLike[]::new), delimiter);
Expand All @@ -49,7 +49,7 @@ public static ComponentLike join(Collection<? extends ComponentLike> components,
* @param components The components to join
* @param delimiter The delimiter to use between the components
* @return The joined components
* @since TODO
* @since 7.0.0
*/
public static Component join(ComponentLike[] components, Component delimiter) {
TextComponent.Builder builder = Component.text();
Expand Down

0 comments on commit fd68e22

Please sign in to comment.