feat: add global & server leveling, quests, achievements, guilds land-claiming, social & toggleable configs
This commit is contained in:
1 parent
4b79f69c20
commit
b4cef85b1f
40 files changed
+10261
-27
No files matched your search
@@ -19,8 +19,22 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
saveDefaultConfig();
|
||||
try {
|
||||
Settings settings = Settings.of(
|
||||
getConfig().getString("panel-url", ""),
|
||||
getConfig().getString("token", ""),
|
||||
getConfig().getBoolean("leveling.enabled", true),
|
||||
getConfig().getDouble("leveling.global-xp-multiplier", 1.0),
|
||||
getConfig().getDouble("leveling.server-xp-multiplier", 1.5),
|
||||
getConfig().getBoolean("quests.enabled", true),
|
||||
getConfig().getBoolean("achievements.enabled", true),
|
||||
getConfig().getBoolean("guilds.enabled", true),
|
||||
getConfig().getBoolean("guilds.land-claiming", true),
|
||||
getConfig().getBoolean("social.enabled", true),
|
||||
getConfig().getBoolean("social.chat-prefixes", true)
|
||||
);
|
||||
|
||||
integration = new Integration(
|
||||
Settings.of(getConfig().getString("panel-url", ""), getConfig().getString("token", "")),
|
||||
settings,
|
||||
getServer().getName(), Bukkit.getBukkitVersion().split("-")[0], getDescription().getVersion(),
|
||||
Bukkit.getOnlineMode(), Bukkit.getMaxPlayers(), getLogger()::warning,
|
||||
(id, message) -> {
|
||||
@@ -33,6 +47,12 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
Bukkit.getScheduler().runTaskTimer(this, integration::tick, 1, 1);
|
||||
// Reloading an auth plugin cannot silently admit existing sessions.
|
||||
for (Player player : Bukkit.getOnlinePlayers()) player.kickPlayer("SCOPENET restarted. Please reconnect.");
|
||||
getLogger().info("SCOPENET integration initialized. Configured modules:");
|
||||
getLogger().info(" - Leveling: " + (settings.levelingEnabled() ? "ENABLED" : "DISABLED"));
|
||||
getLogger().info(" - Quests: " + (settings.questsEnabled() ? "ENABLED" : "DISABLED"));
|
||||
getLogger().info(" - Achievements: " + (settings.achievementsEnabled() ? "ENABLED" : "DISABLED"));
|
||||
getLogger().info(" - Guilds & Land Claiming: " + (settings.guildsEnabled() && settings.landClaimingEnabled() ? "ENABLED" : "DISABLED"));
|
||||
getLogger().info(" - Social: " + (settings.socialEnabled() ? "ENABLED" : "DISABLED"));
|
||||
} catch (Exception e) {
|
||||
getLogger().severe("SCOPENET is blocking joins: " + e.getMessage());
|
||||
for (Player player : Bukkit.getOnlinePlayers()) player.kickPlayer(Integration.UNAVAILABLE);
|
||||
@@ -68,17 +88,43 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
}
|
||||
|
||||
private void add(Player player, String stat) {
|
||||
if (integration != null) integration.activity.add(player.getUniqueId(), player.getName(), stat, 1);
|
||||
if (integration != null && integration.settings().levelingEnabled()) {
|
||||
integration.activity.add(player.getUniqueId(), player.getName(), stat, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void broken(BlockBreakEvent event) {
|
||||
if (integration != null && integration.settings().guildsEnabled() && integration.settings().landClaimingEnabled()) {
|
||||
Chunk chunk = event.getBlock().getChunk();
|
||||
ChunkCheckResult check = integration.checkChunk(event.getBlock().getWorld().getName(), chunk.getX(), chunk.getZ(), event.getPlayer().getUniqueId());
|
||||
if (check.claimed() && !check.allowed()) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "This chunk is claimed by [" + check.guildTag() + "] " + check.guildName() + "!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
add(event.getPlayer(), "blocks_broken");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void placed(BlockPlaceEvent event) {
|
||||
if (integration != null && integration.settings().guildsEnabled() && integration.settings().landClaimingEnabled()) {
|
||||
Chunk chunk = event.getBlock().getChunk();
|
||||
ChunkCheckResult check = integration.checkChunk(event.getBlock().getWorld().getName(), chunk.getX(), chunk.getZ(), event.getPlayer().getUniqueId());
|
||||
if (check.claimed() && !check.allowed()) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "This chunk is claimed by [" + check.guildTag() + "] " + check.guildName() + "!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
add(event.getPlayer(), "blocks_placed");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void broken(BlockBreakEvent event) { add(event.getPlayer(), "blocks_broken"); }
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void placed(BlockPlaceEvent event) { add(event.getPlayer(), "blocks_placed"); }
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void chat(AsyncPlayerChatEvent event) { add(event.getPlayer(), "messages"); }
|
||||
public void chat(AsyncPlayerChatEvent event) {
|
||||
add(event.getPlayer(), "messages");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void command(PlayerCommandPreprocessEvent event) {
|
||||
@@ -87,7 +133,7 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void statistic(PlayerStatisticIncrementEvent event) {
|
||||
if (integration == null) return;
|
||||
if (integration == null || !integration.settings().levelingEnabled()) return;
|
||||
String item = event.getMaterial() != null ? ":" + event.getMaterial().name()
|
||||
: event.getEntityType() != null ? ":" + event.getEntityType().name() : "";
|
||||
integration.activity.action(event.getPlayer().getUniqueId(), event.getPlayer().getName(),
|
||||
@@ -103,6 +149,7 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void advancement(PlayerAdvancementDoneEvent event) {
|
||||
if (integration == null || !integration.settings().achievementsEnabled()) return;
|
||||
audit(event.getPlayer(), "advancement", event.getAdvancement().getKey().toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,44 @@
|
||||
# Create a server under Servers in the panel, then paste its token here.
|
||||
# ==============================================================================
|
||||
# SCOPENET Minecraft Server Configuration
|
||||
# ==============================================================================
|
||||
# Connect to your SCOPENET Panel instance by pasting your server token below.
|
||||
# Create a server under 'Servers' in the web panel to generate a token.
|
||||
|
||||
panel-url: "https://panel.example.com"
|
||||
token: ""
|
||||
|
||||
# ==============================================================================
|
||||
# Feature Toggles
|
||||
# Every system below is fully toggleable. You do not need to force all features
|
||||
# on every server—turn on only what makes sense for your server's gameplay style.
|
||||
# ==============================================================================
|
||||
|
||||
leveling:
|
||||
# Global & Server leveling progression (tracks playtime, kills, mining, etc.)
|
||||
enabled: true
|
||||
# Multiplier for account-wide Global Level XP (1.0 = standard speed)
|
||||
global-xp-multiplier: 1.0
|
||||
# Multiplier for this server's specific Server Level XP (1.5 = 1.5x speed)
|
||||
server-xp-multiplier: 1.5
|
||||
|
||||
quests:
|
||||
# Daily and Weekly quests progression tracking
|
||||
enabled: true
|
||||
|
||||
achievements:
|
||||
# Minecraft-themed achievements and milestone unlock notifications
|
||||
enabled: true
|
||||
|
||||
guilds:
|
||||
# Guilds partying system and /guild commands
|
||||
enabled: true
|
||||
# FTB Chunks-style chunk land-claiming and protection against other guilds
|
||||
land-claiming: true
|
||||
# Allow guild members to damage each other (PvP friendly fire)
|
||||
friendly-fire: false
|
||||
|
||||
social:
|
||||
# Friends status, direct messaging bridge, and server game invites
|
||||
enabled: true
|
||||
# Show player guild tag and level title in chat formatting
|
||||
chat-prefixes: true
|
||||
Reference in new issue
Block a user