1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-30 20:11:23 +01:00
This commit is contained in:
Zrips 2023-08-30 11:52:09 +03:00
parent 5667544626
commit f1eb7e5395
4 changed files with 41 additions and 35 deletions

View File

@ -94,10 +94,10 @@ import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.i18n.Language; import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.listeners.JobsListener; import com.gamingmesh.jobs.listeners.JobsListener;
import com.gamingmesh.jobs.listeners.JobsPayment14Listener; import com.gamingmesh.jobs.listeners.JobsPayment1_14Listener;
import com.gamingmesh.jobs.listeners.JobsPaymentListener; import com.gamingmesh.jobs.listeners.JobsPaymentListener;
import com.gamingmesh.jobs.listeners.PistonProtectionListener; import com.gamingmesh.jobs.listeners.PistonProtectionListener;
import com.gamingmesh.jobs.listeners.JobsPayment16Listener; import com.gamingmesh.jobs.listeners.JobsPayment1_16Listener;
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners; import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
import com.gamingmesh.jobs.selection.SelectionManager; import com.gamingmesh.jobs.selection.SelectionManager;
import com.gamingmesh.jobs.stuff.Loging; import com.gamingmesh.jobs.stuff.Loging;
@ -794,10 +794,10 @@ public final class Jobs extends JavaPlugin {
pm.registerEvents(new JobsListener(getInstance()), getInstance()); pm.registerEvents(new JobsListener(getInstance()), getInstance());
pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance()); pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance());
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
pm.registerEvents(new JobsPayment14Listener(), getInstance()); pm.registerEvents(new JobsPayment1_14Listener(), getInstance());
} }
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3)) { if (Version.isCurrentEqualOrHigher(Version.v1_16_R3)) {
pm.registerEvents(new JobsPayment16Listener(), getInstance()); pm.registerEvents(new JobsPayment1_16Listener(), getInstance());
} }
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) { if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {

View File

@ -18,52 +18,58 @@
package com.gamingmesh.jobs.container; package com.gamingmesh.jobs.container;
import net.Zrips.CMILib.Container.CMIText;
public enum ActionType { public enum ActionType {
BREAK("Break"), BREAK(),
STRIPLOGS("StripLogs"), STRIPLOGS("StripLogs"),
TNTBREAK("TNTBreak"), TNTBREAK("TNTBreak"),
PLACE("Place"), PLACE(),
KILL("Kill"), KILL(),
MMKILL("MMKill"), MMKILL("MMKill"),
FISH("Fish"), FISH(),
CRAFT("Craft"), CRAFT(),
VTRADE("VTrade"), VTRADE("VTrade"),
SMELT("Smelt"), SMELT(),
BREW("Brew"), BREW(),
ENCHANT("Enchant"), ENCHANT(),
REPAIR("Repair"), REPAIR(),
BREED("Breed"), BREED(),
TAME("Tame"), TAME(),
DYE("Dye"), DYE(),
SHEAR("Shear"), SHEAR(),
MILK("Milk"), MILK(),
EXPLORE("Explore"), EXPLORE(),
EAT("Eat"), EAT(),
CUSTOMKILL("custom-kill"), CUSTOMKILL("custom-kill"),
COLLECT("Collect"), COLLECT(),
BAKE("Bake"), BAKE(),
BUCKET("Bucket"); BUCKET();
private String name; private String name;
ActionType(String name) { ActionType(String name) {
this.name = name; this.name = name;
}
ActionType() {
this.name = CMIText.firstToUpperCase(this.toString());
} }
public String getName() { public String getName() {
return name; return name;
} }
public static ActionType getByName(String name) { public static ActionType getByName(String name) {
if (name != null) { if (name != null) {
name = name.replace("_", ""); name = name.replace("_", "");
for (ActionType one : ActionType.values()) { for (ActionType one : ActionType.values()) {
if (one.name.equalsIgnoreCase(name)) if (one.name.equalsIgnoreCase(name))
return one; return one;
} }
} }
return null; return null;
} }
} }

View File

@ -24,7 +24,7 @@ import com.gamingmesh.jobs.actions.ItemActionInfo;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.PlayerCamp; import com.gamingmesh.jobs.container.PlayerCamp;
public final class JobsPayment14Listener implements Listener { public final class JobsPayment1_14Listener implements Listener {
// BlockCookEvent does not have "cooking owner" // BlockCookEvent does not have "cooking owner"
private final Map<UUID, List<PlayerCamp>> campPlayers = new HashMap<>(); private final Map<UUID, List<PlayerCamp>> campPlayers = new HashMap<>();

View File

@ -10,7 +10,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBucketEntityEvent; import org.bukkit.event.player.PlayerBucketEntityEvent;
public class JobsPayment16Listener implements Listener { public class JobsPayment1_16Listener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityBucketed(PlayerBucketEntityEvent event) { public void onEntityBucketed(PlayerBucketEntityEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();