mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into endgame
This commit is contained in:
commit
c8dedfc980
@ -56,10 +56,41 @@ Version 2.2.000
|
|||||||
New Power Level Command
|
New Power Level Command
|
||||||
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
||||||
|
|
||||||
|
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
|
||||||
|
A lot of mcMMO logging was moved from INFO to DEBUG, this should reduce the amount of noise in your logs and console
|
||||||
|
|
||||||
|
NOTES: If you want to see all logging messages, modify config.yml and set General.Verbose_Logging to true
|
||||||
|
You will have to adjust experience.yml to get the balance changes, or delete it to generate a new one
|
||||||
Version 2.1.221
|
Version 2.1.221
|
||||||
|
PAPI Support is now built into mcMMO and loads when mcMMO loads (as long as you have PAPI running)
|
||||||
Fixed blast mining bonus drops not working (Thanks warriiorrrr)
|
Fixed blast mining bonus drops not working (Thanks warriiorrrr)
|
||||||
Added fail safes to prevent bonus drops metadata from lingering on blocks
|
Added fail safes to prevent bonus drops metadata from lingering on blocks
|
||||||
|
|
||||||
|
NOTES: Placeholders were brought in from electroniccat's original work on a PAPI expansion for mcMMO, the placeholders are the same as a result
|
||||||
|
I will be adding a leaderboard placeholder in the next patch (most likely). Feel free to share details of what functionality you'd want from additional placeholders on discord.
|
||||||
Version 2.1.220
|
Version 2.1.220
|
||||||
(API) Added TreeFellerBlockBreakEvent class which extends FakeBlockBreakEvent (see notes), this is sent out during Tree Feller processing to allow other plugins to differentiate between Tree Feller and other fake block break events
|
(API) Added TreeFellerBlockBreakEvent class which extends FakeBlockBreakEvent (see notes), this is sent out during Tree Feller processing to allow other plugins to differentiate between Tree Feller and other fake block break events
|
||||||
Config files update automatically again
|
Config files update automatically again
|
||||||
|
@ -29,6 +29,12 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
|
|||||||
#### Classic Maintainer
|
#### Classic Maintainer
|
||||||
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
|
[![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 Team Members
|
||||||
|
|
||||||
### Former Lead & Awesome guy
|
### Former Lead & Awesome guy
|
||||||
|
112
pom.xml
Executable file → Normal file
112
pom.xml
Executable file → Normal file
@ -150,20 +150,20 @@
|
|||||||
<include>net.kyori:examination-api</include>
|
<include>net.kyori:examination-api</include>
|
||||||
<include>net.kyori:examination-string</include>
|
<include>net.kyori:examination-string</include>
|
||||||
<include>net.kyori:adventure-text-serializer-legacy</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-bungeecord</include>
|
||||||
<include>net.kyori:adventure-text-serializer-craftbukkit</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-gson-legacy-impl</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
|
||||||
<include>co.aikar:acf-bukkit</include>
|
<include>co.aikar:acf-bukkit</include>
|
||||||
|
<include>com.tcoded:FoliaLib</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.examination</pattern>
|
<pattern>net.kyori</pattern>
|
||||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.examination</shadedPattern>
|
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>net.kyori.adventure</pattern>
|
|
||||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.adventure</shadedPattern>
|
|
||||||
</relocation>
|
</relocation>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>co.aikar.commands</pattern>
|
<pattern>co.aikar.commands</pattern>
|
||||||
@ -189,6 +189,10 @@
|
|||||||
<pattern>org.bstats</pattern>
|
<pattern>org.bstats</pattern>
|
||||||
<shadedPattern>com.gmail.nossr50.mcmmo.metrics.bstats</shadedPattern>
|
<shadedPattern>com.gmail.nossr50.mcmmo.metrics.bstats</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.tcoded.folialib</pattern>
|
||||||
|
<shadedPattern>com.gmail.nossr50.mcmmo.folialib</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@ -241,50 +245,88 @@
|
|||||||
<id>sonatype-oss-snapshots1</id>
|
<id>sonatype-oss-snapshots1</id>
|
||||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>placeholderapi</id>
|
||||||
|
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>devmart-other</id>
|
||||||
|
<url>https://nexuslite.gcnt.net/repos/other/</url>
|
||||||
|
</repository>
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.clip</groupId>
|
||||||
|
<artifactId>placeholderapi</artifactId>
|
||||||
|
<version>2.11.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>co.aikar</groupId>
|
<groupId>co.aikar</groupId>
|
||||||
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
|
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
|
||||||
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
|
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-text-serializer-bungeecord</artifactId>
|
||||||
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||||
<version>4.13.0</version>
|
<version>4.14.0</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-api</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-nbt</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-key</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
||||||
<version>4.13.0</version>
|
<version>4.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
<artifactId>adventure-text-serializer-json</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-api</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-nbt</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-key</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-api</artifactId>
|
<artifactId>adventure-platform-api</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
|
<version>4.3.1</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>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
@ -300,7 +342,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
<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>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -359,7 +407,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>31.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
|
<version>32.1.1-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>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.gmail.nossr50.api;
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEvent;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {
|
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {
|
||||||
|
@ -204,7 +204,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||||
skillName = "Woodcutting";
|
skillName = "Woodcutting";
|
||||||
}
|
}
|
||||||
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
||||||
skillName = "Herbalism";
|
skillName = "Herbalism";
|
||||||
}
|
}
|
||||||
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
||||||
|
@ -64,10 +64,10 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
mcMMO.getDatabaseManager().saveUser(profile);
|
mcMMO.getDatabaseManager().saveUser(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
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().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
|
|
||||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
|||||||
UserManager.saveAll();
|
UserManager.saveAll();
|
||||||
UserManager.clearAll();
|
UserManager.clearAll();
|
||||||
|
|
||||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
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().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -250,7 +250,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||||
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||||
|
@ -111,7 +111,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
||||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
||||||
|
|
||||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
||||||
|
@ -115,7 +115,7 @@ public class MctopCommand implements TabExecutor {
|
|||||||
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
||||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
||||||
|
|
||||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -31,7 +32,7 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
|
|||||||
|
|
||||||
protected void saveConfig() {
|
protected void saveConfig() {
|
||||||
try {
|
try {
|
||||||
mcMMO.p.getLogger().info("Saving changes to config file - " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Saving changes to config file - " + fileName);
|
||||||
config.options().indent(2);
|
config.options().indent(2);
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -58,9 +59,9 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
|
|||||||
oldKeys.removeAll(internalConfigKeys);
|
oldKeys.removeAll(internalConfigKeys);
|
||||||
|
|
||||||
if (!oldKeys.isEmpty()) {
|
if (!oldKeys.isEmpty()) {
|
||||||
mcMMO.p.debug("old key(s) in \"" + fileName + "\"");
|
LogUtils.debug(mcMMO.p.getLogger(), "old key(s) in \"" + fileName + "\"");
|
||||||
for (String key : oldKeys) {
|
for (String key : oldKeys) {
|
||||||
mcMMO.p.debug(" old-key:" + key);
|
LogUtils.debug(mcMMO.p.getLogger(), " old-key:" + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String key : newKeys) {
|
for (String key : newKeys) {
|
||||||
mcMMO.p.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
LogUtils.debug(mcMMO.p.getLogger(), "Adding new key: " + key + " = " + internalConfig.get(key));
|
||||||
config.set(key, internalConfig.get(key));
|
config.set(key, internalConfig.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -22,7 +23,7 @@ public abstract class BukkitConfig {
|
|||||||
private boolean savedDefaults = false;
|
private boolean savedDefaults = false;
|
||||||
|
|
||||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
|
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
|
||||||
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Initializing config: " + fileName);
|
||||||
this.copyDefaults = copyDefaults;
|
this.copyDefaults = copyDefaults;
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
@ -30,7 +31,7 @@ public abstract class BukkitConfig {
|
|||||||
this.defaultYamlConfig = saveDefaultConfigToDisk();
|
this.defaultYamlConfig = saveDefaultConfigToDisk();
|
||||||
this.config = initConfig();
|
this.config = initConfig();
|
||||||
updateFile();
|
updateFile();
|
||||||
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Config initialized: " + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||||
@ -81,10 +82,10 @@ public abstract class BukkitConfig {
|
|||||||
* Copies the config from the JAR to defaults/<fileName>
|
* Copies the config from the JAR to defaults/<fileName>
|
||||||
*/
|
*/
|
||||||
YamlConfiguration saveDefaultConfigToDisk() {
|
YamlConfiguration saveDefaultConfigToDisk() {
|
||||||
mcMMO.p.getLogger().info("[config] Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
||||||
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
||||||
if(inputStream == null) {
|
if(inputStream == null) {
|
||||||
mcMMO.p.getLogger().severe("[config] Unable to copy default config: " + fileName);
|
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,11 +110,11 @@ public abstract class BukkitConfig {
|
|||||||
|
|
||||||
YamlConfiguration initConfig() {
|
YamlConfiguration initConfig() {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
mcMMO.p.getLogger().info("[config] User config file not found, copying a default config to disk: " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "User config file not found, copying a default config to disk: " + fileName);
|
||||||
mcMMO.p.saveResource(fileName, false);
|
mcMMO.p.saveResource(fileName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("[config] Loading config from disk: " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Loading config from disk: " + fileName);
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
config.options().indent(4);
|
config.options().indent(4);
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ public abstract class BukkitConfig {
|
|||||||
|
|
||||||
protected void validate() {
|
protected void validate() {
|
||||||
if (validateKeys()) {
|
if (validateKeys()) {
|
||||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||||
@ -160,8 +161,8 @@ public abstract class BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void backup() {
|
public void backup() {
|
||||||
mcMMO.p.getLogger().info("You are using an old version of the " + fileName + " file.");
|
LogUtils.debug(mcMMO.p.getLogger(), "You are using an old version of the " + fileName + " file.");
|
||||||
mcMMO.p.getLogger().info("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
||||||
|
|
||||||
configFile.renameTo(new File(configFile.getPath() + ".old"));
|
configFile.renameTo(new File(configFile.getPath() + ".old"));
|
||||||
|
|
||||||
|
@ -1006,5 +1006,9 @@ public class GeneralConfig extends BukkitConfig {
|
|||||||
return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true);
|
return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean useVerboseLogging() {
|
||||||
|
return config.getBoolean("General.Verbose_Logging", false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); }
|
public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ public abstract class LegacyConfigLoader {
|
|||||||
|
|
||||||
protected void loadFile() {
|
protected void loadFile() {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
mcMMO.p.getLogger().info("Creating mcMMO " + fileName + " File...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mcMMO.p.saveResource(fileName, false); // Normal files
|
mcMMO.p.saveResource(fileName, false); // Normal files
|
||||||
@ -54,7 +55,7 @@ public abstract class LegacyConfigLoader {
|
|||||||
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().info("Loading mcMMO " + fileName + " File...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File...");
|
||||||
}
|
}
|
||||||
|
|
||||||
config = YamlConfiguration.loadConfiguration(configFile);
|
config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
@ -76,7 +77,7 @@ public abstract class LegacyConfigLoader {
|
|||||||
|
|
||||||
protected void validate() {
|
protected void validate() {
|
||||||
if (validateKeys()) {
|
if (validateKeys()) {
|
||||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -130,7 +131,7 @@ public class RankConfig extends BukkitConfig {
|
|||||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||||
int defaultValue = defaultYamlConfig.getInt(key);
|
int defaultValue = defaultYamlConfig.getInt(key);
|
||||||
config.set(key, defaultValue);
|
config.set(key, defaultValue);
|
||||||
mcMMO.p.getLogger().info(key + " SET -> " + defaultValue);
|
LogUtils.debug(mcMMO.p.getLogger(), key + " SET -> " + defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,10 +148,10 @@ public class RankConfig extends BukkitConfig {
|
|||||||
if (badSkillSetup.isEmpty())
|
if (badSkillSetup.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
||||||
|
|
||||||
for (SubSkillType subSkillType : badSkillSetup) {
|
for (SubSkillType subSkillType : badSkillSetup) {
|
||||||
mcMMO.p.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
|
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
|
||||||
fixBadEntries(subSkillType);
|
fixBadEntries(subSkillType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +179,7 @@ public class RankConfig extends BukkitConfig {
|
|||||||
|
|
||||||
if (prevRank > curRank) {
|
if (prevRank > curRank) {
|
||||||
//We're going to allow this but we're going to warn them
|
//We're going to allow this but we're going to warn them
|
||||||
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
|
LogUtils.debug(mcMMO.p.getLogger(), "(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
|
||||||
badSkillSetup.add(subSkillType);
|
badSkillSetup.add(subSkillType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
|
|
||||||
public class SoundConfig extends BukkitConfig {
|
public class SoundConfig extends BukkitConfig {
|
||||||
@ -28,14 +29,14 @@ public class SoundConfig extends BukkitConfig {
|
|||||||
protected boolean validateKeys() {
|
protected boolean validateKeys() {
|
||||||
for (SoundType soundType : SoundType.values()) {
|
for (SoundType soundType : SoundType.values()) {
|
||||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||||
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType);
|
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound volume cannot be below 0 for " + soundType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sounds with custom pitching don't use pitch values
|
//Sounds with custom pitching don't use pitch values
|
||||||
if (!soundType.usesCustomPitch()) {
|
if (!soundType.usesCustomPitch()) {
|
||||||
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
||||||
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType);
|
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound pitch cannot be below 0 for " + soundType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,8 @@ public class WorldBlacklist {
|
|||||||
closeRead(fileReader);
|
closeRead(fileReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
if(blacklist.size() > 0)
|
||||||
|
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeRead(Reader reader) {
|
private void closeRead(Reader reader) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.config.skills.alchemy;
|
|||||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -100,7 +101,7 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.debug("Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
|
LogUtils.debug(mcMMO.p.getLogger(), "Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -48,7 +49,7 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
Material itemMaterial = Material.matchMaterial(key);
|
Material itemMaterial = Material.matchMaterial(key);
|
||||||
|
|
||||||
if (itemMaterial == null) {
|
if (itemMaterial == null) {
|
||||||
//mcMMO.p.getLogger().info("No support for repair item "+key+ " in this version of Minecraft, skipping.");
|
//LogUtils.debug(mcMMO.p.getLogger(), "No support for repair item "+key+ " in this version of Minecraft, skipping.");
|
||||||
notSupported.add(key); //Collect names of unsupported items
|
notSupported.add(key); //Collect names of unsupported items
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -160,8 +161,8 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info(stringBuilder.toString());
|
LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString());
|
||||||
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -15,6 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class SalvageConfig extends BukkitConfig {
|
public class SalvageConfig extends BukkitConfig {
|
||||||
private final HashSet<String> notSupported;
|
private final HashSet<String> notSupported;
|
||||||
@ -41,7 +43,7 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
||||||
|
|
||||||
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
||||||
mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
mcMMO.p.getLogger().log(Level.INFO, "Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
||||||
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
|
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
|
||||||
}
|
}
|
||||||
@ -49,9 +51,9 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
config.save(getFile());
|
config.save(getFile());
|
||||||
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES);
|
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES);
|
||||||
mcMMO.p.getLogger().info("Fixed incorrect Salvage quantities for Netherite gear!");
|
LogUtils.debug(mcMMO.p.getLogger(), "Fixed incorrect Salvage quantities for Netherite gear!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
mcMMO.p.getLogger().info("Unable to fix Salvage config, please delete the salvage yml file to generate a new one.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Unable to fix Salvage config, please delete the salvage yml file to generate a new one.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,8 +180,8 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info(stringBuilder.toString());
|
LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString());
|
||||||
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.config.BukkitConfig;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.*;
|
import com.gmail.nossr50.datatypes.treasure.*;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -332,7 +333,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!foundMatch) {
|
if (!foundMatch) {
|
||||||
mcMMO.p.getLogger().info("[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: " + str);
|
LogUtils.debug(mcMMO.p.getLogger(), "[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: " + str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import com.gmail.nossr50.config.BukkitConfig;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||||
import com.gmail.nossr50.mcMMO;
|
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 com.gmail.nossr50.util.text.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -227,7 +229,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
for (String dropper : dropList) {
|
for (String dropper : dropList) {
|
||||||
if (dropper.equals("Bushes")) {
|
if (dropper.equals("Bushes")) {
|
||||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
|
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
|
||||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure);
|
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(BlockUtils.getShortGrass()), hylianTreasure);
|
||||||
for (Material species : Tag.SAPLINGS.getValues())
|
for (Material species : Tag.SAPLINGS.getValues())
|
||||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
||||||
|
|
||||||
@ -272,14 +274,14 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
case LEGACY:
|
case LEGACY:
|
||||||
int legacyDropLevel = getWrongKeyValue(type, treasureName, conversionType); //Legacy only had one value, Retro Mode didn't have a setting
|
int legacyDropLevel = getWrongKeyValue(type, treasureName, conversionType); //Legacy only had one value, Retro Mode didn't have a setting
|
||||||
//Config needs to be updated to be more specific
|
//Config needs to be updated to be more specific
|
||||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: Legacy] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: Legacy] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||||
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null); //Remove legacy entry
|
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null); //Remove legacy entry
|
||||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10); //Multiply by 10 for Retro
|
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10); //Multiply by 10 for Retro
|
||||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
|
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
|
||||||
shouldWeUpdateTheFile = true;
|
shouldWeUpdateTheFile = true;
|
||||||
break;
|
break;
|
||||||
case WRONG_KEY_STANDARD:
|
case WRONG_KEY_STANDARD:
|
||||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: STANDARD] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: STANDARD] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||||
int wrongKeyValueStandard = getWrongKeyValue(type, treasureName, conversionType);
|
int wrongKeyValueStandard = getWrongKeyValue(type, treasureName, conversionType);
|
||||||
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
||||||
|
|
||||||
@ -291,7 +293,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
shouldWeUpdateTheFile = true;
|
shouldWeUpdateTheFile = true;
|
||||||
break;
|
break;
|
||||||
case WRONG_KEY_RETRO:
|
case WRONG_KEY_RETRO:
|
||||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: RETRO] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: RETRO] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||||
int wrongKeyValueRetro = getWrongKeyValue(type, treasureName, conversionType);
|
int wrongKeyValueRetro = getWrongKeyValue(type, treasureName, conversionType);
|
||||||
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.database;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -16,14 +17,14 @@ public class DatabaseManagerFactory {
|
|||||||
return createDefaultCustomDatabaseManager();
|
return createDefaultCustomDatabaseManager();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mcMMO.p.debug("Could not create custom database manager");
|
LogUtils.debug(mcMMO.p.getLogger(), "Could not create custom database manager");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
mcMMO.p.debug("Failed to create custom database manager");
|
LogUtils.debug(mcMMO.p.getLogger(), "Failed to create custom database manager");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
mcMMO.p.debug("Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
LogUtils.debug(mcMMO.p.getLogger(), "Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
||||||
}
|
}
|
||||||
|
|
||||||
return mcMMO.p.getGeneralConfig().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
return mcMMO.p.getGeneralConfig().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||||
@ -62,16 +63,16 @@ public class DatabaseManagerFactory {
|
|||||||
public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FLATFILE:
|
case FLATFILE:
|
||||||
mcMMO.p.getLogger().info("Using FlatFile Database");
|
LogUtils.debug(mcMMO.p.getLogger(), "Using FlatFile Database");
|
||||||
return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||||
|
|
||||||
case SQL:
|
case SQL:
|
||||||
mcMMO.p.getLogger().info("Using SQL Database");
|
LogUtils.debug(mcMMO.p.getLogger(), "Using SQL Database");
|
||||||
return new SQLDatabaseManager();
|
return new SQLDatabaseManager();
|
||||||
|
|
||||||
case CUSTOM:
|
case CUSTOM:
|
||||||
try {
|
try {
|
||||||
mcMMO.p.getLogger().info("Attempting to use Custom Database");
|
LogUtils.debug(mcMMO.p.getLogger(), "Attempting to use Custom Database");
|
||||||
return createDefaultCustomDatabaseManager();
|
return createDefaultCustomDatabaseManager();
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -121,7 +122,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
public int purgePowerlessUsers() {
|
public int purgePowerlessUsers() {
|
||||||
int purgedUsers = 0;
|
int purgedUsers = 0;
|
||||||
|
|
||||||
logger.info("Purging powerless users...");
|
LogUtils.debug(logger, "Purging powerless users...");
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
@ -189,7 +190,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
int removedPlayers = 0;
|
int removedPlayers = 0;
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
logger.info("Purging old users...");
|
LogUtils.debug(logger, "Purging old users...");
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
@ -203,7 +204,8 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
String name = character[USERNAME_INDEX];
|
String uuidString = character[UUID_INDEX];
|
||||||
|
UUID uuid = UUID.fromString(uuidString);
|
||||||
long lastPlayed = 0;
|
long lastPlayed = 0;
|
||||||
boolean rewrite = false;
|
boolean rewrite = false;
|
||||||
|
|
||||||
@ -214,7 +216,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lastPlayed == -1) {
|
if (lastPlayed == -1) {
|
||||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(name);
|
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
||||||
|
|
||||||
if(player.getLastPlayed() != 0) {
|
if(player.getLastPlayed() != 0) {
|
||||||
lastPlayed = player.getLastPlayed();
|
lastPlayed = player.getLastPlayed();
|
||||||
@ -222,7 +224,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastPlayed != -1 && lastPlayed != 0 && currentTime - lastPlayed > purgeTime) {
|
if (lastPlayed < 1 && (currentTime - lastPlayed > purgeTime)) {
|
||||||
removedPlayers++;
|
removedPlayers++;
|
||||||
} else {
|
} else {
|
||||||
if (rewrite) {
|
if (rewrite) {
|
||||||
@ -723,7 +725,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName);
|
boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName);
|
||||||
|
|
||||||
if (!matchingName) {
|
if (!matchingName) {
|
||||||
logger.info("When loading user: "+playerName +" with UUID of (" + uuid.toString()
|
logger.warning("When loading user: "+playerName +" with UUID of (" + uuid.toString()
|
||||||
+") we found a mismatched name, the name in the DB will be replaced (DB name: "+dbPlayerName+")");
|
+") we found a mismatched name, the name in the DB will be replaced (DB name: "+dbPlayerName+")");
|
||||||
//logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
|
//logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
|
||||||
rawSplitData[USERNAME_INDEX] = playerName;
|
rawSplitData[USERNAME_INDEX] = playerName;
|
||||||
@ -848,7 +850,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
logger.info(i + " entries written while saving UUID for " + userName);
|
LogUtils.debug(logger, i + " entries written while saving UUID for " + userName);
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
@ -906,7 +908,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
logger.info(i + " entries written while saving UUID batch");
|
LogUtils.debug(logger, i + " entries written while saving UUID batch");
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
@ -1108,7 +1110,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() {
|
public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() {
|
||||||
ArrayList<FlatFileDataFlag> flagsFound = null;
|
ArrayList<FlatFileDataFlag> flagsFound = null;
|
||||||
logger.info("(" + usersFile.getPath() + ") Validating database file..");
|
LogUtils.debug(logger, "(" + usersFile.getPath() + ") Validating database file..");
|
||||||
FlatFileDataProcessor dataProcessor = null;
|
FlatFileDataProcessor dataProcessor = null;
|
||||||
|
|
||||||
if (usersFile.exists()) {
|
if (usersFile.exists()) {
|
||||||
@ -1143,7 +1145,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//Only update the file if needed
|
//Only update the file if needed
|
||||||
if(dataProcessor.getFlatFileDataFlags().size() > 0) {
|
if(dataProcessor.getFlatFileDataFlags().size() > 0) {
|
||||||
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
||||||
logger.info("Saving the updated and or repaired FlatFile Database...");
|
logger.info("Updating FlatFile Database...");
|
||||||
fileWriter = new FileWriter(usersFilePath);
|
fileWriter = new FileWriter(usersFilePath);
|
||||||
//Write data to file
|
//Write data to file
|
||||||
if(dbCommentDate != null)
|
if(dbCommentDate != null)
|
||||||
|
@ -11,13 +11,13 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||||
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -1013,7 +1013,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
*/
|
*/
|
||||||
private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) {
|
private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) {
|
||||||
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
|
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
|
||||||
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)");
|
LogUtils.debug(mcMMO.p.getLogger(), "Skipping " + upgrade.name() + " upgrade (unneeded)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,7 +1355,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 `uuid` varchar(36) NULL DEFAULT NULL");
|
||||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
|
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
|
||||||
|
|
||||||
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new GetUUIDUpdatesRequired(), 100); // wait until after first purge
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
|
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
|
||||||
@ -1368,7 +1368,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GetUUIDUpdatesRequired extends BukkitRunnable {
|
private class GetUUIDUpdatesRequired implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
massUpdateLock.lock();
|
massUpdateLock.lock();
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
@ -1577,7 +1577,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
mcMMO.p.debug("Releasing connection pool resource...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Releasing connection pool resource...");
|
||||||
miscPool.close();
|
miscPool.close();
|
||||||
loadPool.close();
|
loadPool.close();
|
||||||
savePool.close();
|
savePool.close();
|
||||||
|
@ -957,7 +957,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, false);
|
setToolPreparationMode(tool, false);
|
||||||
new AbilityDisableTask(this, superAbilityType).runTaskLater(mcMMO.p, (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
||||||
@ -1019,7 +1019,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, true);
|
setToolPreparationMode(tool, true);
|
||||||
new ToolLowerTask(this, tool).runTaskLater(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ToolLowerTask(this, tool), 4 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,16 +102,16 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleAsyncSave() {
|
public void scheduleAsyncSave() {
|
||||||
new PlayerProfileSaveTask(this, false).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new PlayerProfileSaveTask(this, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleAsyncSaveDelay() {
|
public void scheduleAsyncSaveDelay() {
|
||||||
new PlayerProfileSaveTask(this, false).runTaskLaterAsynchronously(mcMMO.p, 20);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(this, false), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void scheduleSyncSaveDelay() {
|
public void scheduleSyncSaveDelay() {
|
||||||
new PlayerProfileSaveTask(this, true).runTaskLater(mcMMO.p, 20);
|
mcMMO.p.getFoliaLib().getImpl().runLater(new PlayerProfileSaveTask(this, true), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(boolean useSync) {
|
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
|
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
||||||
if(mcMMO.isServerShutdownExecuted() || useSync)
|
if(mcMMO.isServerShutdownExecuted() || useSync)
|
||||||
new PlayerProfileSaveTask(this, true).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||||
else
|
else
|
||||||
scheduleAsyncSave();
|
scheduleAsyncSave();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public enum SubSkillType {
|
|||||||
FISHING_MAGIC_HUNTER(1),
|
FISHING_MAGIC_HUNTER(1),
|
||||||
FISHING_MASTER_ANGLER(8),
|
FISHING_MASTER_ANGLER(8),
|
||||||
FISHING_TREASURE_HUNTER(8),
|
FISHING_TREASURE_HUNTER(8),
|
||||||
FISHING_SHAKE(1),
|
FISHING_SHAKE(8),
|
||||||
|
|
||||||
/* Herbalism */
|
/* Herbalism */
|
||||||
HERBALISM_DOUBLE_DROPS(1),
|
HERBALISM_DOUBLE_DROPS(1),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.treasure;
|
package com.gmail.nossr50.datatypes.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -26,7 +27,7 @@ public class FishingTreasureBook extends FishingTreasure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initLegalEnchantments() {
|
private void initLegalEnchantments() {
|
||||||
mcMMO.p.getLogger().info("Registering enchantments for Fishing Book...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Registering enchantments for Fishing Book...");
|
||||||
|
|
||||||
for(Enchantment enchantment : Enchantment.values()) {
|
for(Enchantment enchantment : Enchantment.values()) {
|
||||||
if(isEnchantAllowed(enchantment)) {
|
if(isEnchantAllowed(enchantment)) {
|
||||||
|
@ -27,8 +27,13 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
protected Component notificationTextComponent;
|
protected Component notificationTextComponent;
|
||||||
protected final NotificationType notificationType;
|
protected final NotificationType notificationType;
|
||||||
|
|
||||||
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, Component notificationTextComponent, McMMOMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
|
protected final Player player;
|
||||||
|
|
||||||
|
public McMMOPlayerNotificationEvent(Player player, NotificationType notificationType,
|
||||||
|
Component notificationTextComponent, McMMOMessageType chatMessageType,
|
||||||
|
boolean isMessageAlsoBeingSentToChat) {
|
||||||
super(false);
|
super(false);
|
||||||
|
this.player = player;
|
||||||
this.notificationType = notificationType;
|
this.notificationType = notificationType;
|
||||||
this.notificationTextComponent = notificationTextComponent;
|
this.notificationTextComponent = notificationTextComponent;
|
||||||
this.chatMessageType = chatMessageType;
|
this.chatMessageType = chatMessageType;
|
||||||
@ -48,6 +53,10 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
public Component getNotificationTextComponent() {
|
public Component getNotificationTextComponent() {
|
||||||
return notificationTextComponent;
|
return notificationTextComponent;
|
||||||
}
|
}
|
||||||
|
@ -134,14 +134,16 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockFace direction = event.getDirection();
|
final BlockFace direction = event.getDirection();
|
||||||
Block movedBlock;
|
|
||||||
for (Block block : event.getBlocks()) {
|
|
||||||
movedBlock = block.getRelative(direction);
|
|
||||||
|
|
||||||
if(BlockUtils.isWithinWorldBounds(movedBlock)) {
|
for (final Block block : event.getBlocks()) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), t -> {
|
||||||
}
|
final Block movedBlock = block.getRelative(direction);
|
||||||
|
|
||||||
|
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
|
||||||
|
BlockUtils.setUnnaturalBlock(movedBlock);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
||||||
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
||||||
metaCleanupTask.runTaskTimer(pluginRef, 20, 20*60); //6000 ticks is 5 minutes
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
||||||
}
|
}
|
||||||
else if (isTracked) {
|
else if (isTracked) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
|||||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
|
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -52,7 +53,7 @@ public class InteractionManager {
|
|||||||
//Register in name map
|
//Register in name map
|
||||||
subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill);
|
subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill);
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Registered subskill: "+ abstractSubSkill.getConfigKeyName());
|
LogUtils.debug(mcMMO.p.getLogger(), "Registered subskill: "+ abstractSubSkill.getConfigKeyName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +439,7 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
|||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -149,12 +148,7 @@ public class PlayerListener implements Listener {
|
|||||||
new MobHealthDisplayUpdaterTask(attacker).run();
|
new MobHealthDisplayUpdaterTask(attacker).run();
|
||||||
|
|
||||||
// set the name back
|
// set the name back
|
||||||
new BukkitRunnable() {
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(attacker, () -> MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p), 1);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p);
|
|
||||||
}
|
|
||||||
}.runTaskLater(mcMMO.p, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -595,7 +589,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
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
|
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 60);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 60);
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
||||||
Motd.displayAll(player);
|
Motd.displayAll(player);
|
||||||
@ -958,8 +952,8 @@ public class PlayerListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");
|
LogUtils.debug(mcMMO.p.getLogger(), player.getName() + "is chatting, but is currently not logged in to the server.");
|
||||||
mcMMO.p.debug("Party & Admin chat will not work properly for this player.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Party & Admin chat will not work properly for this player.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.listeners;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -30,7 +29,8 @@ public class WorldListener implements Listener {
|
|||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, () -> {
|
// Using 50 ms later as I do not know of a way to run one tick later (safely)
|
||||||
|
plugin.getFoliaLib().getImpl().runLater(() -> {
|
||||||
for (BlockState blockState : event.getBlocks()) {
|
for (BlockState blockState : event.getBlocks()) {
|
||||||
mcMMO.getPlaceStore().setFalse(blockState);
|
mcMMO.getPlaceStore().setFalse(blockState);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.locale;
|
package com.gmail.nossr50.locale;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.text.TextUtils;
|
import com.gmail.nossr50.util.text.TextUtils;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -192,7 +193,7 @@ public final class LocaleLoader {
|
|||||||
//Use the new locale file
|
//Use the new locale file
|
||||||
if (Files.exists(overridePath) && Files.isRegularFile(overridePath)) {
|
if (Files.exists(overridePath) && Files.isRegularFile(overridePath)) {
|
||||||
try (Reader localeReader = Files.newBufferedReader(overridePath)) {
|
try (Reader localeReader = Files.newBufferedReader(overridePath)) {
|
||||||
mcMMO.p.getLogger().log(Level.INFO, "Loading locale from {0}", overridePath);
|
LogUtils.debug(mcMMO.p.getLogger(), "Loading locale from " + overridePath.toString());
|
||||||
filesystemBundle = new PropertyResourceBundle(localeReader);
|
filesystemBundle = new PropertyResourceBundle(localeReader);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
mcMMO.p.getLogger().log(Level.WARNING, "Failed to load locale from " + overridePath, e);
|
mcMMO.p.getLogger().log(Level.WARNING, "Failed to load locale from " + overridePath, e);
|
||||||
|
@ -20,6 +20,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
|||||||
import com.gmail.nossr50.listeners.*;
|
import com.gmail.nossr50.listeners.*;
|
||||||
import com.gmail.nossr50.metadata.MetadataService;
|
import com.gmail.nossr50.metadata.MetadataService;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
|
import com.gmail.nossr50.placeholders.PapiExpansion;
|
||||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||||
import com.gmail.nossr50.runnables.commands.NotifySquelchReminderTask;
|
import com.gmail.nossr50.runnables.commands.NotifySquelchReminderTask;
|
||||||
@ -52,6 +53,8 @@ import com.gmail.nossr50.util.skills.SkillTools;
|
|||||||
import com.gmail.nossr50.util.skills.SmeltingTracker;
|
import com.gmail.nossr50.util.skills.SmeltingTracker;
|
||||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
|
import com.tcoded.folialib.FoliaLib;
|
||||||
|
import com.tcoded.folialib.util.InvalidTickDelayNotifier;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
@ -136,6 +139,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
private GeneralConfig generalConfig;
|
private GeneralConfig generalConfig;
|
||||||
private AdvancedConfig advancedConfig;
|
private AdvancedConfig advancedConfig;
|
||||||
|
|
||||||
|
private FoliaLib foliaLib;
|
||||||
|
|
||||||
// private RepairConfig repairConfig;
|
// private RepairConfig repairConfig;
|
||||||
// private SalvageConfig salvageConfig;
|
// private SalvageConfig salvageConfig;
|
||||||
// private PersistentDataConfig persistentDataConfig;
|
// private PersistentDataConfig persistentDataConfig;
|
||||||
@ -163,6 +169,13 @@ public class mcMMO extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
|
//Filter out any debug messages (if debug/verbose logging is not enabled)
|
||||||
|
getLogger().setFilter(new LogFilter(this));
|
||||||
|
|
||||||
|
//Folia lib plugin instance
|
||||||
|
foliaLib = new FoliaLib(this);
|
||||||
|
InvalidTickDelayNotifier.disableNotifications = true;
|
||||||
|
|
||||||
setupFilePaths();
|
setupFilePaths();
|
||||||
generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools
|
generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools
|
||||||
skillTools = new SkillTools(this); //Load after general config
|
skillTools = new SkillTools(this); //Load after general config
|
||||||
@ -179,9 +192,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//metadata service
|
//metadata service
|
||||||
metadataService = new MetadataService(this);
|
metadataService = new MetadataService(this);
|
||||||
|
|
||||||
//Filter out any debug messages (if debug/verbose logging is not enabled)
|
|
||||||
getLogger().setFilter(new LogFilter(this));
|
|
||||||
|
|
||||||
MetadataConstants.MCMMO_METADATA_VALUE = new FixedMetadataValue(this, true);
|
MetadataConstants.MCMMO_METADATA_VALUE = new FixedMetadataValue(this, true);
|
||||||
|
|
||||||
PluginManager pluginManager = getServer().getPluginManager();
|
PluginManager pluginManager = getServer().getPluginManager();
|
||||||
@ -190,7 +200,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
upgradeManager = new UpgradeManager();
|
upgradeManager = new UpgradeManager();
|
||||||
|
|
||||||
|
|
||||||
modManager = new ModManager();
|
modManager = new ModManager();
|
||||||
|
|
||||||
//Init Material Maps
|
//Init Material Maps
|
||||||
@ -229,18 +238,21 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
if(serverAPIOutdated)
|
if(serverAPIOutdated)
|
||||||
{
|
{
|
||||||
Bukkit
|
foliaLib
|
||||||
.getScheduler()
|
.getImpl()
|
||||||
.scheduleSyncRepeatingTask(this,
|
.runTimer(
|
||||||
() -> getLogger().severe("You are running an outdated version of "+platformManager.getServerSoftware()+", mcMMO will not work unless you update to a newer version!"),
|
() -> 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, 20*60*30
|
||||||
|
);
|
||||||
|
|
||||||
if(platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
|
if(platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler()
|
foliaLib
|
||||||
.scheduleSyncRepeatingTask(this,
|
.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."),
|
() -> 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, 20*60*30
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
registerEvents();
|
registerEvents();
|
||||||
@ -252,10 +264,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
formulaManager = new FormulaManager();
|
formulaManager = new FormulaManager();
|
||||||
|
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("Version " + getDescription().getVersion() + " is enabled!");
|
LogUtils.debug(mcMMO.p.getLogger(), "Version " + getDescription().getVersion() + " is enabled!");
|
||||||
|
|
||||||
scheduleTasks();
|
scheduleTasks();
|
||||||
CommandRegistrationManager.registerCommands();
|
CommandRegistrationManager.registerCommands();
|
||||||
@ -282,9 +294,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
else
|
else
|
||||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
||||||
}
|
}
|
||||||
}
|
} catch (Throwable t) {
|
||||||
|
|
||||||
catch (Throwable t) {
|
|
||||||
getLogger().severe("There was an error while enabling mcMMO!");
|
getLogger().severe("There was an error while enabling mcMMO!");
|
||||||
|
|
||||||
if (!(t instanceof ExceptionInInitializerError)) {
|
if (!(t instanceof ExceptionInInitializerError)) {
|
||||||
@ -320,6 +330,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
transientEntityTracker = new TransientEntityTracker();
|
transientEntityTracker = new TransientEntityTracker();
|
||||||
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
||||||
|
|
||||||
|
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
|
new PapiExpansion().register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerLevelUtils getPlayerLevelUtils() {
|
public static PlayerLevelUtils getPlayerLevelUtils() {
|
||||||
@ -388,13 +402,13 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("Canceling all tasks...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Canceling all tasks...");
|
||||||
getServer().getScheduler().cancelTasks(this); // This removes our tasks
|
getFoliaLib().getImpl().cancelAllTasks(); // This removes our tasks
|
||||||
debug("Unregister all events...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Unregister all events...");
|
||||||
HandlerList.unregisterAll(this); // Cancel event registrations
|
HandlerList.unregisterAll(this); // Cancel event registrations
|
||||||
|
|
||||||
databaseManager.onDisable();
|
databaseManager.onDisable();
|
||||||
debug("Was disabled."); // How informative!
|
LogUtils.debug(mcMMO.p.getLogger(), "Was disabled."); // How informative!
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMainDirectory() {
|
public static String getMainDirectory() {
|
||||||
@ -429,10 +443,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
xpEventEnabled = !xpEventEnabled;
|
xpEventEnabled = !xpEventEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String message) {
|
|
||||||
getLogger().info("[Debug] " + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FormulaManager getFormulaManager() {
|
public static FormulaManager getFormulaManager() {
|
||||||
return formulaManager;
|
return formulaManager;
|
||||||
}
|
}
|
||||||
@ -613,7 +623,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
|
if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
|
||||||
{
|
{
|
||||||
getLogger().info("Enabling Acrobatics Skills");
|
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
|
||||||
|
|
||||||
//TODO: Should do this differently
|
//TODO: Should do this differently
|
||||||
Roll roll = new Roll();
|
Roll roll = new Roll();
|
||||||
@ -623,7 +633,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerCustomRecipes() {
|
private void registerCustomRecipes() {
|
||||||
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
|
getFoliaLib().getImpl().runLater(() -> {
|
||||||
if (generalConfig.getChimaeraEnabled()) {
|
if (generalConfig.getChimaeraEnabled()) {
|
||||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||||
}
|
}
|
||||||
@ -637,42 +647,42 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
||||||
|
|
||||||
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
getFoliaLib().getImpl().runTimer(new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||||
|
|
||||||
// Cleanup the backups folder
|
// Cleanup the backups folder
|
||||||
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
getFoliaLib().getImpl().runAsync(new CleanBackupsTask());
|
||||||
|
|
||||||
// Old & Powerless User remover
|
// Old & Powerless User remover
|
||||||
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (purgeIntervalTicks == 0) {
|
if (purgeIntervalTicks == 0) {
|
||||||
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
}
|
}
|
||||||
else if (purgeIntervalTicks > 0) {
|
else if (purgeIntervalTicks > 0) {
|
||||||
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
|
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically remove old members from parties
|
// Automatically remove old members from parties
|
||||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (kickIntervalTicks == 0) {
|
if (kickIntervalTicks == 0) {
|
||||||
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
}
|
}
|
||||||
else if (kickIntervalTicks > 0) {
|
else if (kickIntervalTicks > 0) {
|
||||||
new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
|
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update power level tag scoreboards
|
// Update power level tag scoreboards
|
||||||
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
getFoliaLib().getImpl().runTimer(new PowerLevelUpdatingTask(), 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
|
|
||||||
// Clear the registered XP data so players can earn XP again
|
// Clear the registered XP data so players can earn XP again
|
||||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||||
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
||||||
{
|
{
|
||||||
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
|
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,4 +782,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public @NotNull AdvancedConfig getAdvancedConfig() {
|
public @NotNull AdvancedConfig getAdvancedConfig() {
|
||||||
return advancedConfig;
|
return advancedConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @NotNull FoliaLib getFoliaLib() {
|
||||||
|
return foliaLib;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
|||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
@ -644,7 +645,7 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Loaded (" + parties.size() + ") Parties...");
|
||||||
|
|
||||||
for (Party party : hasAlly) {
|
for (Party party : hasAlly) {
|
||||||
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||||
@ -660,7 +661,7 @@ public final class PartyManager {
|
|||||||
* Save party file.
|
* Save party file.
|
||||||
*/
|
*/
|
||||||
public static void saveParties() {
|
public static void saveParties() {
|
||||||
mcMMO.p.debug("[Party Data] Saving...");
|
LogUtils.debug(mcMMO.p.getLogger(), "[Party Data] Saving...");
|
||||||
|
|
||||||
if (partyFile.exists()) {
|
if (partyFile.exists()) {
|
||||||
if (!partyFile.delete()) {
|
if (!partyFile.delete()) {
|
||||||
@ -768,7 +769,7 @@ public final class PartyManager {
|
|||||||
// parties.add(party);
|
// parties.add(party);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
// LogUtils.debug(mcMMO.p.getLogger(), "Loaded (" + parties.size() + ") Parties...");
|
||||||
//
|
//
|
||||||
// for (Party party : hasAlly) {
|
// for (Party party : hasAlly) {
|
||||||
// party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
// party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||||
|
230
src/main/java/com/gmail/nossr50/placeholders/PapiExpansion.java
Normal file
230
src/main/java/com/gmail/nossr50/placeholders/PapiExpansion.java
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.api.ExperienceAPI;
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public class PapiExpansion extends PlaceholderExpansion {
|
||||||
|
private final Map<String, Placeholder> placeholders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
|
public PapiExpansion() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentifier() {
|
||||||
|
return "mcmmo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthor() {
|
||||||
|
return "mcMMO Dev Team";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
//grab version from pom.xml
|
||||||
|
return "1.0,0";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequiredPlugin() {
|
||||||
|
return "mcMMO";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public String onPlaceholderRequest(final Player player, @NotNull final String params) {
|
||||||
|
String token;
|
||||||
|
String data = null;
|
||||||
|
int dataPosition = params.indexOf(":");
|
||||||
|
|
||||||
|
if (dataPosition != -1) {
|
||||||
|
token = params.substring(0, dataPosition);
|
||||||
|
data = params.substring(dataPosition + 1);
|
||||||
|
} else {
|
||||||
|
token = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
Placeholder placeholder = placeholders.get(token);
|
||||||
|
|
||||||
|
if (placeholder != null) {
|
||||||
|
return placeholder.process(player, data);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSkillLevel(PrimarySkillType skill, Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
return user.getSkillLevel(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getExpNeeded(PrimarySkillType skill, Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
return user.getXpToLevel(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getExp(PrimarySkillType skill, Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
|
||||||
|
return user.getSkillXpLevel(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getExpRemaining(PrimarySkillType skill, Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
int current = user.getSkillXpLevel(skill);
|
||||||
|
int needed = user.getXpToLevel(skill);
|
||||||
|
|
||||||
|
return needed - current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRank(PrimarySkillType skill, Player player) {
|
||||||
|
try {
|
||||||
|
return ExperienceAPI.getPlayerRankSkill(player.getUniqueId(), StringUtils.getCapitalized(skill.toString()));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPowerLevel(Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
return user.getPowerLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPowerCap(Player player) {
|
||||||
|
return mcMMO.p.getGeneralConfig().getPowerLevelCap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartyName(Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
final Party party = user.getParty();
|
||||||
|
|
||||||
|
return (party == null) ? null : party.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartyLeader(Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
final Party party = user.getParty();
|
||||||
|
return (party == null) ? null : party.getLeader().getPlayerName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPartySize(Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
final Party party = user.getParty();
|
||||||
|
return (party == null) ? null : party.getMembers().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXpRate(Player player) {
|
||||||
|
return String.valueOf(ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkillXpRate(PrimarySkillType skill, Player player) {
|
||||||
|
final McMMOPlayer user = UserManager.getPlayer(player);
|
||||||
|
if (user == null) return null;
|
||||||
|
|
||||||
|
double modifier = 1.0F;
|
||||||
|
|
||||||
|
if (Permissions.customXpBoost(player, skill))
|
||||||
|
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
|
||||||
|
else if (Permissions.quadrupleXp(player, skill))
|
||||||
|
modifier = 4;
|
||||||
|
else if (Permissions.tripleXp(player, skill))
|
||||||
|
modifier = 3;
|
||||||
|
else if (Permissions.doubleAndOneHalfXp(player, skill))
|
||||||
|
modifier = 2.5;
|
||||||
|
else if (Permissions.doubleXp(player, skill))
|
||||||
|
modifier = 2;
|
||||||
|
else if (Permissions.oneAndOneHalfXp(player, skill))
|
||||||
|
modifier = 1.5;
|
||||||
|
else if (Permissions.oneAndOneTenthXp(player, skill))
|
||||||
|
modifier = 1.1;
|
||||||
|
|
||||||
|
return String.valueOf(modifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String isExpEventActive(Player player) {
|
||||||
|
return mcMMO.p.isXPEventEnabled() ? PlaceholderAPIPlugin.booleanTrue() : PlaceholderAPIPlugin.booleanFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerPlaceholder(Placeholder placeholder) {
|
||||||
|
final Placeholder registered = placeholders.get(placeholder.getName());
|
||||||
|
if (registered != null)
|
||||||
|
throw new IllegalStateException("Placeholder " + placeholder.getName() + " is already registered!");
|
||||||
|
|
||||||
|
placeholders.put(placeholder.getName(), placeholder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
|
||||||
|
for (PrimarySkillType skill : PrimarySkillType.values()) {
|
||||||
|
// %mcmmo_level_<skillname>%
|
||||||
|
registerPlaceholder(new SkillLevelPlaceholder(this, skill));
|
||||||
|
|
||||||
|
//%mcmmo_xp_needed_<skillname>%
|
||||||
|
registerPlaceholder(new SkillExpNeededPlaceholder(this, skill));
|
||||||
|
|
||||||
|
//%mcmmo_xp_<skillname>%
|
||||||
|
registerPlaceholder(new SkillExpPlaceholder(this, skill));
|
||||||
|
|
||||||
|
//%mcmmo_xp_remaining_<skillname>%
|
||||||
|
registerPlaceholder(new SkillExpRemainingPlaceholder(this, skill));
|
||||||
|
|
||||||
|
//%mcmmo_rank_<skillname>%
|
||||||
|
registerPlaceholder(new SkillRankPlaceholder(this, skill));
|
||||||
|
|
||||||
|
//%mcmmo_xprate_<skillname>%
|
||||||
|
registerPlaceholder(new SkillXpRatePlaceholder(this, skill));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//%mcmmo_power_level%
|
||||||
|
registerPlaceholder(new PowerLevelPlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_power_level_cap%
|
||||||
|
registerPlaceholder(new PowerLevelCapPlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_in_party%
|
||||||
|
registerPlaceholder(new PartyIsMemberPlaceholder(this));
|
||||||
|
|
||||||
|
/// %mcmmo_party_name%
|
||||||
|
registerPlaceholder(new PartyNamePlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_is_party_leader%
|
||||||
|
registerPlaceholder(new PartyIsLeaderPlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_party_leader%
|
||||||
|
registerPlaceholder(new PartyLeaderPlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_party_size%
|
||||||
|
registerPlaceholder(new PartySizePlaceholder(this));
|
||||||
|
|
||||||
|
// %mcmmo_is_xp_event_active%
|
||||||
|
registerPlaceholder(new XpEventActivePlaceholder(this));
|
||||||
|
// %mcmmo_xprate%
|
||||||
|
registerPlaceholder(new XpRatePlaceholder(this));
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PartyIsLeaderPlaceholder implements Placeholder {
|
||||||
|
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PartyIsLeaderPlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
String leader = papiExpansion.getPartyLeader(player);
|
||||||
|
return (leader.equals(player.getName())) ? "true" : "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "is_party_leader";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PartyIsMemberPlaceholder implements Placeholder {
|
||||||
|
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
public PartyIsMemberPlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
return (papiExpansion.getPartyName(player) == null) ? "false" : "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "in_party";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PartyLeaderPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PartyLeaderPlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
return StringUtils.stripToEmpty(papiExpansion.getPartyLeader(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "party_leader";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PartyNamePlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PartyNamePlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
return StringUtils.stripToEmpty(papiExpansion.getPartyName(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "party_name";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PartySizePlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PartySizePlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
Integer partySize = papiExpansion.getPartySize(player);
|
||||||
|
return (partySize == null) ? "" : partySize.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "party_size";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public interface Placeholder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player the player to process the placeholder for
|
||||||
|
* @param params the paramaters to be passed to the placeholder
|
||||||
|
* @return the value of the placeholder
|
||||||
|
*/
|
||||||
|
String process(Player player, String params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the placeholder
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PowerLevelCapPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PowerLevelCapPlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
Integer cap = papiExpansion.getPowerCap(player);
|
||||||
|
return (cap == null) ? "" : cap.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "power_level_cap";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PowerLevelPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public PowerLevelPlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
Integer powerLevel = papiExpansion.getPowerLevel(player);
|
||||||
|
return (powerLevel == null) ? "" : powerLevel.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "power_level";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillExpNeededPlaceholder implements Placeholder {
|
||||||
|
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skillType;
|
||||||
|
|
||||||
|
public SkillExpNeededPlaceholder(PapiExpansion papiExpansion, PrimarySkillType skillType) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skillType = skillType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
final Integer expNeeded = papiExpansion.getExpNeeded(skillType, player);
|
||||||
|
return (expNeeded == null) ? "" : expNeeded.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "xp_needed_" + skillType.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillExpPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skill;
|
||||||
|
|
||||||
|
public SkillExpPlaceholder(PapiExpansion papiExpansion, PrimarySkillType skill) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skill = skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
Integer exp = papiExpansion.getExp(skill, player);
|
||||||
|
return (exp == null) ? "" : exp.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "xp_" + skill.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillExpRemainingPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skill;
|
||||||
|
|
||||||
|
public SkillExpRemainingPlaceholder(PapiExpansion papiExpansion, PrimarySkillType skill) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skill = skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
final Integer expRemaining = papiExpansion.getExpRemaining(skill, player);
|
||||||
|
return (expRemaining == null) ? "" : expRemaining.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "xp_remaining_" + skill.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillLevelPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skillType;
|
||||||
|
|
||||||
|
public SkillLevelPlaceholder(PapiExpansion papiExpansion, PrimarySkillType skillType) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skillType = skillType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player p, String params) {
|
||||||
|
final Integer skillLevel = papiExpansion.getSkillLevel(skillType, p);
|
||||||
|
return (skillLevel == null) ? "" : skillLevel.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "level_" + skillType.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillRankPlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skill;
|
||||||
|
|
||||||
|
public SkillRankPlaceholder(PapiExpansion papiExpansion, PrimarySkillType skill) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skill = skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
Integer rank = papiExpansion.getRank(skill, player);
|
||||||
|
return (rank == null) ? "" : rank.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "rank_" + skill.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkillXpRatePlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
private final PrimarySkillType skillType;
|
||||||
|
|
||||||
|
public SkillXpRatePlaceholder(PapiExpansion papiExpansion, PrimarySkillType skillType) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
this.skillType = skillType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player p, String params) {
|
||||||
|
final String skillLevel = papiExpansion.getSkillXpRate(skillType, p);
|
||||||
|
return (skillLevel == null) ? "" : skillLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "xprate_" + skillType.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class XpEventActivePlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public <S extends PrimarySkillType> XpEventActivePlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
return papiExpansion.isExpEventActive(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "is_xp_event_active";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.placeholders;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class XpRatePlaceholder implements Placeholder {
|
||||||
|
private final PapiExpansion papiExpansion;
|
||||||
|
|
||||||
|
public <S extends PrimarySkillType> XpRatePlaceholder(PapiExpansion papiExpansion) {
|
||||||
|
this.papiExpansion = papiExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String process(Player player, String params) {
|
||||||
|
return papiExpansion.getXpRate(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "xprate";
|
||||||
|
}
|
||||||
|
}
|
@ -3,9 +3,9 @@
|
|||||||
//import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
//import com.gmail.nossr50.runnables.skills.AprilTask;
|
//import com.gmail.nossr50.runnables.skills.AprilTask;
|
||||||
//import com.gmail.nossr50.util.Misc;
|
//import com.gmail.nossr50.util.Misc;
|
||||||
//import org.bukkit.scheduler.BukkitRunnable;
|
//import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
//
|
//
|
||||||
//public class CheckDateTask extends BukkitRunnable {
|
//public class CheckDateTask extends CancellableRunnable {
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public void run() {
|
// public void run() {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import org.bukkit.entity.Mob;
|
import org.bukkit.entity.Mob;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MobDodgeMetaCleanup extends BukkitRunnable {
|
public class MobDodgeMetaCleanup extends CancellableRunnable {
|
||||||
private final @NotNull Mob mob;
|
private final @NotNull Mob mob;
|
||||||
private final @NotNull mcMMO pluginRef;
|
private final @NotNull mcMMO pluginRef;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
public class MobHealthDisplayUpdaterTask extends CancellableRunnable {
|
||||||
private final LivingEntity target;
|
private final LivingEntity target;
|
||||||
|
|
||||||
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
||||||
|
@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PistonTrackerTask extends BukkitRunnable {
|
public class PistonTrackerTask extends CancellableRunnable {
|
||||||
private final List<Block> blocks;
|
private final List<Block> blocks;
|
||||||
private final BlockFace direction;
|
private final BlockFace direction;
|
||||||
private final Block futureEmptyBlock;
|
private final Block futureEmptyBlock;
|
||||||
|
@ -4,18 +4,19 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class SaveTimerTask extends BukkitRunnable {
|
public class SaveTimerTask extends CancellableRunnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mcMMO.p.debug("[User Data] Saving...");
|
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
|
||||||
// All player data will be saved periodically through this
|
// All player data will be saved periodically through this
|
||||||
int count = 1;
|
int count = 1;
|
||||||
|
|
||||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||||
new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false).runTaskLaterAsynchronously(mcMMO.p, count);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false), count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class StickyPistonTrackerTask extends BukkitRunnable {
|
public class StickyPistonTrackerTask extends CancellableRunnable {
|
||||||
private final BlockFace direction;
|
private final BlockFace direction;
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final Block movedBlock;
|
private final Block movedBlock;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TravelingBlockMetaCleanup extends BukkitRunnable {
|
public class TravelingBlockMetaCleanup extends CancellableRunnable {
|
||||||
private final @NotNull Entity entity;
|
private final @NotNull Entity entity;
|
||||||
private final @NotNull mcMMO pluginRef;
|
private final @NotNull mcMMO pluginRef;
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.gmail.nossr50.runnables.backups;
|
package com.gmail.nossr50.runnables.backups;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@ -9,7 +10,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class CleanBackupsTask extends BukkitRunnable {
|
public class CleanBackupsTask extends CancellableRunnable {
|
||||||
private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator;
|
private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator;
|
||||||
private static final File BACKUP_DIR = new File(BACKUP_DIRECTORY);
|
private static final File BACKUP_DIR = new File(BACKUP_DIRECTORY);
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
Date date = getDate(fileName.split("[.]")[0]);
|
Date date = getDate(fileName.split("[.]")[0]);
|
||||||
|
|
||||||
if (!fileName.contains(".zip") || date == null) {
|
if (!fileName.contains(".zip") || date == null) {
|
||||||
mcMMO.p.debug("Could not determine date for file: " + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Could not determine date for file: " + fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,11 +75,11 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Cleaned backup files. Deleted " + amountDeleted + " of " + amountTotal + " files.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Cleaned backup files. Deleted " + amountDeleted + " of " + amountTotal + " files.");
|
||||||
|
|
||||||
for (File file : toDelete) {
|
for (File file : toDelete) {
|
||||||
if (file.delete()) {
|
if (file.delete()) {
|
||||||
mcMMO.p.debug("Deleted: " + file.getName());
|
LogUtils.debug(mcMMO.p.getLogger(), "Deleted: " + file.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.runnables.commands;
|
package com.gmail.nossr50.runnables.commands;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class McScoreboardKeepTask extends BukkitRunnable {
|
public class McScoreboardKeepTask extends CancellableRunnable {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
public McScoreboardKeepTask(Player player) {
|
public McScoreboardKeepTask(Player player) {
|
||||||
|
@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables.commands;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class McrankCommandAsyncTask extends BukkitRunnable {
|
public class McrankCommandAsyncTask extends CancellableRunnable {
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final boolean useBoard, useChat;
|
private final boolean useBoard, useChat;
|
||||||
@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
||||||
|
|
||||||
new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,19 +3,19 @@ package com.gmail.nossr50.runnables.commands;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the results of McrankCommandAsyncTask to the sender.
|
* Display the results of McrankCommandAsyncTask to the sender.
|
||||||
*/
|
*/
|
||||||
public class McrankCommandDisplayTask extends BukkitRunnable {
|
public class McrankCommandDisplayTask extends CancellableRunnable {
|
||||||
private final Map<PrimarySkillType, Integer> skills;
|
private final Map<PrimarySkillType, Integer> skills;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
|
@ -3,14 +3,14 @@ package com.gmail.nossr50.runnables.commands;
|
|||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MctopCommandAsyncTask extends BukkitRunnable {
|
public class MctopCommandAsyncTask extends CancellableRunnable {
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final PrimarySkillType skill;
|
private final PrimarySkillType skill;
|
||||||
private final int page;
|
private final int page;
|
||||||
@ -35,6 +35,6 @@ public class MctopCommandAsyncTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
|
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
|
||||||
|
|
||||||
new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,19 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the results of {@link MctopCommandAsyncTask} to the sender.
|
* Display the results of {@link MctopCommandAsyncTask} to the sender.
|
||||||
*/
|
*/
|
||||||
public class MctopCommandDisplayTask extends BukkitRunnable {
|
public class MctopCommandDisplayTask extends CancellableRunnable {
|
||||||
private final List<PlayerStat> userStats;
|
private final List<PlayerStat> userStats;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final PrimarySkillType skill;
|
private final PrimarySkillType skill;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.runnables.commands;
|
package com.gmail.nossr50.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class NotifySquelchReminderTask extends BukkitRunnable {
|
public class NotifySquelchReminderTask extends CancellableRunnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.database;
|
|||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class DatabaseConversionTask extends BukkitRunnable {
|
public class DatabaseConversionTask extends CancellableRunnable {
|
||||||
private final DatabaseManager sourceDatabase;
|
private final DatabaseManager sourceDatabase;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final String message;
|
private final String message;
|
||||||
@ -21,6 +21,6 @@ public class DatabaseConversionTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
||||||
|
|
||||||
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, () -> sender.sendMessage(message));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> sender.sendMessage(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,14 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
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.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class FormulaConversionTask extends BukkitRunnable {
|
public class FormulaConversionTask extends CancellableRunnable {
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final FormulaType formulaType;
|
private final FormulaType formulaType;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
mcMMO.p.debug("Profile not loaded.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Profile not loaded.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void editValues(PlayerProfile profile) {
|
private void editValues(PlayerProfile profile) {
|
||||||
mcMMO.p.debug("========================================================================");
|
LogUtils.debug(mcMMO.p.getLogger(), "========================================================================");
|
||||||
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
|
LogUtils.debug(mcMMO.p.getLogger(), "Conversion report for " + profile.getPlayerName() + ":");
|
||||||
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
|
||||||
int oldLevel = profile.getSkillLevel(primarySkillType);
|
int oldLevel = profile.getSkillLevel(primarySkillType);
|
||||||
int oldXPLevel = profile.getSkillXpLevel(primarySkillType);
|
int oldXPLevel = profile.getSkillXpLevel(primarySkillType);
|
||||||
@ -72,17 +73,17 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
int newLevel = newExperienceValues[0];
|
int newLevel = newExperienceValues[0];
|
||||||
int newXPlevel = newExperienceValues[1];
|
int newXPlevel = newExperienceValues[1];
|
||||||
|
|
||||||
mcMMO.p.debug(" Skill: " + primarySkillType.toString());
|
LogUtils.debug(mcMMO.p.getLogger(), " Skill: " + primarySkillType.toString());
|
||||||
|
|
||||||
mcMMO.p.debug(" OLD:");
|
LogUtils.debug(mcMMO.p.getLogger(), " OLD:");
|
||||||
mcMMO.p.debug(" Level: " + oldLevel);
|
LogUtils.debug(mcMMO.p.getLogger(), " Level: " + oldLevel);
|
||||||
mcMMO.p.debug(" XP " + oldXPLevel);
|
LogUtils.debug(mcMMO.p.getLogger(), " XP " + oldXPLevel);
|
||||||
mcMMO.p.debug(" Total XP " + totalOldXP);
|
LogUtils.debug(mcMMO.p.getLogger(), " Total XP " + totalOldXP);
|
||||||
|
|
||||||
mcMMO.p.debug(" NEW:");
|
LogUtils.debug(mcMMO.p.getLogger(), " NEW:");
|
||||||
mcMMO.p.debug(" Level " + newLevel);
|
LogUtils.debug(mcMMO.p.getLogger(), " Level " + newLevel);
|
||||||
mcMMO.p.debug(" XP " + newXPlevel);
|
LogUtils.debug(mcMMO.p.getLogger(), " XP " + newXPlevel);
|
||||||
mcMMO.p.debug("------------------------------------------------------------------------");
|
LogUtils.debug(mcMMO.p.getLogger(), "------------------------------------------------------------------------");
|
||||||
|
|
||||||
profile.modifySkill(primarySkillType, newLevel);
|
profile.modifySkill(primarySkillType, newLevel);
|
||||||
profile.setSkillXpLevel(primarySkillType, newXPlevel);
|
profile.setSkillXpLevel(primarySkillType, newXPlevel);
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables.database;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@ -20,7 +21,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class UUIDUpdateAsyncTask implements Runnable {
|
public class UUIDUpdateAsyncTask extends CancellableRunnable {
|
||||||
private static final Gson GSON = new Gson();
|
private static final Gson GSON = new Gson();
|
||||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
||||||
|
|
||||||
@ -109,11 +110,11 @@ public class UUIDUpdateAsyncTask implements Runnable {
|
|||||||
|
|
||||||
// Bukkit runnables don't let themselves reschedule themselves, so we are a pseudo bukkit runnable.
|
// Bukkit runnables don't let themselves reschedule themselves, so we are a pseudo bukkit runnable.
|
||||||
private void runTaskLaterAsynchronously(mcMMO plugin, int delay) {
|
private void runTaskLaterAsynchronously(mcMMO plugin, int delay) {
|
||||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, this, delay);
|
plugin.getFoliaLib().getImpl().runLaterAsync(this, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, this);
|
plugin.getFoliaLib().getImpl().runAsync(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static UUID toUUID(String id) {
|
private static UUID toUUID(String id) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.runnables.database;
|
package com.gmail.nossr50.runnables.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
public class UserPurgeTask extends BukkitRunnable {
|
public class UserPurgeTask extends CancellableRunnable {
|
||||||
private final ReentrantLock lock = new ReentrantLock();
|
private final ReentrantLock lock = new ReentrantLock();
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.runnables.items;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.ChimaeraWing;
|
import com.gmail.nossr50.util.ChimaeraWing;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -10,9 +11,8 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class ChimaeraWingWarmup extends BukkitRunnable {
|
public class ChimaeraWingWarmup extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
public ChimaeraWingWarmup(McMMOPlayer mcMMOPlayer) {
|
public ChimaeraWingWarmup(McMMOPlayer mcMMOPlayer) {
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -11,9 +12,8 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class TeleportationWarmup extends BukkitRunnable {
|
public class TeleportationWarmup extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final McMMOPlayer mcMMOTarget;
|
private final McMMOPlayer mcMMOTarget;
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package com.gmail.nossr50.runnables.party;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PartyAutoKickTask extends BukkitRunnable {
|
public class PartyAutoKickTask extends CancellableRunnable {
|
||||||
private final static long KICK_TIME = 24L * 60L * 60L * 1000L * mcMMO.p.getGeneralConfig().getAutoPartyKickTime();
|
private final static long KICK_TIME = 24L * 60L * 60L * 1000L * mcMMO.p.getGeneralConfig().getAutoPartyKickTime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.runnables.player;
|
package com.gmail.nossr50.runnables.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class ClearRegisteredXPGainTask extends BukkitRunnable {
|
public class ClearRegisteredXPGainTask extends CancellableRunnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||||
|
@ -5,15 +5,16 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask;
|
import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class PlayerProfileLoadingTask extends BukkitRunnable {
|
public class PlayerProfileLoadingTask extends CancellableRunnable {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private int attempt = 0;
|
private int attempt = 0;
|
||||||
|
|
||||||
@ -37,21 +38,21 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
|
|
||||||
// Quit if they logged out
|
// Quit if they logged out
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
mcMMO.p.getLogger().info("Aborting profile loading recovery for " + player.getName() + " - player logged out");
|
LogUtils.debug(mcMMO.p.getLogger(), "Aborting profile loading recovery for " + player.getName() + " - player logged out");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
|
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
|
||||||
|
|
||||||
if(!profile.isLoaded()) {
|
if(!profile.isLoaded()) {
|
||||||
mcMMO.p.getLogger().info("Creating new data for player: "+player.getName());
|
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
|
||||||
//Profile isn't loaded so add as new user
|
//Profile isn't loaded so add as new user
|
||||||
profile = mcMMO.getDatabaseManager().newUser(player);
|
profile = mcMMO.getDatabaseManager().newUser(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If successful, schedule the apply
|
// If successful, schedule the apply
|
||||||
if (profile.isLoaded()) {
|
if (profile.isLoaded()) {
|
||||||
new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new ApplySuccessfulProfile(new McMMOPlayer(player, profile)));
|
||||||
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -73,10 +74,10 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
// Increment attempt counter and try
|
// Increment attempt counter and try
|
||||||
attempt++;
|
attempt++;
|
||||||
|
|
||||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100L)));
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player, attempt), (100 + (attempt * 100L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
private class ApplySuccessfulProfile extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
private ApplySuccessfulProfile(McMMOPlayer mcMMOPlayer) {
|
private ApplySuccessfulProfile(McMMOPlayer mcMMOPlayer) {
|
||||||
@ -103,7 +104,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new McScoreboardKeepTask(player), Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.runnables.player;
|
package com.gmail.nossr50.runnables.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
|
|
||||||
public class PlayerProfileSaveTask extends BukkitRunnable {
|
public class PlayerProfileSaveTask extends CancellableRunnable {
|
||||||
private final PlayerProfile playerProfile;
|
private final PlayerProfile playerProfile;
|
||||||
private final boolean isSync;
|
private final boolean isSync;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.runnables.player;
|
package com.gmail.nossr50.runnables.player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class PlayerUpdateInventoryTask extends BukkitRunnable {
|
public class PlayerUpdateInventoryTask extends CancellableRunnable {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
public PlayerUpdateInventoryTask(Player player) {
|
public PlayerUpdateInventoryTask(Player player) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.runnables.player;
|
package com.gmail.nossr50.runnables.player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class PowerLevelUpdatingTask extends BukkitRunnable {
|
public class PowerLevelUpdatingTask extends CancellableRunnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!ScoreboardManager.powerLevelHeartbeat()) {
|
if (!ScoreboardManager.powerLevelHeartbeat()) {
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class AbilityCooldownTask extends BukkitRunnable {
|
public class AbilityCooldownTask extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final SuperAbilityType ability;
|
private final SuperAbilityType ability;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
@ -12,9 +13,8 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class AbilityDisableTask extends BukkitRunnable {
|
public class AbilityDisableTask extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final SuperAbilityType ability;
|
private final SuperAbilityType ability;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||||
}
|
}
|
||||||
if(!mcMMO.isServerShutdownExecuted()) {
|
if(!mcMMO.isServerShutdownExecuted()) {
|
||||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,15 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class AlchemyBrewCheckTask extends BukkitRunnable {
|
public class AlchemyBrewCheckTask extends CancellableRunnable {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final BrewingStand brewingStand;
|
private final BrewingStand brewingStand;
|
||||||
private final ItemStack[] oldInventory;
|
private final ItemStack[] oldInventory;
|
||||||
|
@ -7,6 +7,7 @@ import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -15,9 +16,8 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class AlchemyBrewTask extends BukkitRunnable {
|
public class AlchemyBrewTask extends CancellableRunnable {
|
||||||
private static final double DEFAULT_BREW_SPEED = 1.0;
|
private static final double DEFAULT_BREW_SPEED = 1.0;
|
||||||
private static final int DEFAULT_BREW_TICKS = 400;
|
private static final int DEFAULT_BREW_TICKS = 400;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
|||||||
fuel--;
|
fuel--;
|
||||||
|
|
||||||
Alchemy.brewingStandMap.put(location, this);
|
Alchemy.brewingStandMap.put(location, this);
|
||||||
this.runTaskTimer(mcMMO.p, 1, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationTimer(location, this, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
//import org.bukkit.ChatColor;
|
//import org.bukkit.ChatColor;
|
||||||
//import org.bukkit.Statistic;
|
//import org.bukkit.Statistic;
|
||||||
//import org.bukkit.entity.Player;
|
//import org.bukkit.entity.Player;
|
||||||
//import org.bukkit.scheduler.BukkitRunnable;
|
//import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
//
|
//
|
||||||
//public class AprilTask extends BukkitRunnable {
|
//public class AprilTask extends CancellableRunnable {
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public void run() {
|
// public void run() {
|
||||||
|
@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
|||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class AwardCombatXpTask extends BukkitRunnable {
|
public class AwardCombatXpTask extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final double baseXp;
|
private final double baseXp;
|
||||||
private final PrimarySkillType primarySkillType;
|
private final PrimarySkillType primarySkillType;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
//import org.bukkit.entity.Player;
|
//import org.bukkit.entity.Player;
|
||||||
//import org.bukkit.event.entity.EntityDamageEvent;
|
//import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
//import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.inventory.ItemStack;
|
||||||
//import org.bukkit.scheduler.BukkitRunnable;
|
//import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
//import org.jetbrains.annotations.NotNull;
|
//import org.jetbrains.annotations.NotNull;
|
||||||
//
|
//
|
||||||
//import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
@ -23,7 +23,7 @@
|
|||||||
//import java.util.Map;
|
//import java.util.Map;
|
||||||
//import java.util.Map.Entry;
|
//import java.util.Map.Entry;
|
||||||
//
|
//
|
||||||
//public class BleedTimerTask extends BukkitRunnable {
|
//public class BleedTimerTask extends CancellableRunnable {
|
||||||
// private static final @NotNull Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
|
// private static final @NotNull Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
|
||||||
// private static boolean isIterating = false;
|
// private static boolean isIterating = false;
|
||||||
//
|
//
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta;
|
import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -14,11 +15,10 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.block.data.Directional;
|
import org.bukkit.block.data.Directional;
|
||||||
import org.bukkit.block.data.type.Cocoa;
|
import org.bukkit.block.data.type.Cocoa;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class DelayedCropReplant extends BukkitRunnable {
|
public class DelayedCropReplant extends CancellableRunnable {
|
||||||
|
|
||||||
private final int desiredCropAge;
|
private final int desiredCropAge;
|
||||||
private final Location cropLocation;
|
private final Location cropLocation;
|
||||||
@ -54,7 +54,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
|||||||
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
||||||
|
|
||||||
//Remove the metadata marking the block as recently replanted
|
//Remove the metadata marking the block as recently replanted
|
||||||
new markPlantAsOld(blockBreakEvent.getBlock().getLocation()).runTaskLater(mcMMO.p, 10);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
||||||
|
|
||||||
if(blockBreakEvent.isCancelled()) {
|
if(blockBreakEvent.isCancelled()) {
|
||||||
wasImmaturePlant = true;
|
wasImmaturePlant = true;
|
||||||
@ -101,7 +101,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
|||||||
|
|
||||||
//Play an effect
|
//Play an effect
|
||||||
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
|
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
|
||||||
new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(newState.getLocation(), new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
|||||||
COCOA
|
COCOA
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PhysicsBlockUpdate extends BukkitRunnable {
|
private static class PhysicsBlockUpdate extends CancellableRunnable {
|
||||||
private final Block plantBlock;
|
private final Block plantBlock;
|
||||||
private final PlantAnchorType plantAnchorType;
|
private final PlantAnchorType plantAnchorType;
|
||||||
private BlockFace plantFace;
|
private BlockFace plantFace;
|
||||||
@ -160,7 +160,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static class markPlantAsOld extends BukkitRunnable {
|
private static class markPlantAsOld extends CancellableRunnable {
|
||||||
|
|
||||||
private final Location cropLoc;
|
private final Location cropLoc;
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.BlockSnapshot;
|
import com.gmail.nossr50.datatypes.BlockSnapshot;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class DelayedHerbalismXPCheckTask extends BukkitRunnable {
|
public class DelayedHerbalismXPCheckTask extends CancellableRunnable {
|
||||||
|
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final ArrayList<BlockSnapshot> chorusBlocks;
|
private final ArrayList<BlockSnapshot> chorusBlocks;
|
||||||
|
@ -2,10 +2,10 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class ExperienceBarHideTask extends BukkitRunnable {
|
public class ExperienceBarHideTask extends CancellableRunnable {
|
||||||
public final McMMOPlayer mcMMOPlayer;
|
public final McMMOPlayer mcMMOPlayer;
|
||||||
public final PrimarySkillType primarySkillType;
|
public final PrimarySkillType primarySkillType;
|
||||||
public final ExperienceBarManager experienceBarManagerRef;
|
public final ExperienceBarManager experienceBarManagerRef;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class HerbalismBlockUpdaterTask extends BukkitRunnable {
|
public class HerbalismBlockUpdaterTask extends CancellableRunnable {
|
||||||
private final BlockState blockState;
|
private final BlockState blockState;
|
||||||
|
|
||||||
public HerbalismBlockUpdaterTask(BlockState blockState) {
|
public HerbalismBlockUpdaterTask(BlockState blockState) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.entity.FishHook;
|
import org.bukkit.entity.FishHook;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MasterAnglerTask extends BukkitRunnable {
|
public class MasterAnglerTask extends CancellableRunnable {
|
||||||
private final @NotNull FishHook fishHook;
|
private final @NotNull FishHook fishHook;
|
||||||
private final @NotNull FishingManager fishingManager;
|
private final @NotNull FishingManager fishingManager;
|
||||||
private final int lureLevel;
|
private final int lureLevel;
|
||||||
|
@ -3,15 +3,15 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
|
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RuptureTask extends BukkitRunnable {
|
public class RuptureTask extends CancellableRunnable {
|
||||||
|
|
||||||
public static final int DAMAGE_TICK_INTERVAL = 10;
|
public static final int DAMAGE_TICK_INTERVAL = 10;
|
||||||
public static final int ANIMATION_TICK_INTERVAL = 1;
|
public static final int ANIMATION_TICK_INTERVAL = 1;
|
||||||
|
@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
|
|
||||||
public class SkillUnlockNotificationTask extends BukkitRunnable {
|
public class SkillUnlockNotificationTask extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final SubSkillType subSkillType;
|
private final SubSkillType subSkillType;
|
||||||
private final int rank;
|
private final int rank;
|
||||||
|
@ -4,10 +4,10 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class ToolLowerTask extends BukkitRunnable {
|
public class ToolLowerTask extends CancellableRunnable {
|
||||||
private final McMMOPlayer mcMMOPlayer;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
private final ToolType tool;
|
private final ToolType tool;
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||||
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
||||||
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
||||||
metaCleanupTask.runTaskTimer(mcMMO.p, 20, 20*60); //one minute
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mob, metaCleanupTask, 20, 20*60); //one minute
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.alchemy;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
||||||
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -58,7 +59,7 @@ public final class Alchemy {
|
|||||||
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
|
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
|
||||||
*/
|
*/
|
||||||
public static void finishAllBrews() {
|
public static void finishAllBrews() {
|
||||||
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
LogUtils.debug(mcMMO.p.getLogger(), "Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
||||||
|
|
||||||
List<AlchemyBrewTask> toFinish = new ArrayList<>(brewingStandMap.values());
|
List<AlchemyBrewTask> toFinish = new ArrayList<>(brewingStandMap.values());
|
||||||
|
|
||||||
|
@ -259,13 +259,13 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
||||||
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new AlchemyBrewCheckTask(player, brewingStand));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void scheduleUpdate(Inventory inventory) {
|
public static void scheduleUpdate(Inventory inventory) {
|
||||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||||
if (humanEntity instanceof Player) {
|
if (humanEntity instanceof Player) {
|
||||||
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(humanEntity, new PlayerUpdateInventoryTask((Player) humanEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user