1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

Separating jtop_name into jtop_displayname placeholder for name and

displayname accordingly
This commit is contained in:
Zrips 2023-06-16 12:42:16 +03:00
parent 3022d7cfa5
commit 260470406e
4 changed files with 25 additions and 3 deletions

View File

@ -286,7 +286,7 @@
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
<configuration> <configuration>
<outputDirectory>D:\MC\Server 1.19\plugins\</outputDirectory> <outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -164,7 +164,7 @@ public final class Jobs extends JavaPlugin {
private static boolean hasLimitedItems = false; private static boolean hasLimitedItems = false;
private static final int MAX_ENTRIES = 5; private static final int MAX_ENTRIES = 20;
public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) { public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) {
protected boolean removeEldestEntry(Map.Entry<UUID, FastPayment> eldest) { protected boolean removeEldestEntry(Map.Entry<UUID, FastPayment> eldest) {
return size() > MAX_ENTRIES; return size() > MAX_ENTRIES;

View File

@ -88,6 +88,7 @@ public class Placeholder {
user_archived_jobs_exp_$1("jname/number"), user_archived_jobs_exp_$1("jname/number"),
jtop_name_$1_$2("jname/number", "[1-15]"), jtop_name_$1_$2("jname/number", "[1-15]"),
jtop_displayname_$1_$2("jname/number", "[1-15]"),
jtop_level_$1_$2("jname/number", "[1-15]"), jtop_level_$1_$2("jname/number", "[1-15]"),
maxjobs, maxjobs,
@ -616,6 +617,26 @@ public class Placeholder {
List<TopList> list = Jobs.getJobsDAO().getTopListByJob(jo, 15); List<TopList> list = Jobs.getJobsDAO().getTopListByJob(jo, 15);
if (list.size() < place)
return "";
return list.get(place - 1).getPlayerInfo().getName();
case jtop_displayname_$1_$2:
if (values.size() < 2)
return "";
place = 0;
try {
place = Integer.parseInt(values.get(1));
} catch (NumberFormatException e) {
return "";
}
if (place < 1)
return "";
list = Jobs.getJobsDAO().getTopListByJob(jo, 15);
if (list.size() < place) if (list.size() < place)
return ""; return "";

View File

@ -1838,8 +1838,9 @@ public final class JobsPaymentListener implements Listener {
// either it's version 1.13+ and we're trying to strip a normal log like oak, // either it's version 1.13+ and we're trying to strip a normal log like oak,
// or it's 1.16+ and we're trying to strip a fungi like warped stem // or it's 1.16+ and we're trying to strip a fungi like warped stem
if ((Version.isCurrentEqualOrHigher(Version.v1_13_R1) && (block.getType().toString().endsWith("_LOG") || block.getType().toString().endsWith("_WOOD"))) || if ((Version.isCurrentEqualOrHigher(Version.v1_13_R1) && (block.getType().toString().endsWith("_LOG") || block.getType().toString().endsWith("_WOOD"))) ||
(Version.isCurrentEqualOrHigher(Version.v1_16_R1) && (block.getType().toString().endsWith("_STEM") || block.getType().toString().endsWith("_HYPHAE")))) (Version.isCurrentEqualOrHigher(Version.v1_16_R1) && (block.getType().toString().endsWith("_STEM") || block.getType().toString().endsWith("_HYPHAE")))) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1);
}
} }
} }