From c2cefe784a1019a617ecff92eafc763ab7123374 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Tue, 2 Jul 2019 14:27:06 +0200 Subject: [PATCH] Temporary level down message More options will be added later --- .../com/gamingmesh/jobs/PlayerManager.java | 30 +++++++++++++++++++ .../jobs/config/LanguageManager.java | 1 + src/main/resources/locale/messages_hu.yml | 2 ++ 3 files changed, 33 insertions(+) diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 92eaaa74..de5e47ad 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -529,6 +529,36 @@ public class PlayerManager { if (prog == null) return; + // when the player loses income + if (prog.getLevel() < oldLevel) { + String message = Jobs.getLanguage().getMessage("message.leveldown.message"); + + message = message.replace("%jobname%", job.getChatColor() + job.getName()); + + if (player != null) + message = message.replace("%playername%", player.getDisplayName()); + else + message = message.replace("%playername%", jPlayer.getUserName()); + + message = message.replace("%joblevel%", "" + prog.getLevel()); + + if (player != null) { + for (String line : message.split("\n")) { + if (Jobs.getGCManager().LevelChangeActionBar) + Jobs.getActionBar().send(player, line); + if (Jobs.getGCManager().LevelChangeChat) + player.sendMessage(line); + } + } + + jPlayer.reloadHonorific(); + Jobs.getPermissionHandler().recalculatePermissions(jPlayer); + performCommandOnLevelUp(jPlayer, prog.getJob(), oldLevel); + Jobs.getSignUtil().SignUpdate(job.getName()); + Jobs.getSignUtil().SignUpdate("gtoplist"); + return; + } + // LevelUp event JobsLevelUpEvent levelUpEvent = new JobsLevelUpEvent( jPlayer, diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 671d1d33..2e627192 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -634,6 +634,7 @@ public class LanguageManager { c.get("message.levelup.broadcast", "%playername% is now a level %joblevel% %jobname%."); c.get("message.levelup.nobroadcast", "You are now level %joblevel% %jobname%."); + c.get("message.leveldown.message", "&cYou lost leve in&e %jobname%&c job! Level:&6 %joblevel%&c."); c.get("message.cowtimer", "&eYou still need to wait &6%time% &esec to get paid for this job."); c.get("message.blocktimer", "&eYou need to wait &3[time] &esec more to get paid for this!"); diff --git a/src/main/resources/locale/messages_hu.yml b/src/main/resources/locale/messages_hu.yml index 1b26dce3..c114464c 100644 --- a/src/main/resources/locale/messages_hu.yml +++ b/src/main/resources/locale/messages_hu.yml @@ -603,6 +603,8 @@ message: levelup: broadcast: '%playername% %joblevel% szintet lépett a(z) %jobname% munkában.' nobroadcast: '&aSzintet léptél a(z) %jobname% &amunkában! Szint:&6 %joblevel%&a.' + leveldown: + message: '&cSzintet estél a(z)&e %jobname%&c munkában! Szint:&6 %joblevel%&c.' cowtimer: '&eMég várnod kell &6%time% &emásodpercet, hogy fizesse ezt a munkát.' blocktimer: '&eKérlek, várj &3[time] &emásodpercet, hogy újra küldjön pénzt!' placeblocktimer: '&eNem lehet gyorsabban lerakni blokkokat &6[time] &esec intervallumot ugyanazon a helyen!'