1.5.2
This commit is contained in:
parent
f2f89c62bb
commit
329cf2c96f
19 changed files with 33 additions and 8 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,7 +3,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'org.gsdistance'
|
group = 'org.gsdistance'
|
||||||
version = '1.5.1'
|
version = '1.5.2'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
build/libs/GrimmsServer-1.5.2.jar
Normal file
BIN
build/libs/GrimmsServer-1.5.2.jar
Normal file
Binary file not shown.
|
|
@ -4,7 +4,7 @@ description: A spigot plugin made by Grimm and tyuXX, it adds player leveling, a
|
||||||
website: www.gsdistance.org
|
website: www.gsdistance.org
|
||||||
prefix: Grimm's
|
prefix: Grimm's
|
||||||
main: org.gsdistance.grimmsServer.GrimmsServer
|
main: org.gsdistance.grimmsServer.GrimmsServer
|
||||||
version: 1.5.1
|
version: 1.5.2
|
||||||
api-version: 1.20
|
api-version: 1.20
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
commands:
|
commands:
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -27,7 +27,7 @@ public class GStatsTabCompleter implements TabCompleter {
|
||||||
List<String> suggestions = new ArrayList();
|
List<String> suggestions = new ArrayList();
|
||||||
|
|
||||||
for (String subcommand : SUBCOMMANDS) {
|
for (String subcommand : SUBCOMMANDS) {
|
||||||
if (subcommand.startsWith(partial)) {
|
if (subcommand.startsWith(partial) && hasPermissionForSubcommand(sender, subcommand)) {
|
||||||
suggestions.add(subcommand);
|
suggestions.add(subcommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -101,4 +101,13 @@ public class GStatsTabCompleter implements TabCompleter {
|
||||||
|
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasPermissionForSubcommand(CommandSender sender, String subcommand) {
|
||||||
|
return switch (subcommand) {
|
||||||
|
case "self_history" -> sender.hasPermission("grimmsserver.stats.self");
|
||||||
|
case "others_history" -> sender.hasPermission("grimmsserver.stats.other");
|
||||||
|
case "commands" -> true;
|
||||||
|
default -> false;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gsdistance.grimmsServer.Commands;
|
package org.gsdistance.grimmsServer.Commands.GStatsCommand;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
|
@ -16,6 +16,7 @@ public class EntityDeathEvent {
|
||||||
public static void Event(org.bukkit.event.entity.EntityDeathEvent event) {
|
public static void Event(org.bukkit.event.entity.EntityDeathEvent event) {
|
||||||
if (event.getEntity().getType() != EntityType.PLAYER) {
|
if (event.getEntity().getType() != EntityType.PLAYER) {
|
||||||
CustomEntityManager.unregisterEntity(event.getEntity());
|
CustomEntityManager.unregisterEntity(event.getEntity());
|
||||||
|
event.getEntity().setCustomName(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntity().getKiller() != null && event.getEntity().getKiller().getType() == EntityType.PLAYER) {
|
if (event.getEntity().getKiller() != null && event.getEntity().getKiller().getType() == EntityType.PLAYER) {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import org.gsdistance.grimmsServer.Stats.ServerStats;
|
||||||
import org.gsdistance.grimmsServer.Stats.WorldStats;
|
import org.gsdistance.grimmsServer.Stats.WorldStats;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerJoinEvent {
|
public class PlayerJoinEvent {
|
||||||
public PlayerJoinEvent() {
|
public PlayerJoinEvent() {
|
||||||
|
|
@ -48,6 +49,9 @@ public class PlayerJoinEvent {
|
||||||
event.getPlayer().setInvulnerable(true);
|
event.getPlayer().setInvulnerable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize paycheck timer on join to prevent immediate paycheck
|
||||||
|
PlayerTickEvent.initializePaycheckTimer(event.getPlayer());
|
||||||
|
|
||||||
GrimmsServer.historicalStatsManager.recordJoinSnapshot(event.getPlayer());
|
GrimmsServer.historicalStatsManager.recordJoinSnapshot(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public class PlayerTickEvent {
|
||||||
private static final List<Player> magnetPlayers = new ArrayList();
|
private static final List<Player> magnetPlayers = new ArrayList();
|
||||||
private static final Map<Player, Integer> saturationPerkPlayers = new HashMap();
|
private static final Map<Player, Integer> saturationPerkPlayers = new HashMap();
|
||||||
private static final Map<UUID, Long> playerLoginTimes = new HashMap();
|
private static final Map<UUID, Long> playerLoginTimes = new HashMap();
|
||||||
|
private static final Map<UUID, Long> lastPaycheckTimes = new HashMap();
|
||||||
private static final long LOGIN_KICK_TIMEOUT_MS = 60000L; // 60 seconds
|
private static final long LOGIN_KICK_TIMEOUT_MS = 60000L; // 60 seconds
|
||||||
private static final long TITLE_CHECK_INTERVAL_MS = 50000L; // ~50 seconds (was 1000 ticks)
|
private static final long TITLE_CHECK_INTERVAL_MS = 50000L; // ~50 seconds (was 1000 ticks)
|
||||||
private static final long PAYCHECK_INTERVAL_MS = 1200000L; // ~20 minutes (was 24000 ticks)
|
private static final long PAYCHECK_INTERVAL_MS = 1200000L; // ~20 minutes (was 24000 ticks)
|
||||||
|
|
@ -51,13 +52,14 @@ public class PlayerTickEvent {
|
||||||
saturationPerkPlayers.remove(player);
|
saturationPerkPlayers.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track player login time for real-time kick timer
|
long currentTime = System.currentTimeMillis();
|
||||||
UUID playerId = player.getUniqueId();
|
UUID playerId = player.getUniqueId();
|
||||||
|
|
||||||
|
// Track player login time for real-time kick timer
|
||||||
if (!playerLoginTimes.containsKey(playerId)) {
|
if (!playerLoginTimes.containsKey(playerId)) {
|
||||||
playerLoginTimes.put(playerId, System.currentTimeMillis());
|
playerLoginTimes.put(playerId, currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
long currentTime = System.currentTimeMillis();
|
|
||||||
long loginTime = playerLoginTimes.get(playerId);
|
long loginTime = playerLoginTimes.get(playerId);
|
||||||
|
|
||||||
// Real-time login kick check
|
// Real-time login kick check
|
||||||
|
|
@ -77,7 +79,8 @@ public class PlayerTickEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paycheck (was every 24000 ticks, now every ~20 minutes)
|
// Paycheck (was every 24000 ticks, now every ~20 minutes)
|
||||||
if ((currentTime - loginTime) % PAYCHECK_INTERVAL_MS < 50L) {
|
long lastPaycheckTime = lastPaycheckTimes.getOrDefault(playerId, 0L);
|
||||||
|
if ((currentTime - lastPaycheckTime) >= PAYCHECK_INTERVAL_MS) {
|
||||||
PlayerStats playerStats = PlayerStats.getPlayerStats(player);
|
PlayerStats playerStats = PlayerStats.getPlayerStats(player);
|
||||||
String jobTitleId = playerStats.getStat("jobTitle", String.class);
|
String jobTitleId = playerStats.getStat("jobTitle", String.class);
|
||||||
if (jobTitleId != null && !jobTitleId.isEmpty()) {
|
if (jobTitleId != null && !jobTitleId.isEmpty()) {
|
||||||
|
|
@ -85,6 +88,7 @@ public class PlayerTickEvent {
|
||||||
double payCheck = Math.ceil(JobTitlesBaseValues.jobTitleBaseValues.getOrDefault(jobTitleId, null).paycheckSize() * multiplier);
|
double payCheck = Math.ceil(JobTitlesBaseValues.jobTitleBaseValues.getOrDefault(jobTitleId, null).paycheckSize() * multiplier);
|
||||||
playerStats.setStat("money", playerStats.getStat("money", Double.class) + payCheck);
|
playerStats.setStat("money", playerStats.getStat("money", Double.class) + payCheck);
|
||||||
player.sendMessage(ChatColor.GREEN + "You have received your paycheck: " + ChatColor.GOLD + Shared.formatNumber(payCheck));
|
player.sendMessage(ChatColor.GREEN + "You have received your paycheck: " + ChatColor.GOLD + Shared.formatNumber(payCheck));
|
||||||
|
lastPaycheckTimes.put(playerId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,5 +110,11 @@ public class PlayerTickEvent {
|
||||||
|
|
||||||
public static void onPlayerQuit(Player player) {
|
public static void onPlayerQuit(Player player) {
|
||||||
playerLoginTimes.remove(player.getUniqueId());
|
playerLoginTimes.remove(player.getUniqueId());
|
||||||
|
lastPaycheckTimes.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initializePaycheckTimer(Player player) {
|
||||||
|
UUID playerId = player.getUniqueId();
|
||||||
|
lastPaycheckTimes.put(playerId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import org.gsdistance.grimmsServer.Commands.GLogCommand.GLogBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GLogCommand.GLogTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GLogCommand.GLogTabCompleter;
|
||||||
import org.gsdistance.grimmsServer.Commands.GStatsCommand.GStatsBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.GStatsCommand.GStatsBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GStatsCommand.GStatsTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GStatsCommand.GStatsTabCompleter;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GStatsCommand.SetPlayerStat;
|
||||||
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilTabCompleter;
|
||||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.HomeBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.HomeCommand.HomeBaseCommand;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue