-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
JobsBridge.java
61 lines (55 loc) · 3.29 KB
/
JobsBridge.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.denizenscript.depenizen.bukkit.bridges;
import com.denizenscript.denizencore.DenizenCore;
import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.denizencore.objects.ObjectFetcher;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.objects.core.ListTag;
import com.denizenscript.denizencore.tags.TagManager;
import com.denizenscript.denizencore.utilities.debugging.SlowWarning;
import com.denizenscript.denizencore.utilities.debugging.Warning;
import com.denizenscript.depenizen.bukkit.Bridge;
import com.denizenscript.depenizen.bukkit.commands.jobs.JobsCommand;
import com.denizenscript.depenizen.bukkit.events.jobs.*;
import com.denizenscript.depenizen.bukkit.objects.jobs.JobsJobTag;
import com.denizenscript.depenizen.bukkit.properties.jobs.JobsPlayerExtensions;
import com.gamingmesh.jobs.Jobs;
public class JobsBridge extends Bridge {
public static Warning jobsDeprecatedConstructor = new SlowWarning("jobsDeprecatedConstructor", "The 'jobs' constructor from Depenizen/Jobs is deprecated: use 'jobs_job'");
public static Warning jobsNameShort = new SlowWarning("jobsNameShort", "The tag 'JobsJobTag.name.short' from Depenizen/Jobs is deprecated: use 'JobsJobTag.short_name'");
public static Warning jobsXpLevel = new SlowWarning("jobsXpLevel", "The tag 'JobsJobTag.xp.level' from Depenizen/Jobs is deprecated: use 'JobsJobTag.level'");
public static Warning jobsXpMax = new SlowWarning("jobsXpMax", "The tag 'JobsJobTag.xp.max' from Depenizen/Jobs is deprecated: use 'JobsJobTag.max_xp'");
public static Warning jobsSingleLineDescription = new SlowWarning("jobsSingleLineDescription", "'JobsJobTag.description' is deprecated, as single-line descriptions are deprecated in Jobs. Use 'JobsJobTag.full_description' instead.");
@Override
public void init() {
ScriptEvent.registerScriptEvent(JobsJobsPaymentScriptEvent.class);
ScriptEvent.registerScriptEvent(JobsJobsExpGainScriptEvent.class);
ScriptEvent.registerScriptEvent(JobsJobsJoinScriptEvent.class);
ScriptEvent.registerScriptEvent(JobsJobsLeaveScriptEvent.class);
ScriptEvent.registerScriptEvent(JobsJobsLevelUpScriptEvent.class);
ObjectFetcher.registerWithObjectFetcher(JobsJobTag.class, JobsJobTag.tagProcessor);
DenizenCore.commandRegistry.registerCommand(JobsCommand.class);
JobsPlayerExtensions.register();
// <--[tag]
// @attribute <jobs>
// @returns ListTag(JobsJobTag)
// @plugin Depenizen, Jobs
// @description
// Returns the list of all jobs on the server.
// -->
TagManager.registerTagHandler(ObjectTag.class, "jobs", (attribute) -> {
if (attribute.hasParam()) {
jobsDeprecatedConstructor.warn(attribute.context);
return JobsJobTag.valueOf(attribute.getParam(), attribute.context);
}
return new ListTag(Jobs.getJobs(), JobsJobTag::new);
});
// <--[tag]
// @attribute <jobs_job[<name>]>
// @returns JobsJobTag
// @plugin Depenizen, Jobs
// @description
// Returns the job tag with the given name.
// -->
TagManager.registerTagHandler(JobsJobTag.class, JobsJobTag.class, "jobs_job", (attribute, param) -> param);
}
}