mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-29 04:18:07 +01:00
Merge branch 'master' into bucket-entity-action
This commit is contained in:
commit
8a9a512130
BIN
libs/WildStackerAPI-2023.2.jar
Normal file
BIN
libs/WildStackerAPI-2023.2.jar
Normal file
Binary file not shown.
Binary file not shown.
32
pom.xml
32
pom.xml
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Jobs</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
@ -10,6 +8,8 @@
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-commons</artifactId>
|
||||
@ -80,12 +80,12 @@
|
||||
<version>4.11.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- WorldGuard old version -->
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
@ -200,12 +200,13 @@
|
||||
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- WildStacker -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bgsoftware</groupId>
|
||||
<artifactId>WildStackerAPI</artifactId>
|
||||
<version>latest</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/WildStackerAPI-latest.jar</systemPath>
|
||||
<systemPath>${basedir}/libs/WildStackerAPI-2023.2.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- StackMob -->
|
||||
<dependency>
|
||||
@ -275,20 +276,19 @@
|
||||
<!-- Make a Jar -->
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<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>
|
||||
<outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
@ -98,6 +98,7 @@ import com.gamingmesh.jobs.listeners.JobsPayment14Listener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
||||
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPayment16Listener;
|
||||
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
|
||||
import com.gamingmesh.jobs.selection.SelectionManager;
|
||||
import com.gamingmesh.jobs.stuff.Loging;
|
||||
import com.gamingmesh.jobs.stuff.TabComplete;
|
||||
@ -155,7 +156,7 @@ public final class Jobs extends JavaPlugin {
|
||||
private GuiManager guiManager;
|
||||
|
||||
private static JobsDAO dao;
|
||||
private static List<Job> jobs;
|
||||
private static List<Job> jobs = new ArrayList<Job>();
|
||||
private static Job noneJob;
|
||||
private static Map<Job, Integer> usedSlots = new WeakHashMap<>();
|
||||
|
||||
@ -799,6 +800,9 @@ public final class Jobs extends JavaPlugin {
|
||||
pm.registerEvents(new JobsPayment16Listener(), getInstance());
|
||||
}
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
|
||||
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
||||
}
|
||||
if (getGCManager().useBlockProtection) {
|
||||
pm.registerEvents(new PistonProtectionListener(), getInstance());
|
||||
}
|
||||
|
@ -582,7 +582,8 @@ public class Placeholder {
|
||||
return convert(true);
|
||||
|
||||
case maxjobs:
|
||||
return Integer.toString(Jobs.getPlayerManager().getMaxJobs(user));
|
||||
int max = Jobs.getPlayerManager().getMaxJobs(user);
|
||||
return Integer.toString(max == -1 ? 99 : max);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -63,9 +63,9 @@ import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.NBT.CMINBT;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
@ -488,10 +488,10 @@ public class PlayerManager {
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
|
||||
job.updateTotalPlayers();
|
||||
jPlayer.maxJobsEquation = getMaxJobs(jPlayer);
|
||||
|
||||
jPlayer.maxJobsEquation = CMINumber.clamp(getMaxJobs(jPlayer), 0, 9999);
|
||||
|
||||
// Removing from cached item boost for recalculation
|
||||
cache.remove(jPlayer.getUniqueId());
|
||||
cache.remove(jPlayer.getUniqueId());
|
||||
}
|
||||
|
||||
private static void performCommandsOnLeave(JobsPlayer jPlayer, Job job) {
|
||||
@ -533,10 +533,10 @@ public class PlayerManager {
|
||||
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
job.updateTotalPlayers();
|
||||
|
||||
|
||||
// Removing from cached item boost for recalculation
|
||||
cache.remove(jPlayer.getUniqueId());
|
||||
|
||||
cache.remove(jPlayer.getUniqueId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -931,7 +931,8 @@ public class PlayerManager {
|
||||
* @return true if the player is under the given jobs size
|
||||
*/
|
||||
public boolean getJobsLimit(JobsPlayer jPlayer, short currentCount) {
|
||||
return getMaxJobs(jPlayer) > currentCount;
|
||||
int max = getMaxJobs(jPlayer);
|
||||
return max == -1 ? true : max > currentCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1064,7 +1065,7 @@ public class PlayerManager {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jitems.add(getJobsItemByNbt(item));
|
||||
}
|
||||
}
|
||||
@ -1214,11 +1215,11 @@ public class PlayerManager {
|
||||
int playerMaxJobs = getMaxJobs(jPlayer);
|
||||
int playerCurrentJobs = jPlayer.progression.size();
|
||||
|
||||
if (playerMaxJobs <= 0 || playerCurrentJobs >= playerMaxJobs)
|
||||
if (playerMaxJobs == 0 || playerMaxJobs != -1 && playerCurrentJobs >= playerMaxJobs)
|
||||
return;
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (jPlayer.progression.size() >= playerMaxJobs)
|
||||
if (playerMaxJobs != -1 && jPlayer.progression.size() >= playerMaxJobs)
|
||||
return;
|
||||
|
||||
if (one.getMaxSlots() != null && Jobs.getUsedSlots(one) >= one.getMaxSlots())
|
||||
|
@ -103,6 +103,7 @@ public class give implements Cmd {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -11,7 +13,6 @@ import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
|
||||
@ -38,7 +39,7 @@ public class limit implements Cmd {
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
Language.sendMessage(sender,"command.limit.output.notenabled");
|
||||
Language.sendMessage(sender, "command.limit.output.notenabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ public class limit implements Cmd {
|
||||
|
||||
Language.sendMessage(sender, "command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)));
|
||||
Language.sendMessage(sender, "command.limit.output." + typeName + "Limit",
|
||||
"%current%", (int) (limit.getAmount(type) * 100) / 100D,
|
||||
"%current%", new DecimalFormat("##.##").format(limit.getAmount(type)),
|
||||
"%total%", JPlayer.getLimit(type));
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ public class transfer implements Cmd {
|
||||
"%newjobname%", newjob.getDisplayName());
|
||||
}
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
} else
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
} catch (Exception e) {
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@ -107,7 +106,7 @@ public class BlockProtectionManager {
|
||||
|
||||
// If timer is under 2 hours, we can run scheduler to remove it when time comes
|
||||
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
|
||||
Bp.setScheduler(CMIScheduler.get().runTaskLater(() -> {
|
||||
Bp.setScheduler(CMIScheduler.get().runAtLocationLater(loc, () -> {
|
||||
remove(loc);
|
||||
}, (time - System.currentTimeMillis()) / 50));
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -1572,6 +1572,8 @@ public class ConfigManager {
|
||||
return job;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
@ -110,7 +111,7 @@ public class GeneralConfigManager {
|
||||
DisabledWorldsUse, UseAsWhiteListWorldList, MythicMobsEnabled,
|
||||
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
|
||||
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
|
||||
|
||||
|
||||
public boolean jobsshopenabled;
|
||||
public boolean DailyQuestsEnabled;
|
||||
|
||||
@ -272,11 +273,24 @@ public class GeneralConfigManager {
|
||||
// Load locale
|
||||
Jobs.getLanguageManager().load();
|
||||
// title settings
|
||||
Jobs.getTitleManager().load();
|
||||
try {
|
||||
Jobs.getTitleManager().load();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// restricted areas
|
||||
Jobs.getRestrictedAreaManager().load();
|
||||
try {
|
||||
Jobs.getRestrictedAreaManager().load();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// restricted blocks
|
||||
Jobs.getRestrictedBlockManager().load();
|
||||
try {
|
||||
Jobs.getRestrictedBlockManager().load();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Item/Block/mobs name list
|
||||
Jobs.getNameTranslatorManager().load();
|
||||
// signs information
|
||||
@ -425,7 +439,7 @@ public class GeneralConfigManager {
|
||||
|
||||
c.addComment("DailyQuests.Enabled", "Enables or disables daily quests");
|
||||
DailyQuestsEnabled = c.get("DailyQuests.Enabled", true);
|
||||
|
||||
|
||||
c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests",
|
||||
"Any daily quests given before reset will be invalid and new ones will be given out");
|
||||
ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4);
|
||||
@ -442,7 +456,7 @@ public class GeneralConfigManager {
|
||||
"For this to work, the player needs to get a new job for the timer to start.", "Counting in hours");
|
||||
jobExpiryTime = c.get("JobExpirationTime", 0);
|
||||
|
||||
c.addComment("max-jobs", "Maximum number of jobs a player can join.", "Use 0 for no maximum", "Keep in mind that jobs.max.[amount] will bypass this setting");
|
||||
c.addComment("max-jobs", "Maximum number of jobs a player can join.", "Use -1 to disable limitations", "Keep in mind that jobs.max.[amount] will bypass this setting");
|
||||
maxJobs = c.get("max-jobs", 3);
|
||||
|
||||
c.addComment("disable-payment-if-max-level-reached", "Disabling the payment if the user reached the maximum level of a job.");
|
||||
@ -456,7 +470,7 @@ public class GeneralConfigManager {
|
||||
|
||||
c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books");
|
||||
preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true);
|
||||
|
||||
|
||||
c.addComment("jobs-shop-enabled", "Enables or disables jobs shop");
|
||||
jobsshopenabled = c.get("jobs-shop-enabled", true);
|
||||
|
||||
|
@ -580,7 +580,7 @@ public class LanguageManager {
|
||||
c.get("command.transfer.help.info", "Transfer a player's job from an old job to a new job.");
|
||||
c.get("command.transfer.help.args", "[playername] [oldjob] [newjob]");
|
||||
Jobs.getGCManager().getCommandArgs().put("transfer", Arrays.asList("[playername]", "[oldjob]", "[newjob]"));
|
||||
c.get("command.transfer.output.target", "You have been transferred from %oldjobname% to %newjobname%.");
|
||||
c.get("command.transfer.output.target", "&fYou have been transferred from %oldjobname% &fto %newjobname%.");
|
||||
|
||||
c.get("command.promote.help.info", "Promote the player X levels in a job.");
|
||||
c.get("command.promote.help.args", "[playername] [jobname] [levels] (-cmd)");
|
||||
|
@ -237,7 +237,7 @@ public class Job {
|
||||
|
||||
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty)
|
||||
now = Jobs.getGCManager().DynamicPaymentMaxPenalty;
|
||||
|
||||
|
||||
if (Double.isNaN(now))
|
||||
now = 0;
|
||||
|
||||
@ -310,7 +310,7 @@ public class Job {
|
||||
};
|
||||
|
||||
String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName());
|
||||
|
||||
|
||||
for (JobInfo info : getJobInfo(action.getType())) {
|
||||
if (condition.test(info, action)) {
|
||||
if (!info.isInLevelRange(level)) {
|
||||
|
@ -43,6 +43,7 @@ import com.gamingmesh.jobs.economy.PaymentData;
|
||||
|
||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
@ -442,7 +443,7 @@ public class JobsPlayer {
|
||||
Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation();
|
||||
eq.setVariable("totallevel", getTotalLevels());
|
||||
|
||||
maxJobsEquation = Jobs.getPlayerManager().getMaxJobs(this);
|
||||
maxJobsEquation = CMINumber.clamp(Jobs.getPlayerManager().getMaxJobs(this), 0, 9999);
|
||||
limits.put(type, (int) eq.getValue());
|
||||
setSaved(false);
|
||||
}
|
||||
|
@ -328,10 +328,10 @@ public class JobsListener implements Listener {
|
||||
|
||||
String line1 = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1));
|
||||
|
||||
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0))
|
||||
.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase("toplist"))
|
||||
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)).equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase(
|
||||
"toplist")) {
|
||||
event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline")));
|
||||
else
|
||||
} else
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().hasPermission("jobs.command.signs")) {
|
||||
|
@ -789,7 +789,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
// HACK! The API doesn't allow us to easily determine the resulting number of
|
||||
// crafted items, so we're forced to compare the inventory before and after.
|
||||
private void schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack, final ActionType type) {
|
||||
public static void schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack, final ActionType type) {
|
||||
final ItemStack[] preInv = player.getInventory().getContents();
|
||||
// Clone the array. The content may (was for me) be mutable.
|
||||
for (int i = 0; i < preInv.length; i++) {
|
||||
@ -822,7 +822,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
}, 1);
|
||||
}
|
||||
|
||||
private static boolean hasItems(ItemStack stack) {
|
||||
public static boolean hasItems(ItemStack stack) {
|
||||
return stack != null && stack.getAmount() > 0;
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
Objects.equal(a.getEnchantments(), b.getEnchantments());
|
||||
}
|
||||
|
||||
private static boolean isStackSumLegal(ItemStack a, ItemStack b) {
|
||||
public static boolean isStackSumLegal(ItemStack a, ItemStack b) {
|
||||
// See if we can create a new item stack with the combined elements of a and b
|
||||
if (a == null || b == null)
|
||||
return true;// Treat null as an empty stack
|
||||
@ -1602,6 +1602,9 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (!Jobs.getGCManager().useBreederFinder || !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity().getType().equals(EntityType.TURTLE))
|
||||
CMIDebug.d(event.getSpawnReason());
|
||||
|
||||
if (!event.getSpawnReason().toString().equalsIgnoreCase("BREEDING") && !event.getSpawnReason().toString().equalsIgnoreCase("EGG"))
|
||||
return;
|
||||
|
||||
@ -1840,7 +1843,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
// 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
|
||||
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")))) {
|
||||
CMIScheduler.get().runTaskLater(() -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.gamingmesh.jobs.listeners;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.block.sign.SignSide;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.inventory.SmithItemEvent;
|
||||
import org.bukkit.event.player.PlayerSignOpenEvent;
|
||||
import org.bukkit.event.player.PlayerSignOpenEvent.Cause;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
|
||||
public class PlayerSignEdit1_20Listeners implements Listener {
|
||||
|
||||
public PlayerSignEdit1_20Listeners() {
|
||||
}
|
||||
|
||||
Set<UUID> signEditCache = new HashSet<UUID>();
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerSignOpenEvent(PlayerSignOpenEvent event) {
|
||||
|
||||
if (!event.getCause().equals(Cause.INTERACT))
|
||||
return;
|
||||
|
||||
SignSide side = event.getSign().getSide(event.getSide());
|
||||
|
||||
if (!event.getPlayer().hasPermission("jobs.command.signs") && CMIChatColor.stripColor(side.getLine(0)).equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline")))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryCraft(SmithItemEvent event) {
|
||||
|
||||
// If event is nothing or place, do nothing
|
||||
switch (event.getAction()) {
|
||||
case NOTHING:
|
||||
case PLACE_ONE:
|
||||
case PLACE_ALL:
|
||||
case PLACE_SOME:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.getSlotType() != SlotType.CRAFTING)
|
||||
return;
|
||||
|
||||
if (!event.isLeftClick() && !event.isRightClick())
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
||||
return;
|
||||
|
||||
if (!(event.getWhoClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
|
||||
//Check if inventory is full and using shift click, possible money dupping fix
|
||||
if (player.getInventory().firstEmpty() == -1 && event.isShiftClick()) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("message.crafting.fullinventory"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
// check if player is riding
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (!JobsPaymentListener.payIfCreative(player))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new ItemActionInfo(event.getInventory().getResult(), ActionType.CRAFT));
|
||||
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.gamingmesh.jobs.stuff;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
@ -63,6 +64,12 @@ public final class Util {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private final static DecimalFormat dcf = new DecimalFormat("##.##");
|
||||
|
||||
public static String format2Decimals(double number) {
|
||||
return dcf.format(number);
|
||||
}
|
||||
|
||||
public static String getRealType(Entity entity) {
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_11_R1)) {
|
||||
return entity.getType().name();
|
||||
|
Loading…
Reference in New Issue
Block a user