9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-29 11:59:11 +00:00

添加限制

This commit is contained in:
XiaoMoMi
2025-06-02 19:50:10 +08:00
parent f0bab0dc87
commit a1fc52f72a
2 changed files with 41 additions and 0 deletions

View File

@@ -1,7 +1,12 @@
package net.momirealms.craftengine.bukkit.plugin;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
public class BukkitCraftEnginePlugin extends JavaPlugin {
private final BukkitCraftEngine plugin;
@@ -18,7 +23,22 @@ public class BukkitCraftEnginePlugin extends JavaPlugin {
@Override
public void onEnable() {
this.plugin.scheduler().asyncRepeating(() -> {
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
if (players.size() > 20) {
for (Player player : players) {
player.sendMessage("Better Together! This server supports 20 players (Community Edition). Want more slots & features? Ask the admin about: » Going CraftEngine Premium Edition!");
}
this.plugin.logger().warn("Glad to see that your server is growing!");
this.plugin.logger().warn("The Community Edition supports up to 20 players. Unlock limitless potential with CraftEngine Premium:");
this.plugin.logger().warn("► Unlimited player capacity");
this.plugin.logger().warn("► Priority support");
this.plugin.logger().warn("► Advanced management tools");
}
}, 1, 1, TimeUnit.MINUTES);
this.plugin.onPluginEnable();
this.plugin.logger().warn("You're using the CraftEngine Community Edition");
this.plugin.logger().warn(" - Maximum player limit is restricted to 20");
}
@Override