mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
16322a5b2e
Binary file not shown.
BIN
libs/PyroFishingPro-4.9.1.jar
Normal file
BIN
libs/PyroFishingPro-4.9.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
libs/mypet-3.12.jar
Normal file
BIN
libs/mypet-3.12.jar
Normal file
Binary file not shown.
121
pom.xml
121
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Jobs</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>5.2.2.5</version>
|
||||
<version>5.2.3.0</version>
|
||||
<name>Jobs</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
@ -17,32 +17,16 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-commons</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
@ -54,9 +38,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.175-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/mcMMO-2.1.175-SNAPSHOT.jar</systemPath>
|
||||
<version>2.2.004</version>
|
||||
</dependency>
|
||||
<!-- Vault -->
|
||||
<dependency>
|
||||
@ -76,38 +58,12 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- MythicMobs -->
|
||||
<dependency>
|
||||
<groupId>io.lumine.xikage</groupId>
|
||||
<artifactId>MythicMobs</artifactId>
|
||||
<version>4.11.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.1.0-SNAPSHOT</version>
|
||||
<version>5.6.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- WorldGuard old version -->
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
<version>6.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>commandbook</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.spigot</groupId>
|
||||
<artifactId>bukkit-classloader-check</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- WorldGuard new version -->
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
@ -195,27 +151,21 @@
|
||||
</dependency>
|
||||
<!-- CMILib -->
|
||||
<dependency>
|
||||
<groupId>net.Zrips</groupId>
|
||||
<groupId>com.github.Zrips</groupId>
|
||||
<artifactId>CMILib</artifactId>
|
||||
<version>latest</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/CMILib1.4.6.2.jar</systemPath>
|
||||
<version>1.4.7.4</version>
|
||||
</dependency>
|
||||
<!-- WildStacker -->
|
||||
<dependency>
|
||||
<groupId>com.bgsoftware</groupId>
|
||||
<artifactId>WildStackerAPI</artifactId>
|
||||
<version>latest</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/WildStackerAPI-2023.2.jar</systemPath>
|
||||
<version>3.8.0</version>
|
||||
</dependency>
|
||||
<!-- StackMob -->
|
||||
<dependency>
|
||||
<groupId>com.github.Nathat23</groupId>
|
||||
<artifactId>StackMob-5</artifactId>
|
||||
<version>5.5.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/StackMob-5.5.3.jar</systemPath>
|
||||
<groupId>uk.antiperson.stackmob</groupId>
|
||||
<artifactId>StackMob</artifactId>
|
||||
<version>5.8.2</version>
|
||||
</dependency>
|
||||
<!-- MyPet -->
|
||||
<dependency>
|
||||
@ -224,10 +174,22 @@
|
||||
<version>3.11-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<!-- Temporary solution for replacing repository -->
|
||||
<systemPath>${basedir}/libs/mypet-3.11-20210318.180552-1.jar</systemPath>
|
||||
<systemPath>${basedir}/libs/mypet-3.12.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- PyroFishingPro -->
|
||||
<dependency>
|
||||
<groupId>me.arsmagica</groupId>
|
||||
<artifactId>pyrofishingpro</artifactId>
|
||||
<version>4.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/PyroFishingPro-4.9.1.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
<!-- MythicMobs -->
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
@ -243,14 +205,13 @@
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<!-- papermc -->
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
<id>neetgames</id>
|
||||
<url>https://nexus.neetgames.com/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- PlaceholderAPI -->
|
||||
<repository>
|
||||
@ -258,6 +219,10 @@
|
||||
<url>
|
||||
https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bg-repo</id>
|
||||
<url>https://repo.bg-software.com/repository/api/</url>
|
||||
</repository>
|
||||
<!-- MyPet -->
|
||||
<!--<repository> <id>mypet-repo</id> <url>https://repo.mypet-plugin.de/</url>
|
||||
</repositor> -->
|
||||
@ -283,14 +248,6 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>D:/MC/Server 1.20/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -108,7 +108,6 @@ import com.gamingmesh.jobs.stuff.Util;
|
||||
import com.gamingmesh.jobs.stuff.VersionChecker;
|
||||
import com.gamingmesh.jobs.stuff.complement.Complement;
|
||||
import com.gamingmesh.jobs.stuff.complement.Complement1;
|
||||
import com.gamingmesh.jobs.stuff.complement.Complement2;
|
||||
import com.gamingmesh.jobs.stuff.complement.JobsChatEvent;
|
||||
import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
||||
import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
|
||||
@ -766,12 +765,7 @@ public final class Jobs extends JavaPlugin {
|
||||
HookManager.loadHooks();
|
||||
registerListeners();
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3) && kyoriSupported) {
|
||||
complement = new Complement2();
|
||||
//getServer().getPluginManager().registerEvents(new KyoriChatEvent(this), this);
|
||||
} else {
|
||||
complement = new Complement1();
|
||||
}
|
||||
complement = new Complement1();
|
||||
|
||||
if (HookVault.isVaultEnable()) {
|
||||
// register economy
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.gamingmesh.jobs.actions;
|
||||
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BaseActionInfo;
|
||||
|
||||
public class PyroFishingProInfo extends BaseActionInfo {
|
||||
private String name;
|
||||
|
||||
public PyroFishingProInfo(String name, ActionType type) {
|
||||
super(type);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameWithSub() {
|
||||
return name;
|
||||
}
|
||||
}
|
@ -381,6 +381,9 @@ public class ConfigManager {
|
||||
cfg.addComment(pt + ".Fish.legacy_raw_fish", "If you are using below version 1.13");
|
||||
generate(cfg, pt + ".Fish.legacy_raw_fish");
|
||||
|
||||
cfg.addComment(pt + ".PyroFishingPro", "Catching CUSTOM fish of the PyroFishingPro plugin");
|
||||
generate(cfg, pt + ".PyroFishingPro.CustomTier");
|
||||
|
||||
cfg.addComment(pt + ".Repair", "Repairing items");
|
||||
generate(cfg, pt + ".Repair.wood_sword");
|
||||
generate(cfg, pt + ".Repair.iron_sword");
|
||||
@ -588,6 +591,7 @@ public class ConfigManager {
|
||||
case KILL:
|
||||
case MILK:
|
||||
case MMKILL:
|
||||
case PYROFISHINGPRO:
|
||||
case BREED:
|
||||
case TAME:
|
||||
case SHEAR:
|
||||
@ -788,7 +792,7 @@ public class ConfigManager {
|
||||
type = cmiEnchant != null ? cmiEnchant.getKeyName() : myKey;
|
||||
|
||||
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL
|
||||
|| actionType == ActionType.BAKE || actionType == ActionType.SMELT) {
|
||||
|| actionType == ActionType.BAKE || actionType == ActionType.SMELT || actionType == ActionType.PYROFISHINGPRO) {
|
||||
type = myKey;
|
||||
} else if (actionType == ActionType.EXPLORE) {
|
||||
type = myKey;
|
||||
|
@ -36,7 +36,6 @@ import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -260,12 +259,12 @@ public class ShopManager {
|
||||
Jobs.getJobsDAO().savePoints(jPlayer);
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.Paid", "%amount%", item.getPointPrice()));
|
||||
}
|
||||
|
||||
|
||||
if (item.getVaultPrice() > 0) {
|
||||
jPlayer.withdraw(item.getVaultPrice());
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.Paid", "%amount%", Jobs.getEconomy().getEconomy().format(item.getVaultPrice())));
|
||||
}
|
||||
|
||||
|
||||
openShopGui(player, page);
|
||||
}
|
||||
};
|
||||
@ -518,14 +517,14 @@ public class ShopManager {
|
||||
|
||||
String potionData = "";
|
||||
if (itemSection.contains("potion-type")) {
|
||||
PotionType type;
|
||||
PotionType type = null;
|
||||
try {
|
||||
type = PotionType.valueOf(itemSection.getString("potion-type", "speed").toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
type = PotionType.SPEED;
|
||||
}
|
||||
|
||||
potionData += type.toString() + ":false:false";
|
||||
if (type != null)
|
||||
potionData += type.toString() + ":false:false";
|
||||
}
|
||||
|
||||
String itemSring = mat.toString();
|
||||
|
@ -28,6 +28,7 @@ public enum ActionType {
|
||||
KILL(),
|
||||
MMKILL("MMKill"),
|
||||
FISH(),
|
||||
PYROFISHINGPRO("PyroFishingPro"),
|
||||
CRAFT(),
|
||||
VTRADE("VTrade"),
|
||||
SMELT(),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gamingmesh.jobs.hooks;
|
||||
|
||||
import com.gamingmesh.jobs.hooks.blockTracker.BlockTrackerManager;
|
||||
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -10,7 +11,6 @@ import com.gamingmesh.jobs.hooks.McMMO.McMMO2_X_listener;
|
||||
import com.gamingmesh.jobs.hooks.McMMO.McMMOManager;
|
||||
import com.gamingmesh.jobs.hooks.MyPet.MyPetManager;
|
||||
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobInterface;
|
||||
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs4;
|
||||
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs5;
|
||||
import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager;
|
||||
import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler;
|
||||
@ -27,13 +27,14 @@ public class HookManager {
|
||||
private static StackMobHandler stackMobHandler;
|
||||
private static WildStackerHandler wildStackerHandler;
|
||||
private static BlockTrackerManager blockTrackerManager;
|
||||
private static PyroFishingProManager pyroFishingProManager;
|
||||
|
||||
private static final Jobs PLUGIN = JavaPlugin.getPlugin(Jobs.class);
|
||||
|
||||
private static PluginManager pm;
|
||||
|
||||
public static void loadHooks() {
|
||||
pm = PLUGIN.getServer().getPluginManager();
|
||||
pm = PLUGIN.getServer().getPluginManager();
|
||||
|
||||
setMyPetManager();
|
||||
setWorldGuard();
|
||||
@ -41,53 +42,61 @@ public class HookManager {
|
||||
setStackMobHandler();
|
||||
setWildStackerHandler();
|
||||
setBlockTrackerManager();
|
||||
setPyroFishingProManager();
|
||||
}
|
||||
|
||||
public static StackMobHandler getStackMobHandler() {
|
||||
if (stackMobHandler == null) {
|
||||
setStackMobHandler();
|
||||
}
|
||||
if (stackMobHandler == null) {
|
||||
setStackMobHandler();
|
||||
}
|
||||
|
||||
return stackMobHandler;
|
||||
return stackMobHandler;
|
||||
}
|
||||
|
||||
public static WildStackerHandler getWildStackerHandler() {
|
||||
if (wildStackerHandler == null) {
|
||||
setWildStackerHandler();
|
||||
}
|
||||
if (wildStackerHandler == null) {
|
||||
setWildStackerHandler();
|
||||
}
|
||||
|
||||
return wildStackerHandler;
|
||||
return wildStackerHandler;
|
||||
}
|
||||
|
||||
public static MyPetManager getMyPetManager() {
|
||||
if (myPetManager == null) {
|
||||
setMyPetManager();
|
||||
}
|
||||
if (myPetManager == null) {
|
||||
setMyPetManager();
|
||||
}
|
||||
|
||||
return myPetManager;
|
||||
return myPetManager;
|
||||
}
|
||||
|
||||
public static WorldGuardManager getWorldGuardManager() {
|
||||
if (worldGuardManager == null) {
|
||||
worldGuardManager = new WorldGuardManager();
|
||||
}
|
||||
if (worldGuardManager == null) {
|
||||
worldGuardManager = new WorldGuardManager();
|
||||
}
|
||||
|
||||
return worldGuardManager;
|
||||
return worldGuardManager;
|
||||
}
|
||||
|
||||
public static McMMOManager getMcMMOManager() {
|
||||
if (McMMOManager == null)
|
||||
McMMOManager = new McMMOManager();
|
||||
if (McMMOManager == null)
|
||||
McMMOManager = new McMMOManager();
|
||||
|
||||
return McMMOManager;
|
||||
return McMMOManager;
|
||||
}
|
||||
|
||||
public static MythicMobInterface getMythicManager() {
|
||||
return MythicManager;
|
||||
return MythicManager;
|
||||
}
|
||||
|
||||
public static PyroFishingProManager getPyroFishingProManager() {
|
||||
if(pyroFishingProManager == null)
|
||||
pyroFishingProManager = new PyroFishingProManager();
|
||||
|
||||
return pyroFishingProManager;
|
||||
}
|
||||
|
||||
public static boolean checkMythicMobs() {
|
||||
return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check();
|
||||
return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check();
|
||||
}
|
||||
|
||||
public static BlockTrackerManager getBlockTrackerManager() {
|
||||
@ -99,67 +108,66 @@ public class HookManager {
|
||||
}
|
||||
|
||||
private static boolean setWorldGuard() {
|
||||
if (JobsHook.WorldGuard.isEnabled()) {
|
||||
worldGuardManager = new WorldGuardManager();
|
||||
CMIMessages.consoleMessage("&eWorldGuard detected.");
|
||||
return true;
|
||||
}
|
||||
if (JobsHook.WorldGuard.isEnabled()) {
|
||||
worldGuardManager = new WorldGuardManager();
|
||||
CMIMessages.consoleMessage("&eWorldGuard detected.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void setMythicManager() {
|
||||
if (!JobsHook.MythicMobs.isPresent())
|
||||
return;
|
||||
if (!JobsHook.MythicMobs.isPresent())
|
||||
return;
|
||||
|
||||
try {
|
||||
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper");
|
||||
MythicManager = new MythicMobs4(PLUGIN);
|
||||
CMIMessages.consoleMessage("&eMythicMobs 4.x detected.");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
try {
|
||||
Class.forName("io.lumine.mythic.bukkit.BukkitAPIHelper");
|
||||
MythicManager = new MythicMobs5(PLUGIN);
|
||||
CMIMessages.consoleMessage("&eMythicMobs 5.x detected.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
CMIMessages.consoleMessage("&cYour MythicMobs version is not supported by Jobs! Supported versions: 4.9.1+");
|
||||
}
|
||||
}
|
||||
try {
|
||||
Class.forName("io.lumine.mythic.bukkit.BukkitAPIHelper");
|
||||
MythicManager = new MythicMobs5(PLUGIN);
|
||||
CMIMessages.consoleMessage("&eMythicMobs 5.x detected.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
CMIMessages.consoleMessage("&cYour MythicMobs version is not supported by Jobs! Supported versions: 4.9.1+");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setMcMMOlistener() {
|
||||
try {
|
||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||
pm.registerEvents(new McMMO2_X_listener(), PLUGIN);
|
||||
CMIMessages.consoleMessage("&eRegistered McMMO 2.x listener");
|
||||
} catch (ClassNotFoundException e) {
|
||||
pm.registerEvents(new McMMO1_X_listener(), PLUGIN);
|
||||
CMIMessages.consoleMessage("&eRegistered McMMO 1.x listener");
|
||||
}
|
||||
try {
|
||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||
pm.registerEvents(new McMMO2_X_listener(), PLUGIN);
|
||||
CMIMessages.consoleMessage("&eRegistered McMMO 2.x listener");
|
||||
} catch (ClassNotFoundException e) {
|
||||
pm.registerEvents(new McMMO1_X_listener(), PLUGIN);
|
||||
CMIMessages.consoleMessage("&eRegistered McMMO 1.x listener");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setMyPetManager() {
|
||||
if (JobsHook.MyPet.isEnabled()) {
|
||||
myPetManager = new MyPetManager();
|
||||
CMIMessages.consoleMessage("&eMyPet detected.");
|
||||
}
|
||||
if (JobsHook.MyPet.isEnabled()) {
|
||||
myPetManager = new MyPetManager();
|
||||
CMIMessages.consoleMessage("&eMyPet detected.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setStackMobHandler() {
|
||||
if (JobsHook.StackMob.isEnabled()) {
|
||||
stackMobHandler = new StackMobHandler();
|
||||
}
|
||||
if (JobsHook.StackMob.isEnabled()) {
|
||||
stackMobHandler = new StackMobHandler();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setWildStackerHandler() {
|
||||
if (JobsHook.WildStacker.isEnabled()) {
|
||||
wildStackerHandler = new WildStackerHandler();
|
||||
}
|
||||
if (JobsHook.WildStacker.isEnabled()) {
|
||||
wildStackerHandler = new WildStackerHandler();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockTrackerManager() {
|
||||
if (JobsHook.BlockTracker.isEnabled()) {
|
||||
blockTrackerManager = new BlockTrackerManager();
|
||||
}
|
||||
|
||||
private static void setPyroFishingProManager() {
|
||||
if (JobsHook.PyroFishingPro.isEnabled()) {
|
||||
pyroFishingProManager = new PyroFishingProManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public enum JobsHook {
|
||||
MythicMobs,
|
||||
mcMMO,
|
||||
BlockTracker;
|
||||
PyroFishingPro;
|
||||
|
||||
private Boolean enabled;
|
||||
private Boolean present;
|
||||
|
@ -1,75 +0,0 @@
|
||||
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||
import io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class MythicMobs4 implements MythicMobInterface {
|
||||
|
||||
public BukkitAPIHelper apiHelper;
|
||||
private Jobs plugin;
|
||||
|
||||
public MythicMobs4(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerListener() {
|
||||
plugin.getServer().getPluginManager().registerEvents(new MythicMobs4Listener(), plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMythicMob(LivingEntity lVictim) {
|
||||
return apiHelper != null && lVictim != null && apiHelper.isMythicMob(lVictim);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check() {
|
||||
Plugin mm = plugin.getServer().getPluginManager().getPlugin("MythicMobs");
|
||||
if (mm == null)
|
||||
return false;
|
||||
|
||||
try {
|
||||
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.events.MythicMobDeathEvent");
|
||||
Class.forName("io.lumine.xikage.mythicmobs.mobs.MythicMob");
|
||||
Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Disabling
|
||||
CMIMessages.consoleMessage("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support.");
|
||||
return false;
|
||||
}
|
||||
|
||||
apiHelper = ((MythicMobs) mm).getAPIHelper();
|
||||
CMIMessages.consoleMessage("&e[Jobs] &6MythicMobs was found - Enabling capabilities.");
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean failed = false;
|
||||
|
||||
@Override
|
||||
public String getDisplayName(String id) {
|
||||
if (failed || apiHelper == null)
|
||||
return "";
|
||||
|
||||
MythicMob mm = apiHelper.getMythicMob(id);
|
||||
try {
|
||||
if (mm != null && mm.getDisplayName() != null)
|
||||
return mm.getDisplayName().toString();
|
||||
} catch (Throwable e) {
|
||||
if (!failed) {
|
||||
failed = true;
|
||||
e.printStackTrace();
|
||||
CMIMessages.consoleMessage("&cEncountered error when checking MythicMob entity name. Support for mythicMobs will be suspended for time beying. Please report this issue.");
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.MMKillInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
||||
|
||||
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicMobDeathEvent;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
|
||||
public final class MythicMobs4Listener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMythicMobDeath(MythicMobDeathEvent event) {
|
||||
// Entity that died must be living
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Player pDamager = null;
|
||||
|
||||
// Checking if killer is player
|
||||
Entity ent = null;
|
||||
if (event.getKiller() instanceof Player)
|
||||
pDamager = (Player) event.getKiller();
|
||||
// Checking if killer is tamed animal
|
||||
else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
ent = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||
} else
|
||||
return;
|
||||
|
||||
if (pDamager == null)
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (!JobsPaymentListener.payIfCreative(pDamager))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
// pay
|
||||
MythicMob lVictim = event.getMobType();
|
||||
if (lVictim != null) {
|
||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ import com.gamingmesh.jobs.container.RestrictedArea;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
@ -23,109 +22,70 @@ import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
public class WorldGuardManager {
|
||||
|
||||
private WorldGuardPlugin wg;
|
||||
private boolean useOld = false;
|
||||
|
||||
public WorldGuardManager() {
|
||||
Plugin pl = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (pl instanceof WorldGuardPlugin) {
|
||||
wg = (WorldGuardPlugin) pl;
|
||||
|
||||
if (pl.getDescription().getVersion().equals("6.1")) {
|
||||
useOld = true;
|
||||
}
|
||||
}
|
||||
Plugin pl = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (pl instanceof WorldGuardPlugin) {
|
||||
wg = (WorldGuardPlugin) pl;
|
||||
}
|
||||
}
|
||||
|
||||
public WorldGuardPlugin getPlugin() {
|
||||
return wg;
|
||||
return wg;
|
||||
}
|
||||
|
||||
public List<RestrictedArea> getArea(Location loc) {
|
||||
try {
|
||||
if (useOld) {
|
||||
RegionManager manager = wg.getRegionContainer().get(loc.getWorld());
|
||||
try {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
|
||||
if (manager != null) {
|
||||
ApplicableRegionSet regions = manager.getApplicableRegions(loc);
|
||||
if (regions != null) {
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
List<RestrictedArea> rest = Jobs.getRestrictedAreaManager().getRestrictedAreasByName(one.getId());
|
||||
|
||||
for (ProtectedRegion one : regions.getRegions()) {
|
||||
List<RestrictedArea> rest = Jobs.getRestrictedAreaManager().getRestrictedAreasByName(one.getId());
|
||||
if (!rest.isEmpty())
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
if (!rest.isEmpty())
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
|
||||
if (regions != null) {
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
List<RestrictedArea> rest = Jobs.getRestrictedAreaManager().getRestrictedAreasByName(one.getId());
|
||||
|
||||
if (!rest.isEmpty())
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean inArea(Location loc, String name) {
|
||||
if (useOld) {
|
||||
RegionManager manager = wg.getRegionContainer().get(loc.getWorld());
|
||||
|
||||
if (manager != null) {
|
||||
ApplicableRegionSet regions = manager.getApplicableRegions(loc);
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
|
||||
for (ProtectedRegion one : regions.getRegions()) {
|
||||
if (one.getId().equalsIgnoreCase(name) && one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
if (regions != null) {
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
if (one.getId().equalsIgnoreCase(name) && one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (regions != null) {
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
if (one.getId().equalsIgnoreCase(name) && one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public ProtectedRegion getProtectedRegionByName(String name) {
|
||||
for (World one : Bukkit.getServer().getWorlds()) {
|
||||
Map<String, ProtectedRegion> regions = null;
|
||||
for (World one : Bukkit.getServer().getWorlds()) {
|
||||
Map<String, ProtectedRegion> regions = null;
|
||||
|
||||
if (useOld) {
|
||||
RegionManager manager = wg.getRegionContainer().get(one);
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager manager = container.get(BukkitAdapter.adapt(one));
|
||||
|
||||
if (manager != null)
|
||||
regions = manager.getRegions();
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager manager = container.get(BukkitAdapter.adapt(one));
|
||||
if (manager != null)
|
||||
regions = manager.getRegions();
|
||||
|
||||
if (manager != null)
|
||||
regions = manager.getRegions();
|
||||
}
|
||||
if (regions != null) {
|
||||
for (Entry<String, ProtectedRegion> map : regions.entrySet()) {
|
||||
if (map.getKey().equalsIgnoreCase(name))
|
||||
return map.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (regions != null) {
|
||||
for (Entry<String, ProtectedRegion> map : regions.entrySet()) {
|
||||
if (map.getKey().equalsIgnoreCase(name))
|
||||
return map.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.gamingmesh.jobs.hooks.pyroFishingPro;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import me.arsmagica.API.PyroFishCatchEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class PyroFishingProManager implements Listener {
|
||||
public static String lastFish;
|
||||
private final Jobs jobs;
|
||||
|
||||
public PyroFishingProManager() {
|
||||
this.jobs = Jobs.getInstance();
|
||||
jobs.getServer().getPluginManager().registerEvents(this, jobs);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPyroFishCatch(PyroFishCatchEvent event) {
|
||||
lastFish = event.getTier();
|
||||
}
|
||||
}
|
@ -26,6 +26,8 @@ import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.gamingmesh.jobs.actions.*;
|
||||
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -92,15 +94,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import com.bgsoftware.wildstacker.api.enums.StackSplit;
|
||||
import com.gamingmesh.jobs.ItemBoostManager;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.BlockActionInfo;
|
||||
import com.gamingmesh.jobs.actions.BlockCollectInfo;
|
||||
import com.gamingmesh.jobs.actions.CustomKillInfo;
|
||||
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
||||
import com.gamingmesh.jobs.actions.EntityActionInfo;
|
||||
import com.gamingmesh.jobs.actions.ExploreActionInfo;
|
||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||
import com.gamingmesh.jobs.actions.ItemNameActionInfo;
|
||||
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
|
||||
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||
@ -252,7 +245,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
public void onCowMilking(PlayerInteractEntityEvent event) {
|
||||
Entity entity = event.getRightClicked();
|
||||
|
||||
CMIEntityType type = CMIEntityType.getByType(entity.getType());
|
||||
CMIEntityType type = CMIEntityType.get(entity.getType());
|
||||
|
||||
if (type != CMIEntityType.COW && type != CMIEntityType.MUSHROOM_COW && type != CMIEntityType.GOAT)
|
||||
return;
|
||||
@ -264,7 +257,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInHand.getType() == Material.BOWL && entity.getType() != EntityType.MUSHROOM_COW) {
|
||||
if (itemInHand.getType() == Material.BOWL && type != CMIEntityType.MUSHROOM_COW) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -557,6 +550,13 @@ public final class JobsPaymentListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (JobsHook.PyroFishingPro.isEnabled()) {
|
||||
if(PyroFishingProManager.lastFish != null) {
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new PyroFishingProInfo(PyroFishingProManager.lastFish, ActionType.PYROFISHINGPRO));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(((Item) event.getCaught()).getItemStack(), ActionType.FISH), event.getCaught());
|
||||
}
|
||||
}
|
||||
@ -1667,11 +1667,14 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(e))
|
||||
return;
|
||||
|
||||
EntityType type = event.getEntityType();
|
||||
if (type != EntityType.PRIMED_TNT && type != EntityType.MINECART_TNT && type != CMIEntityType.ENDER_CRYSTAL.getType())
|
||||
CMIEntityType type = CMIEntityType.get(event.getEntityType());
|
||||
|
||||
|
||||
|
||||
if (type != CMIEntityType.TNT && type != CMIEntityType.TNT_MINECART && type != CMIEntityType.ENDER_CRYSTAL)
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().isUseTntFinder() && type != CMIEntityType.ENDER_CRYSTAL.getType())
|
||||
if (!Jobs.getGCManager().isUseTntFinder() && type != CMIEntityType.ENDER_CRYSTAL)
|
||||
return;
|
||||
|
||||
double closest = 60.0;
|
||||
@ -1703,7 +1706,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().isUseTntFinder() && type == CMIEntityType.ENDER_CRYSTAL.getType()) {
|
||||
if (!Jobs.getGCManager().isUseTntFinder() && type == CMIEntityType.ENDER_CRYSTAL) {
|
||||
UUID eUUID = e.getUniqueId();
|
||||
Entity killed = punchedEndCrystals.getIfPresent(eUUID);
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
package com.gamingmesh.jobs.stuff.complement;
|
||||
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
public class Complement2 implements Complement {
|
||||
|
||||
protected String serialize(Component component) {
|
||||
return LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
||||
}
|
||||
|
||||
protected TextComponent deserialize(String t) {
|
||||
return LegacyComponentSerializer.legacyAmpersand().deserialize(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(SignChangeEvent event, int line) {
|
||||
Component l = event.line(line);
|
||||
return l == null ? "" : serialize(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLine(SignChangeEvent event, int line, String text) {
|
||||
event.line(line, deserialize(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
return serialize(sign.line(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(Player player) {
|
||||
return serialize(player.displayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLine(Sign sign, int line, String text) {
|
||||
sign.line(line, deserialize(text));
|
||||
}
|
||||
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
package com.gamingmesh.jobs.stuff.complement;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import io.papermc.paper.chat.ChatRenderer;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
import net.kyori.adventure.text.TextReplacementConfig;
|
||||
|
||||
public final class KyoriChatEvent extends Complement2 implements Listener {
|
||||
|
||||
private Jobs plugin;
|
||||
|
||||
public KyoriChatEvent(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void asyncChatEvent(final AsyncChatEvent event) {
|
||||
if (event.isCancelled() || Util.getJobsEditorMap().isEmpty())
|
||||
return;
|
||||
|
||||
final String msg = Util.getJobsEditorMap().remove(event.getPlayer().getUniqueId());
|
||||
if (msg != null) {
|
||||
CMIScheduler.get().runTask(() -> event.getPlayer().performCommand(msg + serialize(event.message())));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Adding to chat prefix job name
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncChatEvent event) {
|
||||
if (!Jobs.getGCManager().getModifyChat())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
|
||||
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
|
||||
if (honorific.equals(" "))
|
||||
honorific = "";
|
||||
|
||||
// TODO displayName returns the player display name not the chat component from
|
||||
// chat plugins, like Essentials
|
||||
// Now there is a parameter "player", so literally we need to add 800+ chat plugins
|
||||
// to this plugin as dependency?
|
||||
// 3rd attempt: now we tried to use text replacement config builder to match the variable
|
||||
// result: instead of replacing the variable, now the chat message never been sent
|
||||
//event.composer((player, displayName, msg) -> msg
|
||||
//.replaceText(TextReplacementConfig.builder().match("{jobs}").once().replacement(h).build()));
|
||||
|
||||
event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
|
||||
"\\{jobs\\}").replacement(honorific).build()));
|
||||
// 4th attempt: composeChat -> doing nothing
|
||||
// event.message(ChatComposer.DEFAULT.composeChat(event.getPlayer(), event.getPlayer().displayName(), event.message())
|
||||
// .replaceText(TextReplacementConfig.builder().match("\\{jobs\\}").replacement(honorific).build()));
|
||||
}
|
||||
|
||||
// Changing chat prefix variable to job name
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerChatLow(AsyncChatEvent event) {
|
||||
onPlayerChatHigh(event);
|
||||
}
|
||||
|
||||
// Changing chat prefix variable to job name
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerChatHigh(AsyncChatEvent event) {
|
||||
if (Jobs.getGCManager().getModifyChat())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
|
||||
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
|
||||
if (honorific.equals(" "))
|
||||
honorific = "";
|
||||
|
||||
event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
|
||||
"\\{jobs\\}").replacement(honorific).build()));
|
||||
|
||||
// event.message(ChatComposer.DEFAULT
|
||||
// .composeChat(event.getPlayer(), event.getPlayer().displayName(), event.message())
|
||||
// .replaceText(TextReplacementConfig.builder().match("\\{jobs\\}").replacement(honorific).build()));
|
||||
}
|
||||
}
|
@ -440,6 +440,12 @@ exampleJob:
|
||||
legacy_raw_fish:
|
||||
income: 20.0
|
||||
experience: 25.0
|
||||
# Catching CUSTOM fish of the PyroFishingPro plugin
|
||||
PyroFishingPro:
|
||||
CustomTier:
|
||||
income: 1.0
|
||||
points: 1.0
|
||||
experience: 1.0
|
||||
# Repairing items
|
||||
Repair:
|
||||
wood_sword:
|
||||
|
@ -8,7 +8,7 @@ website: https://www.spigotmc.org/resources/4216/
|
||||
authors: [Zrips]
|
||||
contributors: [montlikadani]
|
||||
depend: [CMILib]
|
||||
softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob, BlockTracker]
|
||||
softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob, PyroFishingPro, BlockTracker]
|
||||
commands:
|
||||
jobs:
|
||||
description: Jobs
|
||||
|
Loading…
Reference in New Issue
Block a user