1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 17:53:00 +01:00

Compare commits

..

17 Commits

Author SHA1 Message Date
nossr50
8a71ef5fc2 Revert "Update README.md"
This reverts commit 2cc24db615.
2023-08-19 14:39:38 -07:00
TechnicallyCoded
38e0810f93 Fix non-converted schedulers 2023-08-14 11:47:11 +02:00
Rockyers
34fefc1e70 Change Tick Conversion rates 2023-08-13 22:46:43 -07:00
Rockyers
7f64987585 Replace Bukkit schedulers in SaveTimerTask.java 2023-08-13 19:58:04 -07:00
Rockyers
0603faff33 Replace Bukkit schedulers in ScoreboardWrapper.java 2023-08-13 19:53:01 -07:00
Rockyers
dc8a9102fe Replace Bukkit schedulers in ScoreboardWrapper.java 2023-08-13 19:45:09 -07:00
Rockyers
247d1732e2 Replace Bukkit schedulers in CombatUtils.java 2023-08-13 19:41:35 -07:00
Rockyers
140cd61fd6 Replace Bukkit schedulers in UUIDUpdateAsyncTask.java 2023-08-13 19:39:26 -07:00
Rockyers
4a2020d4af Changes Misc.TICK_CONVERSION_FACTOR to millisecond equivalent of a TICK 2023-08-13 19:37:54 -07:00
Rockyers
7f756c25ab Replaced Bukkit schedulers in mcMMO.java 2023-08-13 19:32:22 -07:00
Rockyers
715f7217f9 Replaced DatabaseConversionTask scheduler 2023-08-13 19:23:43 -07:00
Rockyers
760e610226 Replaced WorldListener Bukkit schedular 2023-08-13 19:09:26 -07:00
Rockyers
e23e8d3884 Added FoliaLib to main class 2023-08-13 19:08:43 -07:00
Rockyers
a7762cd015 Added FoliaLib to the dependencies 2023-08-13 19:05:18 -07:00
Yomamaeatstoes
1781a996b9 Update mcMMO.java Plugin instance 2023-08-13 19:55:21 -04:00
Yomamaeatstoes
2cc24db615 Update README.md 2023-08-13 18:48:48 -04:00
Yomamaeatstoes
7e86701119 Update plugin.yml - Folia True 2023-08-11 23:54:18 -04:00
88 changed files with 437 additions and 530 deletions

View File

@@ -1,29 +1,3 @@
Version 2.1.227
Optimized mcMMO onChunkUnload(ChunkUnloadEvent)
NOTES:
This update should greatly improve impact on TPS from mcMMO in the ChunkUnloadEvent, thanks to M_G_P and Epicurious for testing.
Version 2.1.226
Added Short_Grass to experience.yml for Herbalism
Updated Hylian Treasures "Bushes" alias to use short_grass when playing on new Minecraft versions
Fixed dirt_path and grass_block not being correctly whitelisted for herbalism abilities
Version 2.1.225
Fixed text from mcMMO not being sent or displayed to the player
Updated Adventure dependencies
Added new API McMMOPlayerNotificationEvent.getPlayer
Version 2.1.224
Updated to a new build of ACF to fix NoSuchFieldException locale
Improved Folia Support (Thanks HSGamer)
Fishing Shake has 8 ranks again
NOTES:
At some point Shake got reduced to 1 rank, this didn't really make sense as it was meant to be a skill that ranked up and got better over time.
It now has 8 ranks again, you may need to update advanced.yml and skillranks.yml to get the new ranks.
Version 2.1.223
Folia Support added (Thanks to HSGamer, TechnicallyCoded, Rockyers, and Yomamaeatstoes)
NOTES: This update brings mcMMO to Folia, not all features are guaranteed to work but from limited testing it appears to be working well.
Version 2.1.222
Fixed dupe exploit
Glow Lichen default XP changed from 200 to 5

View File

@@ -29,12 +29,6 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
#### Classic Maintainer
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
#### Folia Inquisitors
[<img src="https://github.com/HSGamer.png" width=80 alt="HSGamer">](https://github.com/HSGamer)
[<img src="https://github.com/TechnicallyCoded.png" width=80 alt="TechnicallyCoded">](https://github.com/TechnicallyCoded)
[<img src="https://github.com/Yomamaeatstoes.png" width=80 alt="Yomamaeatstoes">](https://github.com/Yomamaeatstoes)
[<img src="https://github.com/Rockyers.png" width=80 alt="Rockyers">](https://github.com/Rockyers)
## Former Team Members
### Former Lead & Awesome guy

70
pom.xml
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.227-SNAPSHOT</version>
<version>2.1.222</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>
@@ -150,20 +150,20 @@
<include>net.kyori:examination-api</include>
<include>net.kyori:examination-string</include>
<include>net.kyori:adventure-text-serializer-legacy</include>
<include>net.kyori:adventure-text-serializer-gson</include>
<include>net.kyori:adventure-text-serializer-json</include>
<include>net.kyori:adventure-text-serializer-bungeecord</include>
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
<include>co.aikar:acf-bukkit</include>
<include>com.tcoded:FoliaLib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
<pattern>net.kyori.examination</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.examination</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori.adventure</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.adventure</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
@@ -268,65 +268,41 @@
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-bungeecord</artifactId>
<version>4.3.1</version>
</dependency>
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
<version>4.14.0</version>
<version>4.13.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.14.0</version>
<version>4.13.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.14.0</version>
<version>4.13.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.14.0</version>
<version>4.13.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.3.1</version>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.13.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.1</version>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-facet</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-viaversion</artifactId>
<version>4.3.1</version>
<artifactId>adventure-platform-api</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
@@ -342,13 +318,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -407,13 +377,13 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<version>32.0.0-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.3.1</version>
<version>0.2.4</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@@ -204,7 +204,7 @@ public class McImportCommand implements CommandExecutor {
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
skillName = "Woodcutting";
}
else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
skillName = "Herbalism";
}
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {

View File

@@ -64,10 +64,10 @@ public class ConvertDatabaseCommand implements CommandExecutor {
mcMMO.getDatabaseManager().saveUser(profile);
}
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
return true;
}
return false;

View File

@@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
UserManager.saveAll();
UserManager.clearAll();
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
return true;

View File

@@ -250,7 +250,7 @@ public class PtpCommand implements TabExecutor {
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
}
else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);

View File

@@ -111,7 +111,7 @@ public class McrankCommand implements TabExecutor {
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@@ -115,7 +115,7 @@ public class MctopCommand implements TabExecutor {
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@@ -4,7 +4,6 @@ import com.gmail.nossr50.config.BukkitConfig;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.ChatColor;
@@ -229,7 +228,7 @@ public class TreasureConfig extends BukkitConfig {
for (String dropper : dropList) {
if (dropper.equals("Bushes")) {
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(BlockUtils.getShortGrass()), hylianTreasure);
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure);
for (Material species : Tag.SAPLINGS.getValues())
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);

View File

@@ -18,6 +18,7 @@ import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -1355,7 +1356,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new GetUUIDUpdatesRequired(), 100); // wait until after first purge
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
}
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
@@ -1368,7 +1369,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
}
private class GetUUIDUpdatesRequired implements Runnable {
private class GetUUIDUpdatesRequired extends BukkitRunnable {
public void run() {
massUpdateLock.lock();
List<String> names = new ArrayList<>();

View File

@@ -951,7 +951,7 @@ public class McMMOPlayer implements Identified {
}
setToolPreparationMode(tool, false);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
new AbilityDisableTask(this, superAbilityType).runTaskLater(mcMMO.p, (long) ticks * Misc.TICK_CONVERSION_FACTOR);
}
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
@@ -1013,7 +1013,7 @@ public class McMMOPlayer implements Identified {
}
setToolPreparationMode(tool, true);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ToolLowerTask(this, tool), 4 * Misc.TICK_CONVERSION_FACTOR);
new ToolLowerTask(this, tool).runTaskLater(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@@ -102,16 +102,16 @@ public class PlayerProfile {
}
public void scheduleAsyncSave() {
mcMMO.p.getFoliaLib().getImpl().runAsync(new PlayerProfileSaveTask(this, false));
new PlayerProfileSaveTask(this, false).runTaskAsynchronously(mcMMO.p);
}
public void scheduleAsyncSaveDelay() {
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(this, false), 20);
new PlayerProfileSaveTask(this, false).runTaskLaterAsynchronously(mcMMO.p, 20);
}
@Deprecated
public void scheduleSyncSaveDelay() {
mcMMO.p.getFoliaLib().getImpl().runLater(new PlayerProfileSaveTask(this, true), 20);
new PlayerProfileSaveTask(this, true).runTaskLater(mcMMO.p, 20);
}
public void save(boolean useSync) {
@@ -138,7 +138,7 @@ public class PlayerProfile {
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
if(mcMMO.isServerShutdownExecuted() || useSync)
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
new PlayerProfileSaveTask(this, true).runTask(mcMMO.p);
else
scheduleAsyncSave();

View File

@@ -41,7 +41,7 @@ public enum SubSkillType {
FISHING_MAGIC_HUNTER(1),
FISHING_MASTER_ANGLER(8),
FISHING_TREASURE_HUNTER(8),
FISHING_SHAKE(8),
FISHING_SHAKE(1),
/* Herbalism */
HERBALISM_DOUBLE_DROPS(1),

View File

@@ -27,13 +27,8 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
protected Component notificationTextComponent;
protected final NotificationType notificationType;
protected final Player player;
public McMMOPlayerNotificationEvent(Player player, NotificationType notificationType,
Component notificationTextComponent, McMMOMessageType chatMessageType,
boolean isMessageAlsoBeingSentToChat) {
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, Component notificationTextComponent, McMMOMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
super(false);
this.player = player;
this.notificationType = notificationType;
this.notificationTextComponent = notificationTextComponent;
this.chatMessageType = chatMessageType;
@@ -53,10 +48,6 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
}
public Player getPlayer() {
return player;
}
public Component getNotificationTextComponent() {
return notificationTextComponent;
}

View File

@@ -137,7 +137,7 @@ public class BlockListener implements Listener {
final BlockFace direction = event.getDirection();
for (final Block block : event.getBlocks()) {
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), t -> {
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), () -> {
final Block movedBlock = block.getRelative(direction);
if (BlockUtils.isWithinWorldBounds(movedBlock)) {

View File

@@ -242,7 +242,7 @@ public class EntityListener implements Listener {
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
metaCleanupTask.runTaskTimer(pluginRef, 20, 20*60); //6000 ticks is 5 minutes
}
else if (isTracked) {
BlockUtils.setUnnaturalBlock(block);

View File

@@ -439,7 +439,7 @@ public class InventoryListener implements Listener {
return;
}
mcMMO.p.getFoliaLib().getImpl().runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
}
}

View File

@@ -49,6 +49,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Locale;
@@ -148,7 +149,12 @@ public class PlayerListener implements Listener {
new MobHealthDisplayUpdaterTask(attacker).run();
// set the name back
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(attacker, () -> MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p), 1);
new BukkitRunnable() {
@Override
public void run() {
MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p);
}
}.runTaskLater(mcMMO.p, 1);
}
/**
@@ -589,7 +595,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 60);
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 60);
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
Motd.displayAll(player);

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.listeners;
import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler;
@@ -11,6 +12,8 @@ import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import java.util.concurrent.TimeUnit;
public class WorldListener implements Listener {
private final mcMMO plugin;
@@ -34,7 +37,7 @@ public class WorldListener implements Listener {
for (BlockState blockState : event.getBlocks()) {
mcMMO.getPlaceStore().setFalse(blockState);
}
}, 1);
}, 50, TimeUnit.MILLISECONDS);
}
/**
@@ -64,8 +67,6 @@ public class WorldListener implements Listener {
Chunk chunk = event.getChunk();
mcMMO.p.getFoliaLib().getImpl().runAsync(task -> {
mcMMO.getPlaceStore().chunkUnloaded(chunk.getX(), chunk.getZ(), event.getWorld());
});
mcMMO.getPlaceStore().chunkUnloaded(chunk.getX(), chunk.getZ(), event.getWorld());
}
}

View File

@@ -54,7 +54,7 @@ import com.gmail.nossr50.util.skills.SmeltingTracker;
import com.gmail.nossr50.util.upgrade.UpgradeManager;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.tcoded.folialib.FoliaLib;
import com.tcoded.folialib.util.InvalidTickDelayNotifier;
import com.tcoded.folialib.impl.ServerImplementation;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bstats.bukkit.Metrics;
@@ -76,6 +76,7 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class mcMMO extends JavaPlugin {
@@ -174,7 +175,6 @@ public class mcMMO extends JavaPlugin {
//Folia lib plugin instance
foliaLib = new FoliaLib(this);
InvalidTickDelayNotifier.disableNotifications = true;
setupFilePaths();
generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools
@@ -242,8 +242,7 @@ public class mcMMO extends JavaPlugin {
.getImpl()
.runTimer(
() -> getLogger().severe("You are running an outdated version of "+platformManager.getServerSoftware()+", mcMMO will not work unless you update to a newer version!"),
20, 20*60*30
);
20 * 50L, 1000 * 60 * 30, TimeUnit.MILLISECONDS);
if(platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
{
@@ -251,8 +250,7 @@ public class mcMMO extends JavaPlugin {
.getImpl()
.runTimer(
() -> getLogger().severe("We have detected you are using incompatible server software, our best guess is that you are using CraftBukkit. mcMMO requires Spigot or Paper, if you are not using CraftBukkit, you will still need to update your custom server software before mcMMO will work."),
20, 20*60*30
);
20 * 50L, 1000 * 60 * 30, TimeUnit.MILLISECONDS);
}
} else {
registerEvents();
@@ -264,7 +262,7 @@ public class mcMMO extends JavaPlugin {
formulaManager = new FormulaManager();
for (Player player : getServer().getOnlinePlayers()) {
getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
LogUtils.debug(mcMMO.p.getLogger(), "Version " + getDescription().getVersion() + " is enabled!");
@@ -637,7 +635,7 @@ public class mcMMO extends JavaPlugin {
if (generalConfig.getChimaeraEnabled()) {
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
}
}, 40);
}, 40 * 50, TimeUnit.MILLISECONDS);
}
private void scheduleTasks() {
@@ -647,7 +645,7 @@ public class mcMMO extends JavaPlugin {
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
getFoliaLib().getImpl().runTimer(new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
new SaveTimerTask().runTaskTimer(saveIntervalTicks, saveIntervalTicks);
// Cleanup the backups folder
getFoliaLib().getImpl().runAsync(new CleanBackupsTask());
@@ -656,33 +654,33 @@ public class mcMMO extends JavaPlugin {
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
if (purgeIntervalTicks == 0) {
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
}
else if (purgeIntervalTicks > 0) {
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
}
// Automatically remove old members from parties
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
if (kickIntervalTicks == 0) {
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
}
else if (kickIntervalTicks > 0) {
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
}
// Update power level tag scoreboards
getFoliaLib().getImpl().runTimer(new PowerLevelUpdatingTask(), 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
// Clear the registered XP data so players can earn XP again
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
}
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
{
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
}
}

View File

@@ -3,9 +3,9 @@
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.runnables.skills.AprilTask;
//import com.gmail.nossr50.util.Misc;
//import com.gmail.nossr50.util.CancellableRunnable;
//import org.bukkit.scheduler.BukkitRunnable;
//
//public class CheckDateTask extends CancellableRunnable {
//public class CheckDateTask extends BukkitRunnable {
//
// @Override
// public void run() {

View File

@@ -1,12 +1,12 @@
package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.entity.Mob;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
public class MobDodgeMetaCleanup extends CancellableRunnable {
public class MobDodgeMetaCleanup extends BukkitRunnable {
private final @NotNull Mob mob;
private final @NotNull mcMMO pluginRef;

View File

@@ -1,11 +1,11 @@
package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
public class MobHealthDisplayUpdaterTask extends CancellableRunnable {
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
private final LivingEntity target;
public MobHealthDisplayUpdaterTask(LivingEntity target) {

View File

@@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.List;
public class PistonTrackerTask extends CancellableRunnable {
public class PistonTrackerTask extends BukkitRunnable {
private final List<Block> blocks;
private final BlockFace direction;
private final Block futureEmptyBlock;

View File

@@ -4,23 +4,27 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.tcoded.folialib.wrapper.task.WrappedTask;
public class SaveTimerTask extends CancellableRunnable {
@Override
public void run() {
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
// All player data will be saved periodically through this
int count = 1;
import java.util.concurrent.TimeUnit;
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false), count);
count++;
}
public class SaveTimerTask {
public WrappedTask runTaskTimer(long delay, long period) {
return mcMMO.p.getFoliaLib().getImpl().runTimer(() -> {
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
// All player data will be saved periodically through this
int count = 1;
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false).runTaskLaterAsynchronously(mcMMO.p, count);
count++;
}
PartyManager.saveParties();
PartyManager.saveParties();
}, delay * Misc.TICK_CONVERSION_FACTOR, period * Misc.TICK_CONVERSION_FACTOR, TimeUnit.MILLISECONDS);
}
}

View File

@@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.scheduler.BukkitRunnable;
public class StickyPistonTrackerTask extends CancellableRunnable {
public class StickyPistonTrackerTask extends BukkitRunnable {
private final BlockFace direction;
private final Block block;
private final Block movedBlock;

View File

@@ -1,12 +1,12 @@
package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.entity.Entity;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
public class TravelingBlockMetaCleanup extends CancellableRunnable {
public class TravelingBlockMetaCleanup extends BukkitRunnable {
private final @NotNull Entity entity;
private final @NotNull mcMMO pluginRef;

View File

@@ -1,8 +1,8 @@
package com.gmail.nossr50.runnables.backups;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.text.ParseException;
@@ -10,7 +10,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class CleanBackupsTask extends CancellableRunnable {
public class CleanBackupsTask extends BukkitRunnable {
private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator;
private static final File BACKUP_DIR = new File(BACKUP_DIRECTORY);

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class McScoreboardKeepTask extends CancellableRunnable {
public class McScoreboardKeepTask extends BukkitRunnable {
private final Player player;
public McScoreboardKeepTask(Player player) {

View File

@@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Map;
public class McrankCommandAsyncTask extends CancellableRunnable {
public class McrankCommandAsyncTask extends BukkitRunnable {
private final String playerName;
private final CommandSender sender;
private final boolean useBoard, useChat;
@@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends CancellableRunnable {
public void run() {
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
mcMMO.p.getFoliaLib().getImpl().runNextTick(new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat));
new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1);
}
}

View File

@@ -3,19 +3,19 @@ package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillTools;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Map;
/**
* Display the results of McrankCommandAsyncTask to the sender.
*/
public class McrankCommandDisplayTask extends CancellableRunnable {
public class McrankCommandDisplayTask extends BukkitRunnable {
private final Map<PrimarySkillType, Integer> skills;
private final CommandSender sender;
private final String playerName;

View File

@@ -3,14 +3,14 @@ package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.List;
public class MctopCommandAsyncTask extends CancellableRunnable {
public class MctopCommandAsyncTask extends BukkitRunnable {
private final CommandSender sender;
private final PrimarySkillType skill;
private final int page;
@@ -35,6 +35,6 @@ public class MctopCommandAsyncTask extends CancellableRunnable {
public void run() {
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
mcMMO.p.getFoliaLib().getImpl().runNextTick(new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat));
new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat).runTaskLater(mcMMO.p, 1);
}
}

View File

@@ -4,19 +4,19 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.List;
/**
* Display the results of {@link MctopCommandAsyncTask} to the sender.
*/
public class MctopCommandDisplayTask extends CancellableRunnable {
public class MctopCommandDisplayTask extends BukkitRunnable {
private final List<PlayerStat> userStats;
private final CommandSender sender;
private final PrimarySkillType skill;

View File

@@ -1,12 +1,12 @@
package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class NotifySquelchReminderTask extends CancellableRunnable {
public class NotifySquelchReminderTask extends BukkitRunnable {
@Override
public void run() {

View File

@@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.database;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
public class DatabaseConversionTask extends CancellableRunnable {
public class DatabaseConversionTask extends BukkitRunnable {
private final DatabaseManager sourceDatabase;
private final CommandSender sender;
private final String message;
@@ -21,6 +21,6 @@ public class DatabaseConversionTask extends CancellableRunnable {
public void run() {
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> sender.sendMessage(message));
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> sender.sendMessage(message));
}
}

View File

@@ -8,14 +8,14 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillTools;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
public class FormulaConversionTask extends CancellableRunnable {
public class FormulaConversionTask extends BukkitRunnable {
private final CommandSender sender;
private final FormulaType formulaType;

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.database;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.Misc;
import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
@@ -19,9 +18,10 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
public class UUIDUpdateAsyncTask extends CancellableRunnable {
public class UUIDUpdateAsyncTask implements Runnable {
private static final Gson GSON = new Gson();
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
@@ -110,7 +110,7 @@ public class UUIDUpdateAsyncTask extends CancellableRunnable {
// Bukkit runnables don't let themselves reschedule themselves, so we are a pseudo bukkit runnable.
private void runTaskLaterAsynchronously(mcMMO plugin, int delay) {
plugin.getFoliaLib().getImpl().runLaterAsync(this, delay);
plugin.getFoliaLib().getImpl().runLaterAsync(this, delay, TimeUnit.MILLISECONDS);
}
public void start() {

View File

@@ -1,11 +1,11 @@
package com.gmail.nossr50.runnables.database;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.concurrent.locks.ReentrantLock;
public class UserPurgeTask extends CancellableRunnable {
public class UserPurgeTask extends BukkitRunnable {
private final ReentrantLock lock = new ReentrantLock();
@Override
public void run() {

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.items;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
@@ -11,8 +10,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
public class ChimaeraWingWarmup extends CancellableRunnable {
public class ChimaeraWingWarmup extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
public ChimaeraWingWarmup(McMMOPlayer mcMMOPlayer) {

View File

@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -12,8 +11,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class TeleportationWarmup extends CancellableRunnable {
public class TeleportationWarmup extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final McMMOPlayer mcMMOTarget;

View File

@@ -3,8 +3,8 @@ package com.gmail.nossr50.runnables.party;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.OfflinePlayer;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
public class PartyAutoKickTask extends CancellableRunnable {
public class PartyAutoKickTask extends BukkitRunnable {
private final static long KICK_TIME = 24L * 60L * 60L * 1000L * mcMMO.p.getGeneralConfig().getAutoPartyKickTime();
@Override

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.scheduler.BukkitRunnable;
public class ClearRegisteredXPGainTask extends CancellableRunnable {
public class ClearRegisteredXPGainTask extends BukkitRunnable {
@Override
public void run() {
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
@@ -13,8 +12,9 @@ import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class PlayerProfileLoadingTask extends CancellableRunnable {
public class PlayerProfileLoadingTask extends BukkitRunnable {
private final Player player;
private int attempt = 0;
@@ -52,7 +52,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
// If successful, schedule the apply
if (profile.isLoaded()) {
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new ApplySuccessfulProfile(new McMMOPlayer(player, profile)));
new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
EventUtils.callPlayerProfileLoadEvent(player, profile);
return;
}
@@ -74,10 +74,10 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
// Increment attempt counter and try
attempt++;
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player, attempt), (100 + (attempt * 100L)));
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100L)));
}
private class ApplySuccessfulProfile extends CancellableRunnable {
private class ApplySuccessfulProfile extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private ApplySuccessfulProfile(McMMOPlayer mcMMOPlayer) {
@@ -104,7 +104,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
ScoreboardManager.enablePlayerStatsScoreboard(player);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new McScoreboardKeepTask(player), Misc.TICK_CONVERSION_FACTOR);
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@@ -1,9 +1,9 @@
package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.scheduler.BukkitRunnable;
public class PlayerProfileSaveTask extends CancellableRunnable {
public class PlayerProfileSaveTask extends BukkitRunnable {
private final PlayerProfile playerProfile;
private final boolean isSync;

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@SuppressWarnings("deprecation")
public class PlayerUpdateInventoryTask extends CancellableRunnable {
public class PlayerUpdateInventoryTask extends BukkitRunnable {
private final Player player;
public PlayerUpdateInventoryTask(Player player) {

View File

@@ -1,9 +1,9 @@
package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.scheduler.BukkitRunnable;
public class PowerLevelUpdatingTask extends CancellableRunnable {
public class PowerLevelUpdatingTask extends BukkitRunnable {
@Override
public void run() {
if (!ScoreboardManager.powerLevelHeartbeat()) {

View File

@@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityCooldownTask extends CancellableRunnable {
public class AbilityCooldownTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final SuperAbilityType ability;

View File

@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.NotificationManager;
@@ -13,8 +12,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityDisableTask extends CancellableRunnable {
public class AbilityDisableTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final SuperAbilityType ability;
@@ -63,7 +63,7 @@ public class AbilityDisableTask extends CancellableRunnable {
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
}
if(!mcMMO.isServerShutdownExecuted()) {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@@ -2,15 +2,15 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.Location;
import org.bukkit.block.BrewingStand;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Arrays;
public class AlchemyBrewCheckTask extends CancellableRunnable {
public class AlchemyBrewCheckTask extends BukkitRunnable {
private final Player player;
private final BrewingStand brewingStand;
private final ItemStack[] oldInventory;

View File

@@ -7,7 +7,6 @@ import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
@@ -16,8 +15,9 @@ import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.BrewingStand;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class AlchemyBrewTask extends CancellableRunnable {
public class AlchemyBrewTask extends BukkitRunnable {
private static final double DEFAULT_BREW_SPEED = 1.0;
private static final int DEFAULT_BREW_TICKS = 400;
@@ -62,7 +62,7 @@ public class AlchemyBrewTask extends CancellableRunnable {
fuel--;
Alchemy.brewingStandMap.put(location, this);
mcMMO.p.getFoliaLib().getImpl().runAtLocationTimer(location, this, 1, 1);
this.runTaskTimer(mcMMO.p, 1, 1);
}
@Override

View File

@@ -8,9 +8,9 @@
//import org.bukkit.ChatColor;
//import org.bukkit.Statistic;
//import org.bukkit.entity.Player;
//import com.gmail.nossr50.util.CancellableRunnable;
//import org.bukkit.scheduler.BukkitRunnable;
//
//public class AprilTask extends CancellableRunnable {
//public class AprilTask extends BukkitRunnable {
//
// @Override
// public void run() {

View File

@@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
public class AwardCombatXpTask extends CancellableRunnable {
public class AwardCombatXpTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final double baseXp;
private final PrimarySkillType primarySkillType;

View File

@@ -15,7 +15,7 @@
//import org.bukkit.entity.Player;
//import org.bukkit.event.entity.EntityDamageEvent;
//import org.bukkit.inventory.ItemStack;
//import com.gmail.nossr50.util.CancellableRunnable;
//import org.bukkit.scheduler.BukkitRunnable;
//import org.jetbrains.annotations.NotNull;
//
//import java.util.HashMap;
@@ -23,7 +23,7 @@
//import java.util.Map;
//import java.util.Map.Entry;
//
//public class BleedTimerTask extends CancellableRunnable {
//public class BleedTimerTask extends BukkitRunnable {
// private static final @NotNull Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
// private static boolean isIterating = false;
//

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import org.bukkit.Location;
@@ -15,10 +14,11 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.type.Cocoa;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class DelayedCropReplant extends CancellableRunnable {
public class DelayedCropReplant extends BukkitRunnable {
private final int desiredCropAge;
private final Location cropLocation;
@@ -54,7 +54,7 @@ public class DelayedCropReplant extends CancellableRunnable {
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
//Remove the metadata marking the block as recently replanted
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
new markPlantAsOld(blockBreakEvent.getBlock().getLocation()).runTaskLater(mcMMO.p, 10);
if(blockBreakEvent.isCancelled()) {
wasImmaturePlant = true;
@@ -101,7 +101,7 @@ public class DelayedCropReplant extends CancellableRunnable {
//Play an effect
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(newState.getLocation(), new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType), 1);
new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType).runTaskLater(mcMMO.p, 1);
}
}
@@ -110,7 +110,7 @@ public class DelayedCropReplant extends CancellableRunnable {
COCOA
}
private static class PhysicsBlockUpdate extends CancellableRunnable {
private static class PhysicsBlockUpdate extends BukkitRunnable {
private final Block plantBlock;
private final PlantAnchorType plantAnchorType;
private BlockFace plantFace;
@@ -160,7 +160,7 @@ public class DelayedCropReplant extends CancellableRunnable {
private static class markPlantAsOld extends CancellableRunnable {
private static class markPlantAsOld extends BukkitRunnable {
private final Location cropLoc;

View File

@@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.BlockSnapshot;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
public class DelayedHerbalismXPCheckTask extends CancellableRunnable {
public class DelayedHerbalismXPCheckTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final ArrayList<BlockSnapshot> chorusBlocks;

View File

@@ -2,10 +2,10 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.experience.ExperienceBarManager;
import org.bukkit.scheduler.BukkitRunnable;
public class ExperienceBarHideTask extends CancellableRunnable {
public class ExperienceBarHideTask extends BukkitRunnable {
public final McMMOPlayer mcMMOPlayer;
public final PrimarySkillType primarySkillType;
public final ExperienceBarManager experienceBarManagerRef;

View File

@@ -1,9 +1,9 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.block.BlockState;
import org.bukkit.scheduler.BukkitRunnable;
public class HerbalismBlockUpdaterTask extends CancellableRunnable {
public class HerbalismBlockUpdaterTask extends BukkitRunnable {
private final BlockState blockState;
public HerbalismBlockUpdaterTask(BlockState blockState) {

View File

@@ -1,11 +1,11 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.entity.FishHook;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
public class MasterAnglerTask extends CancellableRunnable {
public class MasterAnglerTask extends BukkitRunnable {
private final @NotNull FishHook fishHook;
private final @NotNull FishingManager fishingManager;
private final int lureLevel;

View File

@@ -3,15 +3,15 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.google.common.base.Objects;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
public class RuptureTask extends CancellableRunnable {
public class RuptureTask extends BukkitRunnable {
public static final int DAMAGE_TICK_INTERVAL = 10;
public static final int ANIMATION_TICK_INTERVAL = 1;

View File

@@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable;
public class SkillUnlockNotificationTask extends CancellableRunnable {
public class SkillUnlockNotificationTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final SubSkillType subSkillType;
private final int rank;

View File

@@ -4,10 +4,10 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable;
public class ToolLowerTask extends CancellableRunnable {
public class ToolLowerTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer;
private final ToolType tool;

View File

@@ -113,7 +113,7 @@ public class AcrobaticsManager extends SkillManager {
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mob, metaCleanupTask, 20, 20*60); //one minute
metaCleanupTask.runTaskTimer(mcMMO.p, 20, 20*60); //one minute
}
} else {
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);

View File

@@ -259,13 +259,13 @@ public final class AlchemyPotionBrewer {
}
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new AlchemyBrewCheckTask(player, brewingStand));
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
}
public static void scheduleUpdate(Inventory inventory) {
for (HumanEntity humanEntity : inventory.getViewers()) {
if (humanEntity instanceof Player) {
mcMMO.p.getFoliaLib().getImpl().runAtEntity(humanEntity, new PlayerUpdateInventoryTask((Player) humanEntity));
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
}
}
}

View File

@@ -96,8 +96,7 @@ public class ArcheryManager extends SkillManager {
Location dazedLocation = defender.getLocation();
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
// defender.teleport(dazedLocation);
mcMMO.p.getFoliaLib().getImpl().teleportAsync(defender, dazedLocation);
defender.teleport(dazedLocation);
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));

View File

@@ -1,12 +1,12 @@
package com.gmail.nossr50.skills.archery;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
public class TrackedEntity extends CancellableRunnable {
public class TrackedEntity extends BukkitRunnable {
private final LivingEntity livingEntity;
private final UUID id;
private int arrowCount;
@@ -15,7 +15,7 @@ public class TrackedEntity extends CancellableRunnable {
this.livingEntity = livingEntity;
this.id = livingEntity.getUniqueId();
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(livingEntity, this, 12000, 12000);
this.runTaskTimer(mcMMO.p, 12000, 12000);
}
@Override

View File

@@ -244,7 +244,7 @@ public class FishingManager extends SkillManager {
}
public void masterAngler(@NotNull FishHook hook, int lureLevel) {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(hook, new MasterAnglerTask(hook, this, lureLevel), 1); //We run later to get the lure bonus applied
new MasterAnglerTask(hook, this, lureLevel).runTaskLater(mcMMO.p, 0); //We run later to get the lure bonus applied
}
/**

View File

@@ -39,6 +39,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -106,12 +107,12 @@ public class HerbalismManager extends SkillManager {
}
CheckBushAge checkBushAge = new CheckBushAge(blockState.getBlock(), mmoPlayer, xpReward);
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockState.getLocation(), checkBushAge, 1);
checkBushAge.runTaskLater(mcMMO.p, 1);
}
}
}
private class CheckBushAge extends CancellableRunnable {
private class CheckBushAge extends BukkitRunnable {
@NotNull Block block;
@NotNull McMMOPlayer mmoPlayer;
@@ -310,7 +311,7 @@ public class HerbalismManager extends SkillManager {
DelayedHerbalismXPCheckTask delayedHerbalismXPCheckTask = new DelayedHerbalismXPCheckTask(mmoPlayer, delayedChorusBlocks);
//Large delay because the tree takes a while to break
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mmoPlayer.getPlayer(), delayedHerbalismXPCheckTask); //Calculate Chorus XP + Bonus Drops 1 tick later
delayedHerbalismXPCheckTask.runTaskLater(mcMMO.p, 0); //Calculate Chorus XP + Bonus Drops 1 tick later
}
}
@@ -363,7 +364,7 @@ public class HerbalismManager extends SkillManager {
*
*/
//If it's a Crop we need to reward XP when its fully grown
//If its a Crop we need to reward XP when its fully grown
if(isAgeableAndFullyMature(plantData) && !isBizarreAgeable(plantData)) {
//Add metadata to mark this block for double or triple drops
markForBonusDrops(brokenPlantState);
@@ -373,17 +374,21 @@ public class HerbalismManager extends SkillManager {
}
/**
* Checks if BlockData is bizarre ageable, and we cannot trust that age for Herbalism rewards/XP reasons
* Checks if BlockData is ageable and we can trust that age for Herbalism rewards/XP reasons
* @param blockData target BlockData
* @return returns true if the BlockData is a bizarre ageable for Herbalism XP / Rewards
* @return returns true if the ageable is trustworthy for Herbalism XP / Rewards
*/
public boolean isBizarreAgeable(BlockData blockData) {
if(blockData instanceof Ageable) {
//Catcus and Sugar Canes cannot be trusted
return switch (blockData.getMaterial()) {
case CACTUS, KELP, SUGAR_CANE, BAMBOO -> true;
default -> false;
};
switch(blockData.getMaterial()) {
case CACTUS:
case KELP:
case SUGAR_CANE:
return true;
default:
return false;
}
}
return false;
@@ -737,7 +742,7 @@ public class HerbalismManager extends SkillManager {
*/
private void startReplantTask(int desiredCropAge, BlockBreakEvent blockBreakEvent, BlockState cropState, boolean isImmature) {
//Mark the plant as recently replanted to avoid accidental breakage
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new DelayedCropReplant(blockBreakEvent, cropState, desiredCropAge, isImmature), 2 * Misc.TICK_CONVERSION_FACTOR);
new DelayedCropReplant(blockBreakEvent, cropState, desiredCropAge, isImmature).runTaskLater(mcMMO.p, 20 * 2);
blockBreakEvent.getBlock().setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, true));
}

View File

@@ -130,7 +130,7 @@ public class MiningManager extends SkillManager {
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(mcMMO.p, (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
}
/**

View File

@@ -95,7 +95,7 @@ public class SwordsManager extends SkillManager {
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mmoPlayer.getPlayer(), ruptureTask, 1, 1);
ruptureTask.runTaskTimer(mcMMO.p, 0, 1);
target.setMetadata(MetadataConstants.METADATA_KEY_RUPTURE, ruptureTaskMeta);
// if (mmoPlayer.useChatNotifications()) {

View File

@@ -245,7 +245,7 @@ public class TamingManager extends SkillManager {
if(jumpAttribute != null) {
double jumpStrength = jumpAttribute.getValue();
// Taken from https://minecraft.wiki/w/Horse#Jump_strength
// Taken from https://minecraft.gamepedia.com/Horse#Jump_strength
jumpStrength = -0.1817584952 * Math.pow(jumpStrength, 3) + 3.689713992 * Math.pow(jumpStrength, 2) + 2.128599134 * jumpStrength - 0.343930367;
message = message.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseSpeed", horseLikeCreature.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue() * 43))
.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseJumpStrength", jumpStrength));

View File

@@ -2,13 +2,13 @@ package com.gmail.nossr50.skills.taming;
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.Misc;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
public class TrackedTamingEntity extends CancellableRunnable {
public class TrackedTamingEntity extends BukkitRunnable {
private final @NotNull LivingEntity livingEntity;
private final @NotNull CallOfTheWildType callOfTheWildType;
private final @NotNull Player player;
@@ -22,7 +22,7 @@ public class TrackedTamingEntity extends CancellableRunnable {
if (tamingCOTWLength > 0) {
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(livingEntity, this, length);
this.runTaskLater(mcMMO.p, length);
}
}

View File

@@ -22,9 +22,6 @@ import java.util.HashSet;
public final class BlockUtils {
public static final String SHORT_GRASS = "SHORT_GRASS";
public static final String GRASS = "GRASS";
private BlockUtils() {
}
@@ -41,21 +38,6 @@ public final class BlockUtils {
blockState.setMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, new BonusDropMeta(1, mcMMO.p));
}
/**
* Util method for compatibility across Minecraft versions, grabs the {@link Material} enum for short_grass
*
* @return the {@link Material} enum for short_grass
*/
public static Material getShortGrass() {
if (Material.getMaterial(SHORT_GRASS) != null) {
return Material.getMaterial(SHORT_GRASS);
} else if (Material.getMaterial(GRASS) != null) {
return Material.getMaterial(GRASS);
} else {
throw new UnsupportedOperationException("Unable to find short grass material");
}
}
/**
* Set up the state for a block to be seen as unnatural and cleanup any unwanted metadata from the block
* @param block target block

View File

@@ -1,28 +0,0 @@
package com.gmail.nossr50.util;
import com.tcoded.folialib.wrapper.task.WrappedTask;
import java.util.function.Consumer;
public abstract class CancellableRunnable implements Consumer<WrappedTask> {
private boolean cancelled = false;
public void cancel() {
cancelled = true;
}
public abstract void run();
@Override
public void accept(WrappedTask wrappedTask) {
// Run the task if it hasn't been cancelled
if (!cancelled) {
run();
}
// Cancel the task if it has been cancelled after running
if (cancelled) {
wrappedTask.cancel();
}
}
}

View File

@@ -112,7 +112,7 @@ public final class ChimaeraWing {
if (warmup > 0) {
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
new ChimaeraWingWarmup(mcMMOPlayer).runTaskLater(mcMMO.p, 20 * warmup);
}
else {
chimaeraExecuteTeleport();
@@ -123,18 +123,15 @@ public final class ChimaeraWing {
Player player = mcMMOPlayer.getPlayer();
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
// player.teleport(player.getBedSpawnLocation());
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
player.teleport(player.getBedSpawnLocation());
}
else {
Location spawnLocation = player.getWorld().getSpawnLocation();
if (spawnLocation.getBlock().getType() == Material.AIR) {
// player.teleport(spawnLocation);
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
player.teleport(spawnLocation);
}
else {
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
}
}

View File

@@ -367,8 +367,7 @@ public final class EventUtils {
return;
}
// teleportingPlayer.teleport(targetPlayer);
mcMMO.p.getFoliaLib().getImpl().teleportAsync(teleportingPlayer, targetPlayer.getLocation());
teleportingPlayer.teleport(targetPlayer);
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));

View File

@@ -996,8 +996,8 @@ public class MaterialMapStore {
private void fillShroomyWhiteList()
{
canMakeShroomyWhiteList.add("dirt");
canMakeShroomyWhiteList.add("grass_block");
canMakeShroomyWhiteList.add("dirt_path");
canMakeShroomyWhiteList.add("grass");
canMakeShroomyWhiteList.add("grass_path");
}
private void fillBlockCrackerWhiteList()
@@ -1010,8 +1010,8 @@ public class MaterialMapStore {
private void fillHerbalismAbilityBlackList()
{
herbalismAbilityBlackList.add("dirt");
herbalismAbilityBlackList.add("grass_block");
herbalismAbilityBlackList.add("dirt_path");
herbalismAbilityBlackList.add("grass");
herbalismAbilityBlackList.add("grass_path");
herbalismAbilityBlackList.add("farmland");
}

View File

@@ -12,6 +12,7 @@ import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -26,6 +27,7 @@ public final class Misc {
public static final int TIME_CONVERSION_FACTOR = 1000;
public static final int TICK_CONVERSION_FACTOR = 20;
public static final int TICK_MS_CONVERSION_FACTOR = 50;
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
@@ -254,7 +256,7 @@ public final class Misc {
if (player != null) {
UserManager.remove(player);
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
}
@@ -325,7 +327,7 @@ public final class Misc {
experienceOrb.setExperience(experienceValue);
}
private static class SpawnOrbTask implements Runnable {
private static class SpawnOrbTask extends BukkitRunnable {
private final Location location;
private int orbExpValue;

View File

@@ -81,7 +81,7 @@ public final class MobHealthbarUtils {
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
}
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(target, new MobHealthDisplayUpdaterTask(target), (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
}
}

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@@ -78,7 +77,7 @@ public class ExperienceBarManager {
return;
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), experienceBarHideTask, (long) delaySeconds * Misc.TICK_CONVERSION_FACTOR);
experienceBarHideTask.runTaskLater(plugin, 20L * delaySeconds);
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
}

View File

@@ -16,6 +16,7 @@ import com.gmail.nossr50.util.sounds.SoundType;
import com.gmail.nossr50.util.text.McMMOMessageType;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
@@ -30,6 +31,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.time.LocalDate;
import java.util.concurrent.TimeUnit;
public class NotificationManager {
@@ -48,9 +50,7 @@ public class NotificationManager {
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
McMMOMessageType destination
= mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(notificationType)
? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
McMMOMessageType destination = mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
Component message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
@@ -76,8 +76,7 @@ public class NotificationManager {
* @param key Locale Key for the string to use with this event
* @param values values to be injected into the locale string
*/
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
String... values)
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
{
sendPlayerInformation(targetPlayer, notificationType, key, values);
}
@@ -101,8 +100,7 @@ public class NotificationManager {
player.sendMessage(prefixFormattedMessage);
}
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
String... values)
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
{
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
@@ -122,28 +120,24 @@ public class NotificationManager {
final Audience audience = mcMMO.getAudiences().player(player);
//If the message is being sent to the action bar we need to check if the copy if a copy is sent to the chat system
Component notificationTextComponent = customEvent.getNotificationTextComponent();
if(customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR)
{
audience.sendActionBar(notificationTextComponent);
audience.sendActionBar(customEvent.getNotificationTextComponent());
if(customEvent.isMessageAlsoBeingSentToChat())
{
//Send copy to chat system
audience.sendMessage(notificationTextComponent);
audience.sendMessage(Identity.nil(), customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
}
} else {
audience.sendMessage(notificationTextComponent);
audience.sendMessage(Identity.nil(), customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
}
}
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType,
McMMOMessageType destination,
Component message) {
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, McMMOMessageType destination, Component message) {
//Init event
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
notificationType, message, destination,
mcMMO.p.getAdvancedConfig().doesNotificationSendCopyToChat(notificationType));
notificationType, message, destination, mcMMO.p.getAdvancedConfig().doesNotificationSendCopyToChat(notificationType));
//Call event
Bukkit.getServer().getPluginManager().callEvent(customEvent);
@@ -156,23 +150,15 @@ public class NotificationManager {
* @param skillName skill that leveled up
* @param newLevel new level of that skill
*/
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
int levelsGained, int newLevel)
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel)
{
if(!mcMMOPlayer.useChatNotifications())
return;
McMMOMessageType destination
= mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE)
? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
McMMOMessageType destination = mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(
skillName, levelsGained, newLevel);
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(
mcMMOPlayer.getPlayer(),
NotificationType.LEVEL_UP_MESSAGE,
destination,
levelUpTextComponent);
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
}
@@ -191,12 +177,17 @@ public class NotificationManager {
return;
//CHAT MESSAGE
mcMMO.getAudiences().player(mcMMOPlayer.getPlayer()).sendMessage(Identity.nil(),
TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
mcMMO.getAudiences().player(mcMMOPlayer.getPlayer()).sendMessage(Identity.nil(), TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
//Unlock Sound Effect
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(),
SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
//ACTION BAR MESSAGE
/*if(mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.SUBSKILL_UNLOCKED))
mcMMOPlayer.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(LocaleLoader.getString("JSON.SkillUnlockMessage",
subSkillType.getLocaleName(),
String.valueOf(RankUtils.getRank(mcMMOPlayer.getPlayer(),
subSkillType)))));*/
}
/**
@@ -235,8 +226,7 @@ public class NotificationManager {
* @param commandSender the command user
* @param sensitiveCommandType type of command issued
*/
public static void processSensitiveCommandNotification(CommandSender commandSender,
SensitiveCommandType sensitiveCommandType, String... args) {
public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) {
/*
* Determine the 'identity' of the one who executed the command to pass as a parameters
*/
@@ -244,26 +234,19 @@ public class NotificationManager {
if(commandSender instanceof Player)
{
senderName = ((Player) commandSender).getDisplayName()
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
senderName = ((Player) commandSender).getDisplayName() + ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
}
//Send the notification
switch(sensitiveCommandType)
{
case XPRATE_MODIFY:
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(
commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
break;
case XPRATE_END:
sendAdminNotification(
LocaleLoader.getString(
"Notifications.Admin.XPRate.End.Others",
addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender,
LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args));
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args));
break;
}
}
@@ -284,6 +267,8 @@ public class NotificationManager {
return newArray;
}
//TODO: Remove the code duplication, am lazy atm
//TODO: Fix broadcasts being skipped for situations where a player skips over the milestone like with the addlevels command
public static void processLevelUpBroadcasting(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int level) {
if(level <= 0)
return;
@@ -306,22 +291,13 @@ public class NotificationManager {
.append(Component.newline())
.append(Component.text(LocalDate.now().toString()))
.append(Component.newline())
.append(Component.text(
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType)
+ " reached level "+level)).color(TextColor.fromHexString(HEX_BEIGE_COLOR))
.append(Component.text(mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType)+" reached level "+level)).color(TextColor.fromHexString(HEX_BEIGE_COLOR))
.asHoverEvent();
String localeMessage = LocaleLoader.getString(
"Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level,
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
Component component = LegacyComponentSerializer
.legacySection()
.deserialize(localeMessage)
.hoverEvent(levelMilestoneHover);
String localeMessage = LocaleLoader.getString("Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level, mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
// TODO: Update system msg API
mcMMO.p.getFoliaLib().getImpl().runNextTick(
t -> audience.sendMessage(component));
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> audience.sendMessage(Identity.nil(), message));
}
}
}
@@ -356,7 +332,7 @@ public class NotificationManager {
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(message));
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> audience.sendMessage(Identity.nil(), message));
}
}
}

View File

@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ScoreboardWrapper {
public static final String SIDE_OBJECTIVE = "mcMMO_sideObjective";
@@ -86,36 +87,38 @@ public class ScoreboardWrapper {
public WrappedTask updateTask = null;
private class ScoreboardQuickUpdate implements Runnable {
@Override
public void run() {
updateSidebar();
updateTask = null;
private class ScoreboardQuickUpdate {
public WrappedTask runTaskLater(long delay) {
return mcMMO.p.getFoliaLib().getImpl().runLater(() -> {
updateSidebar();
updateTask = null;
}, delay * Misc.TICK_CONVERSION_FACTOR, TimeUnit.MILLISECONDS);
}
}
public WrappedTask revertTask = null;
private class ScoreboardChangeTask implements Runnable {
@Override
public void run() {
tryRevertBoard();
revertTask = null;
private class ScoreboardChangeTask {
public WrappedTask runTaskLater(long delay) {
return mcMMO.p.getFoliaLib().getImpl().runLater(() -> {
tryRevertBoard();
revertTask = null;
}, delay * Misc.TICK_CONVERSION_FACTOR, TimeUnit.MILLISECONDS);
}
}
public WrappedTask cooldownTask = null;
private class ScoreboardCooldownTask implements Runnable {
@Override
public void run() {
// Stop updating if it's no longer something displaying cooldowns
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
doSidebarUpdateSoon();
}
else {
stopCooldownUpdating();
}
private class ScoreboardCooldownTask {
public WrappedTask runTaskTimer(long delay, long period) {
return mcMMO.p.getFoliaLib().getImpl().runTimer(() -> {
// Stop updating if it's no longer something displaying cooldowns
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
doSidebarUpdateSoon();
} else {
stopCooldownUpdating();
}
}, delay, period, TimeUnit.MILLISECONDS);
}
}
@@ -123,7 +126,7 @@ public class ScoreboardWrapper {
public void doSidebarUpdateSoon() {
if (updateTask == null) {
// To avoid spamming the scheduler, store the instance and run 2 ticks later
updateTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardQuickUpdate(), 2L);
updateTask = new ScoreboardQuickUpdate().runTaskLater(2L);
}
}
@@ -131,7 +134,7 @@ public class ScoreboardWrapper {
if (cooldownTask == null) {
// Repeat every 5 seconds.
// Cancels once all cooldowns are done, using stopCooldownUpdating().
cooldownTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(player, new ScoreboardCooldownTask(), 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
cooldownTask = new ScoreboardCooldownTask().runTaskTimer(5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
}
}
@@ -214,7 +217,7 @@ public class ScoreboardWrapper {
}
player.setScoreboard(scoreboard);
revertTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardChangeTask(), ticks);
revertTask = new ScoreboardChangeTask().runTaskLater(ticks);
// TODO is there any way to do the time that looks acceptable?
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F));
@@ -424,7 +427,7 @@ public class ScoreboardWrapper {
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
initBoard(); //Start over
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, t -> ScoreboardManager.retryLastSkillBoard(player));
mcMMO.p.getFoliaLib().getImpl().runLater(() -> ScoreboardManager.retryLastSkillBoard(player), 0, TimeUnit.MILLISECONDS);
}
}

View File

@@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
@@ -39,6 +40,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.concurrent.TimeUnit;
public final class CombatUtils {
@@ -806,7 +808,7 @@ public final class CombatUtils {
baseXP *= multiplier;
if (baseXP != 0) {
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mcMMOPlayer.getPlayer(), new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason).runTaskLater(mcMMO.p, 0);
}
}
@@ -981,6 +983,6 @@ public final class CombatUtils {
* @param entity the projectile
*/
public static void delayArrowMetaCleanup(@NotNull Projectile entity) {
mcMMO.p.getFoliaLib().getImpl().runLater(() -> cleanupArrowMetadata(entity), 20*60);
mcMMO.p.getFoliaLib().getImpl().runLater(() -> cleanupArrowMetadata(entity), 1000 * 60, TimeUnit.MILLISECONDS);
}
}

View File

@@ -48,7 +48,7 @@ public class RankUtils {
{
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), skillUnlockNotificationTask, (count * 100L));
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100L));
count++;
}
@@ -291,12 +291,30 @@ public class RankUtils {
subSkillRanks.computeIfAbsent(s, k -> new HashMap<>());
}
/* public static int getSubSkillUnlockRequirement(SubSkillType subSkillType)
{
String skillName = subSkillType.toString();
int numRanks = subSkillType.getNumRanks();
if(subSkillRanks == null)
subSkillRanks = new HashMap<>();
if(numRanks == 0)
return -1; //-1 Means the skill doesn't have ranks
if(subSkillRanks.get(skillName) == null && numRanks > 0)
addRanks(subSkillType);
return subSkillRanks.get(subSkillType.toString()).get(1);
}*/
/**
* Gets the unlock level for a specific rank in a subskill
* @param subSkillType The target subskill
* @param rank The target rank
* @return The level at which this rank unlocks
*/
@Deprecated
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank)
{
return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, rank);

View File

@@ -12,6 +12,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
@@ -33,37 +35,41 @@ public class TextComponentFactory {
/**
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
*
* @param localeKey target locale string address
* @param values vars to be passed to the locale loader
* @param values vars to be passed to the locale loader
* @return
*/
public static TextComponent getNotificationMultipleValues(String localeKey, String... values) {
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
{
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
return Component.text(preColoredString);
}
public static Component getNotificationTextComponentFromLocale(String localeKey) {
public static Component getNotificationTextComponentFromLocale(String localeKey)
{
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
}
public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel) {
return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name." + StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel)
{
return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+ StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
}
private static TextComponent getNotificationTextComponent(String text) {
private static TextComponent getNotificationTextComponent(String text)
{
//textComponent.setColor(getNotificationColor(notificationType));
return Component.text(text);
}
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted) {
if (!mcMMO.p.getGeneralConfig().getUrlLinksEnabled())
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
{
if(!mcMMO.p.getGeneralConfig().getUrlLinksEnabled())
return;
TextComponent.Builder wikiLinkComponent = Component.text().content(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
wikiLinkComponent.decoration(TextDecoration.UNDERLINED, true);
String wikiUrl = "https://wiki.mcmmo.org/" + subskillformatted;
String wikiUrl = "https://wiki.mcmmo.org/"+subskillformatted;
wikiLinkComponent.clickEvent(ClickEvent.openUrl(wikiUrl));
@@ -71,40 +77,39 @@ public class TextComponentFactory {
wikiLinkComponent.hoverEvent(HoverEvent.showText(componentBuilder.build()));
mcMMO.getAudiences().player(player).sendMessage(wikiLinkComponent);
mcMMO.getAudiences().player(player).sendMessage(Identity.nil(), wikiLinkComponent, MessageType.SYSTEM);
}
public static void sendPlayerUrlHeader(Player player) {
TextComponent prefix = Component.text(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
/*prefix.setColor(ChatColor.DARK_AQUA);*/
TextComponent suffix = Component.text(" " + LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
TextComponent suffix = Component.text(" "+LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
/*suffix.setColor(ChatColor.DARK_AQUA);*/
TextComponent emptySpace = Component.space();
// TODO: Update system msg API
mcMMO.getAudiences().player(player).sendMessage(Component.textOfChildren(
prefix,
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.DISCORD),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.PATREON),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.WIKI),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
suffix
));
mcMMO.getAudiences().player(player).sendMessage(Identity.nil(),TextComponent.ofChildren(
prefix,
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.DISCORD),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.PATREON),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.WIKI),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
emptySpace,
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
suffix
), MessageType.SYSTEM);
}
/**
* Sends a player a bunch of text components that represent a list of sub-skills
* Styling and formatting is applied before sending the messages
*
* @param player target player
* @param player target player
* @param subSkillComponents the text components representing the sub-skills by name
*/
public static void sendPlayerSubSkillList(@NotNull Player player, @NotNull List<Component> subSkillComponents) {
@@ -124,15 +129,17 @@ public class TextComponentFactory {
}
//Send each group
for (Component curLine : individualLinesToSend) {
audience.sendMessage(curLine);
for(Component curLine : individualLinesToSend) {
audience.sendMessage(Identity.nil(), curLine);
}
}
private static Component getWebLinkTextComponent(McMMOWebLinks webLinks) {
private static Component getWebLinkTextComponent(McMMOWebLinks webLinks)
{
TextComponent.Builder webTextComponent;
switch (webLinks) {
switch(webLinks)
{
case WEBSITE:
webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
TextUtils.addChildWebComponent(webTextComponent, "Web");
@@ -173,10 +180,12 @@ public class TextComponentFactory {
return webTextComponent.build();
}
private static Component getUrlHoverEvent(McMMOWebLinks webLinks) {
private static Component getUrlHoverEvent(McMMOWebLinks webLinks)
{
TextComponent.Builder componentBuilder = Component.text().content(webLinks.getNiceTitle());
switch (webLinks) {
switch(webLinks)
{
case WEBSITE:
addUrlHeaderHover(webLinks, componentBuilder);
componentBuilder.append(Component.newline()).append(Component.newline());
@@ -214,7 +223,7 @@ public class TextComponentFactory {
componentBuilder.append(Component.text(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
componentBuilder.append(Component.newline());
componentBuilder.append(Component.text("You can use this website to help translate mcMMO into your language!" +
"\nIf you want to know more contact me in discord.", NamedTextColor.DARK_GRAY));
"\nIf you want to know more contact me in discord.", NamedTextColor.DARK_GRAY));
}
return componentBuilder.build();
@@ -225,11 +234,13 @@ public class TextComponentFactory {
componentBuilder.append(Component.text(webLinks.getUrl(), NamedTextColor.GRAY, TextDecoration.ITALIC));
}
private static ClickEvent getUrlClickEvent(String url) {
private static ClickEvent getUrlClickEvent(String url)
{
return ClickEvent.openUrl(url);
}
private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType) {
private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType)
{
//Get skill name
String skillName = subSkillType.getLocaleName();
@@ -246,7 +257,8 @@ public class TextComponentFactory {
return textComponent.build();
}
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill) {
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill)
{
//String key = abstractSubSkill.getConfigKeyName();
String skillName = abstractSubSkill.getNiceName();
@@ -285,37 +297,46 @@ public class TextComponentFactory {
return textComponent;
}
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill) {
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
{
return getSubSkillHoverEventJSON(abstractSubSkill, player);
}
private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType) {
private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
{
return getSubSkillHoverEventJSON(subSkillType, player);
}
/**
* Used for the skill in the new skill system (Deriving from AbstractSubSkill)
*
* @param abstractSubSkill this subskill
* @param player the player who owns this subskill
* @param player the player who owns this subskill
* @return the hover basecomponent object for this subskill
*/
private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player) {
private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player)
{
String skillName = abstractSubSkill.getNiceName();
/*
* Hover Event BaseComponent color table
*/
TextColor ccLocked = NamedTextColor.DARK_GRAY;
TextColor ccLevelRequirement = NamedTextColor.BLUE;
TextColor ccLevelRequired = NamedTextColor.RED;
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
TextColor ccRank = NamedTextColor.BLUE;
TextColor ccCurRank = NamedTextColor.GREEN;
TextColor ccPossessive = NamedTextColor.WHITE;
//ChatColor ccDescriptionHeader = ChatColor.DARK_PURPLE;
//ChatColor ccDescription = ChatColor.WHITE;
TextColor ccLocked = NamedTextColor.DARK_GRAY;
TextColor ccLevelRequirement = NamedTextColor.BLUE;
TextColor ccLevelRequired = NamedTextColor.RED;
SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
//SubSkillType Name
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
if (!RankUtils.hasUnlockedSubskill(player, abstractSubSkill)) {
if(!RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
{
//Skill is not unlocked yet
addLocked(abstractSubSkill, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
} else {
@@ -325,11 +346,12 @@ public class TextComponentFactory {
int curRank = RankUtils.getRank(player, abstractSubSkill);
int nextRank = 0;
if (curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0) {
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank + 1);
if(curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0)
{
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank+1);
}
addRanked(componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
addRanked(ccRank, ccCurRank, ccPossessive, ccCurRank, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.DescriptionHeader")));
componentBuilder.append(Component.newline()).append(Component.text(abstractSubSkill.getDescription())).append(Component.newline());
@@ -364,14 +386,17 @@ public class TextComponentFactory {
return componentBuilder;
}
private static void addRanked(TextComponent.Builder componentBuilder, int numRanks, int rank, int nextRank) {
private static void addRanked(TextColor ccRank, TextColor ccCurRank, TextColor ccPossessive, TextColor ccNumRanks, TextComponent.Builder componentBuilder, int numRanks, int rank, int nextRank) {
if (numRanks > 0) {
//Rank: x
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank)))).append(Component.newline());
//Next Rank: x
if (nextRank > rank)
if(nextRank > rank)
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank)))).append(Component.newline());
/*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
}
}
@@ -393,38 +418,47 @@ public class TextComponentFactory {
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.LevelRequirement") + ": ", ccLevelRequirement));
}
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player) {
@Deprecated
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
{
String skillName = subSkillType.getLocaleName();
/*
* Hover Event BaseComponent color table
*/
TextColor ccDescriptionHeader = NamedTextColor.DARK_PURPLE;
TextColor ccDescription = NamedTextColor.DARK_GRAY;
TextColor ccLocked = NamedTextColor.DARK_GRAY;
TextColor ccLevelRequirement = NamedTextColor.BLUE;
TextColor ccLevelRequired = NamedTextColor.RED;
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
TextColor ccRank = NamedTextColor.BLUE;
TextColor ccCurRank = NamedTextColor.GREEN;
TextColor ccPossessive = NamedTextColor.WHITE;
TextColor ccDescriptionHeader = NamedTextColor.DARK_PURPLE;
TextColor ccDescription = NamedTextColor.DARK_GRAY;
TextColor ccLocked = NamedTextColor.DARK_GRAY;
TextColor ccLevelRequirement = NamedTextColor.BLUE;
TextColor ccLevelRequired = NamedTextColor.RED;
//SubSkillType Name
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
if (!RankUtils.hasUnlockedSubskill(player, subSkillType)) {
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
{
//Skill is not unlocked yet
addLocked(subSkillType, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
} else {
//addSubSkillTypeToHoverEventJSON(subSkillType, componentBuilder);
//RANK
if (subSkillType.getNumRanks() > 0) {
if(subSkillType.getNumRanks() > 0)
{
int curRank = RankUtils.getRank(player, subSkillType);
int nextRank = 0;
if (curRank < subSkillType.getNumRanks()) {
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank + 1);
if(curRank < subSkillType.getNumRanks())
{
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank+1);
}
addRanked(componentBuilder, subSkillType.getNumRanks(),
RankUtils.getRank(player, subSkillType), nextRank);
addRanked(ccRank, ccCurRank, ccPossessive, ccCurRank, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType), nextRank);
}
componentBuilder.append(Component.newline());
@@ -438,52 +472,55 @@ public class TextComponentFactory {
return componentBuilder.build();
}
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill,
TextComponent.Builder componentBuilder) {
if (abstractSubSkill.isSuperAbility()) {
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.SuperAbility"),
NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
} else if (abstractSubSkill.isActiveUse()) {
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Active"),
NamedTextColor.DARK_RED, TextDecoration.BOLD));
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, TextComponent.Builder componentBuilder)
{
if(abstractSubSkill.isSuperAbility())
{
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.SuperAbility"), NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
} else if(abstractSubSkill.isActiveUse())
{
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Active"), NamedTextColor.DARK_RED, TextDecoration.BOLD));
} else {
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Passive"),
NamedTextColor.GREEN, TextDecoration.BOLD));
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Passive"), NamedTextColor.GREEN, TextDecoration.BOLD));
}
componentBuilder.append(Component.newline());
}
public static void getSubSkillTextComponents(Player player, List<Component> textComponents,
PrimarySkillType parentSkill) {
for (SubSkillType subSkillType : SubSkillType.values()) {
if (subSkillType.getParentSkill() == parentSkill) {
public static void getSubSkillTextComponents(Player player, List<Component> textComponents, PrimarySkillType parentSkill) {
for(SubSkillType subSkillType : SubSkillType.values())
{
if(subSkillType.getParentSkill() == parentSkill)
{
//TODO: Hacky rewrite later
//Only some versions of MC have this skill
if (subSkillType == SubSkillType.FISHING_MASTER_ANGLER
&& mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() == null)
if(subSkillType == SubSkillType.FISHING_MASTER_ANGLER && mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() == null)
continue;
if (Permissions.isSubSkillEnabled(player, subSkillType)) {
if (!InteractionManager.hasSubSkill(subSkillType))
if(Permissions.isSubSkillEnabled(player, subSkillType))
{
if(!InteractionManager.hasSubSkill(subSkillType))
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType));
}
}
}
/* NEW SKILL SYSTEM */
for (AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList()) {
if (abstractSubSkill.getPrimarySkill() == parentSkill) {
if (Permissions.isSubSkillEnabled(player, abstractSubSkill))
for(AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList())
{
if(abstractSubSkill.getPrimarySkill() == parentSkill)
{
if(Permissions.isSubSkillEnabled(player, abstractSubSkill))
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, abstractSubSkill));
}
}
}
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType)
{
TextComponent.Builder unlockMessage = Component.text().content(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
unlockMessage.hoverEvent(HoverEvent.showText(getSubSkillHoverComponent(player, subSkillType)));
unlockMessage.clickEvent(ClickEvent.runCommand("/" + subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
unlockMessage.clickEvent(ClickEvent.runCommand("/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
return unlockMessage.build();
}
}

View File

@@ -209,14 +209,7 @@ Skills:
Fishing:
ShakeChance:
Rank_1: 15.0
Rank_2: 20.0
Rank_3: 25.0
Rank_4: 35.0
Rank_5: 45.0
Rank_6: 55.0
Rank_7: 65.0
Rank_8: 75.0
Rank_1: 30
# VanillaXPMultiplier: Vanilla XP gained from fishing is multiplied by these values.
VanillaXPMultiplier:

View File

@@ -393,7 +393,6 @@ Experience_Values:
Rose_Bush: 50
Fern: 10
Grass: 10
Short_Grass: 10
Sugar_Cane: 30
Sunflower: 50
Tall_Grass: 50

View File

@@ -406,22 +406,8 @@ Fishing:
Shake:
Standard:
Rank_1: 15
Rank_2: 20
Rank_3: 25
Rank_4: 30
Rank_5: 40
Rank_6: 50
Rank_7: 60
Rank_8: 70
RetroMode:
Rank_1: 150
Rank_2: 200
Rank_3: 250
Rank_4: 300
Rank_5: 400
Rank_6: 500
Rank_7: 600
Rank_8: 700
MasterAngler:
Standard:
Rank_1: 1