File tree Expand file tree Collapse file tree
main/src/main/java/me/outspending/biomesapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package me .outspending .biomesapi ;
22
3+ import com .google .common .base .Preconditions ;
34import me .outspending .biomesapi .annotations .AsOf ;
45import me .outspending .biomesapi .misc .PointRange2D ;
56import org .bukkit .Chunk ;
2627@ AsOf ("1.2.0" )
2728public interface BiomeUpdater {
2829
30+ /**
31+ * Detects if the server is running Folia by checking for the presence 'io.papermc.paper.threadedregions.RegionizedServer'.
32+ * @since 1.2.0
33+ */
34+ @ AsOf ("1.2.0" )
35+ boolean FOLIA = classExists ("io.papermc.paper.threadedregions.RegionizedServer" );
36+
2937 /**
3038 * Returns an instance of BiomeUpdater.
3139 * This method returns an instance of BiomeUpdaterImpl.
@@ -37,6 +45,7 @@ public interface BiomeUpdater {
3745 @ Deprecated
3846 @ AsOf ("1.2.0" )
3947 static @ NotNull BiomeUpdater of () {
48+ Preconditions .checkArgument (!FOLIA , "Folia detected, please use BiomeUpdater#of(Plugin) instead." );
4049 return new BiomeUpdaterImpl (null );
4150 }
4251
@@ -133,4 +142,13 @@ public interface BiomeUpdater {
133142 @ AsOf ("0.0.15" )
134143 void updateChunksForPlayer (@ NotNull Player player );
135144
145+
146+ private static boolean classExists (String className ) {
147+ try {
148+ Class .forName (className );
149+ return true ;
150+ } catch (ClassNotFoundException e ) {
151+ return false ;
152+ }
153+ }
136154}
Original file line number Diff line number Diff line change 3030 ElementType .TYPE ,
3131 ElementType .CONSTRUCTOR ,
3232 ElementType .MODULE ,
33- ElementType .PACKAGE
33+ ElementType .PACKAGE ,
34+ ElementType .FIELD
3435})
3536@ AsOf ("0.0.1" )
3637public @interface AsOf {
You can’t perform that action at this time.
0 commit comments