mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5386817faf
110
Changelog.txt
110
Changelog.txt
@ -1,6 +1,112 @@
|
|||||||
Version 2.2.007
|
Version 2.2.013
|
||||||
Fixed bug where Green Thumb did not replant if seed was in the off hand
|
Modified the RNG for dropping non-ore blocks from Blast Mining to yield about 50% of what was destroyed
|
||||||
|
(API) Deprecated com.gmail.nossr50.mcMMO.getPlaceStore
|
||||||
|
(API) Added com.gmail.nossr50.mcMMO.getUserBlockTracker
|
||||||
|
(API) Added com.gmail.nossr50.mcMMO.getChunkManager
|
||||||
|
(API) Added new methods to com.gmail.nossr50.util.blockmeta.UserBlockTracker for easier readability
|
||||||
|
(API) Deprecated the old poorly named methods in UserBlockTracker
|
||||||
|
(Codebase) Cleaned up and organized unit tests relating to UserBlockTracker
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Not planning to delete the deprecated methods in UserBlockTracker anytime soon, as nothing has really changed other than the names
|
||||||
|
|
||||||
|
Version 2.2.012
|
||||||
|
Fixed a bug where Daze would cause an exception in older game versions (1.20.4 and older)
|
||||||
|
|
||||||
|
Version 2.2.011
|
||||||
|
Fixed bug where some potions on older versions (1.20.4 and older) were not brewable (night vision extended, etc)
|
||||||
|
Improved logging for Alchemy potion look up (see notes)
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Added detailed logging when multiple configured potions match an ItemStack.
|
||||||
|
This will help identify issues with potion configuration.
|
||||||
|
|
||||||
|
Version 2.2.010
|
||||||
|
Fixed being unable to load REGEN potion type on new versions of Paper/Spigot 1.20.6
|
||||||
|
Fixed some potions not gaining XP when brewed (Level 2 potions, etc)
|
||||||
|
BrewingStands will now remember who owns them, this persists across restarts (see notes)
|
||||||
|
Fixed rare NPE in mcMMO events when player data was unable to be retrieved
|
||||||
|
Fixed a NPE that could happen when damaging armor with Axes
|
||||||
|
Fixed a bug where Alchemy brewing would be cancelled if the player died
|
||||||
|
(API) Added getMcMMOPlayer() to McMMOPlayerSkillEvent
|
||||||
|
(API) Added new ctor McMMOPlayerSkillEvent(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType)
|
||||||
|
(API) Deprecated ctor McMMOPlayerSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Added ctor McMMOPlayerAbilityEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Deprecated ctor McMMOPlayerAbilityEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Deprecated ctor McMMOPlayerAbilityActivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Added ctor McMMOPlayerAbilityActivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Deprecated ctor McMMOPlayerCatalysisEvent(org.bukkit.entity.Player, double)
|
||||||
|
(API) Added ctor McMMOPlayerCatalysisEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, double)
|
||||||
|
(API) Deprecated util method EventUtils.callPlayerAbilityActivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Added util method EventUtils.callPlayerAbilityActivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Deprecated ctor McMMOPlayerFishingEvent(org.bukkit.entity.Player)
|
||||||
|
(API) Added ctor McMMOPlayerFishingEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer)
|
||||||
|
(API) Deprecated ctor McMMOPlayerFishingTreasureEvent.McMMOPlayerFishingTreasureEvent(org.bukkit.entity.Player, org.bukkit.inventory.ItemStack, int)
|
||||||
|
(API) Added ctor McMMOPlayerFishingTreasureEvent.McMMOPlayerFishingTreasureEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, org.bukkit.inventory.ItemStack, int)
|
||||||
|
(API) Deprecated ctor McMMOPlayerMagicHunterEvent(org.bukkit.entity.Player, org.bukkit.inventory.ItemStack, int, java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer>)
|
||||||
|
(API) Added ctor McMMOPlayerMagicHunterEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, org.bukkit.inventory.ItemStack, int, java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer>)
|
||||||
|
(API) Deprecated ctor McMMOPlayerAbilityDeactivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Added ctor McMMOPlayerAbilityDeactivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
|
||||||
|
(API) Deprecated util method EventUtils.callAbilityDeactivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SuperAbilityType)
|
||||||
|
(API) Added util method EventUtils.callAbilityDeactivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SuperAbilityType)
|
||||||
|
(API) Deprecated util EventUtils.callSubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType)
|
||||||
|
(API) Added util EventUtils.callSubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType)
|
||||||
|
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType)
|
||||||
|
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType)
|
||||||
|
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType, double)
|
||||||
|
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType, double)
|
||||||
|
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill)
|
||||||
|
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill)
|
||||||
|
(API) Deprecated ctor AlchemyBrewCheckTask(org.bukkit.entity.Player, org.bukkit.block.BrewingStand)
|
||||||
|
(API) Added ctor AlchemyBrewCheckTask(org.bukkit.block.BrewingStand)
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
You can now use hoppers and brewing stands and not have to worry about having to re-interact with the brewing stand over and over again
|
||||||
|
Ownership of a brewing stand is whoever last interacted with it, this persists across restarts
|
||||||
|
This is not an exhaustive list of API changes in this update, but most of the important ones should be documented here.
|
||||||
|
|
||||||
|
Version 2.2.009
|
||||||
|
Fixed a bug that prevented mcMMO from loading on MC versions older than 1.20.6
|
||||||
|
Dramatically increased the base XP for Alchemy again (see notes)
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Alchemy leveling still felt too slow, so I've increased it again. You can either delete experience.yml to get the new values or adjust them manually.
|
||||||
|
If you haven't updated mcMMO since 2.2.006 or older you don't need to do anything to get these new values.
|
||||||
|
The new default values are...
|
||||||
|
Potion_Brewing:
|
||||||
|
Stage_1: 666
|
||||||
|
Stage_2: 1111
|
||||||
|
Stage_3: 1750
|
||||||
|
Stage_4: 2250
|
||||||
|
|
||||||
|
Version 2.2.008
|
||||||
|
Fixed alchemy potions not upgrading correctly (This will only affect new potions made, see notes)
|
||||||
|
Fixed a bug where alchemy potions had italicized names
|
||||||
|
Fixed a bug where messages were not being sent to the action bar in 1.20.6
|
||||||
|
(SQL) Fixed bug that broke /mccooldowns and /archery in some circumstances
|
||||||
|
Fixed some exceptions that could happen with parties disabled (thanks IAISI)
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
mcMMO-exclusive Potions (haste, etc) made on version 2.2.007 of mcMMO will not upgrade correctly, you'll just have to make new ones. Sorry for the inconvenience.
|
||||||
|
Alchemy potions will now be brewed as type "Mundane" behind the scenes, this used to be Uncraftable/Water. This led to some issues. So I've changed it to be Mundane.
|
||||||
|
|
||||||
|
Version 2.2.007
|
||||||
|
Compatibility with the 1.20.5 / 1.20.6 MC Update
|
||||||
|
Fixed bug where Alchemy was not brewing certain potions (haste, etc)
|
||||||
|
Tree Feller no longer restricts how many saplings can drop
|
||||||
|
Tree Feller now drops leaves 25% of the time (up from 10%)
|
||||||
|
Alchemy XP has been DRAMATICALLY increased, it was extremely grindy by default
|
||||||
|
Alchemy experience values in experience.yml are now found under 'Experience_Values.Alchemy.Potion_Brewing'
|
||||||
|
Fixed bug where the probability of success of Graceful Roll was not being calculated correctly
|
||||||
|
Fixed bug where Green Thumb did not replant if seed was in the off hand
|
||||||
|
Added armadillo to combat experience in experience.yml
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
While fixing various Alchemy bugs, I noticed Alchemy leveled SUPER slow, I have increased it dramatically. Feel free to change it back by modifying the new values in experience.yml
|
||||||
|
I did my best to keep mcMMO compatible with older versions of Minecraft for this update.
|
||||||
|
This update to MC was quite large, with breaking changes to a lot of code relating to Alchemy, and some other things.
|
||||||
|
I expect there to be bugs, please report them on GitHub or Discord, but preferably GitHub.
|
||||||
|
I will be working on fixing these bugs as they come in, so please be patient.
|
||||||
Version 2.2.006
|
Version 2.2.006
|
||||||
Added new config custom_item_support.yml
|
Added new config custom_item_support.yml
|
||||||
Added support for hex color codes in the locale file, uses the format &#RRGGBB (see notes)
|
Added support for hex color codes in the locale file, uses the format &#RRGGBB (see notes)
|
||||||
|
121
pom.xml
121
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.2.007-SNAPSHOT</version>
|
<version>2.2.013-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
@ -75,16 +75,17 @@
|
|||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M7</version>
|
<version>3.2.5</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
|
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
|
||||||
<trimStackTrace>false</trimStackTrace>
|
<trimStackTrace>false</trimStackTrace>
|
||||||
|
<excludedGroups>skip</excludedGroups>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>3.0.0-M7</version>
|
<version>3.2.5</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
|
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
|
||||||
@ -95,12 +96,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>3.0.0-M6</version>
|
<version>3.0.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.10.1</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<release>17</release>
|
<release>17</release>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
@ -112,6 +113,7 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.7.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<descriptors>
|
||||||
<descriptor>src/main/assembly/package.xml</descriptor>
|
<descriptor>src/main/assembly/package.xml</descriptor>
|
||||||
@ -130,7 +132,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.5.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
@ -140,23 +142,22 @@
|
|||||||
<include>org.bstats:bstats-base</include>
|
<include>org.bstats:bstats-base</include>
|
||||||
<include>org.bstats:bstats-bukkit</include>
|
<include>org.bstats:bstats-bukkit</include>
|
||||||
<include>net.kyori:adventure-api</include>
|
<include>net.kyori:adventure-api</include>
|
||||||
<include>net.kyori:adventure-text-serializer-gson</include>
|
|
||||||
<include>net.kyori:adventure-platform-bukkit</include>
|
|
||||||
<include>net.kyori:adventure-platform-api</include>
|
|
||||||
<include>net.kyori:adventure-platform-viaversion</include>
|
|
||||||
<include>net.kyori:adventure-platform-facet</include>
|
|
||||||
<include>net.kyori:adventure-nbt</include>
|
|
||||||
<include>net.kyori:adventure-key</include>
|
<include>net.kyori:adventure-key</include>
|
||||||
|
<include>net.kyori:adventure-nbt</include>
|
||||||
|
<include>net.kyori:adventure-platform-api</include>
|
||||||
|
<include>net.kyori:adventure-platform-bukkit</include>
|
||||||
|
<include>net.kyori:adventure-platform-facet</include>
|
||||||
|
<include>net.kyori:adventure-platform-viaversion</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-bungeecord</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-gson</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-json</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-legacy</include>
|
||||||
<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-gson</include>
|
|
||||||
<include>net.kyori:adventure-text-serializer-json</include>
|
|
||||||
<include>net.kyori:adventure-text-serializer-bungeecord</include>
|
|
||||||
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
|
|
||||||
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
|
|
||||||
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
|
|
||||||
<include>net.kyori:option</include>
|
<include>net.kyori:option</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
|
||||||
<include>co.aikar:acf-bukkit</include>
|
<include>co.aikar:acf-bukkit</include>
|
||||||
<include>com.tcoded:FoliaLib</include>
|
<include>com.tcoded:FoliaLib</include>
|
||||||
</includes>
|
</includes>
|
||||||
@ -222,6 +223,11 @@
|
|||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<!-- Protocol Lib Repository -->
|
||||||
|
<repository>
|
||||||
|
<id>dmulloy2-repo</id>
|
||||||
|
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
@ -254,8 +260,11 @@
|
|||||||
<id>devmart-other</id>
|
<id>devmart-other</id>
|
||||||
<url>https://nexuslite.gcnt.net/repos/other/</url>
|
<url>https://nexuslite.gcnt.net/repos/other/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!-- ... -->
|
<!-- MockBukkit -->
|
||||||
<!-- ... -->
|
<repository>
|
||||||
|
<id>papermc</id>
|
||||||
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
|
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
|
||||||
@ -265,6 +274,12 @@
|
|||||||
<version>3.25.3</version>
|
<version>3.25.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
|
<artifactId>ProtocolLib</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
@ -290,57 +305,57 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.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.15.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-json</artifactId>
|
<artifactId>adventure-text-serializer-json</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
|
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-api</artifactId>
|
<artifactId>adventure-api</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-nbt</artifactId>
|
<artifactId>adventure-nbt</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-key</artifactId>
|
<artifactId>adventure-key</artifactId>
|
||||||
<version>4.15.0</version>
|
<version>4.17.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.2</version>
|
<version>4.3.3-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
<version>4.3.2</version>
|
<version>LATEST</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-facet</artifactId>
|
<artifactId>adventure-platform-facet</artifactId>
|
||||||
<version>4.3.2</version>
|
<version>4.3.3-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-viaversion</artifactId>
|
<artifactId>adventure-platform-viaversion</artifactId>
|
||||||
<version>4.3.2</version>
|
<version>4.3.3-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
@ -350,18 +365,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||||
<version>2.0.0-M1</version>
|
<version>2.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bstats</groupId>
|
<groupId>org.bstats</groupId>
|
||||||
<artifactId>bstats-bukkit</artifactId>
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -397,36 +412,36 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<version>5.9.0</version>
|
<version>5.11.0-M2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>4.6.1</version>
|
<version>5.12.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-inline</artifactId>
|
<artifactId>mockito-inline</artifactId>
|
||||||
<version>4.6.1</version>
|
<version>5.2.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tomcat</groupId>
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<artifactId>tomcat-jdbc</artifactId>
|
<artifactId>tomcat-jdbc</artifactId>
|
||||||
<version>10.1.0-M17</version>
|
<version>10.1.24</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>23.0.0</version>
|
<version>24.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>32.1.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
|
<version>33.2.0-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -435,5 +450,29 @@
|
|||||||
<version>0.3.1</version>
|
<version>0.3.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||||
|
<!-- <artifactId>log4j-core</artifactId>-->
|
||||||
|
<!-- <version>2.22.1</version> <!– Make sure this version matches the other log4j dependencies –>-->
|
||||||
|
<!-- <scope>test</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||||
|
<!-- <artifactId>log4j-api</artifactId>-->
|
||||||
|
<!-- <version>2.22.1</version>-->
|
||||||
|
<!-- <scope>test</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||||
|
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
|
||||||
|
<!-- <version>2.22.1</version>-->
|
||||||
|
<!-- <scope>test</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.github.seeseemelk</groupId>-->
|
||||||
|
<!-- <artifactId>MockBukkit-v1.19</artifactId>-->
|
||||||
|
<!-- <version>LATEST</version>-->
|
||||||
|
<!-- <scope>test</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -83,8 +83,8 @@ public final class AbilityAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBleeding(LivingEntity entity) {
|
public static boolean isBleeding(LivingEntity entity) {
|
||||||
if(entity.isValid()) {
|
if (entity.isValid()) {
|
||||||
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
if (entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
|
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
|
||||||
if(SkillTools.isChildSkill(skillType))
|
if (SkillTools.isChildSkill(skillType))
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
||||||
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
|
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
|
||||||
@ -1143,14 +1143,10 @@ public final class ExperienceAPI {
|
|||||||
* @param blockStates the blocks to reward XP for
|
* @param blockStates the blocks to reward XP for
|
||||||
* @param mcMMOPlayer the target player
|
* @param mcMMOPlayer the target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for(BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
for(PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
|
||||||
{
|
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1163,12 +1159,9 @@ public final class ExperienceAPI {
|
|||||||
* @param mcMMOPlayer the target player
|
* @param mcMMOPlayer the target player
|
||||||
* @param skillType target primary skill
|
* @param skillType target primary skill
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
for(BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
{
|
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1179,12 +1172,9 @@ public final class ExperienceAPI {
|
|||||||
* @param blockState The target blockstate
|
* @param blockState The target blockstate
|
||||||
* @param mcMMOPlayer The target player
|
* @param mcMMOPlayer The target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for(PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
{
|
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,10 +1186,8 @@ public final class ExperienceAPI {
|
|||||||
* @param mcMMOPlayer The target player
|
* @param mcMMOPlayer The target player
|
||||||
* @param skillType target primary skill
|
* @param skillType target primary skill
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public final class PartyAPI {
|
|||||||
* @return true if the player is in a party, false otherwise
|
* @return true if the player is in a party, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean inParty(Player player) {
|
public static boolean inParty(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return UserManager.getPlayer(player).inParty();
|
return UserManager.getPlayer(player).inParty();
|
||||||
@ -94,14 +94,14 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addToParty(Player player, String partyName) {
|
public static void addToParty(Player player, String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||||
@ -109,8 +109,7 @@ public final class PartyAPI {
|
|||||||
if (party == null) {
|
if (party == null) {
|
||||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||||
} else {
|
} else {
|
||||||
if(mcMMO.p.getPartyManager().isPartyFull(player, party))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, party)) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -124,8 +123,7 @@ public final class PartyAPI {
|
|||||||
* 0 or less for no size limit
|
* 0 or less for no size limit
|
||||||
* @return the max party size on this server
|
* @return the max party size on this server
|
||||||
*/
|
*/
|
||||||
public static int getMaxPartySize()
|
public static int getMaxPartySize() {
|
||||||
{
|
|
||||||
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +138,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||||
@ -161,7 +159,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void removeFromParty(Player player) {
|
public static void removeFromParty(Player player) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
|
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
|
||||||
@ -176,7 +174,7 @@ public final class PartyAPI {
|
|||||||
* @return the leader of the party
|
* @return the leader of the party
|
||||||
*/
|
*/
|
||||||
public static @Nullable String getPartyLeader(String partyName) {
|
public static @Nullable String getPartyLeader(String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
|
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
|
||||||
@ -192,7 +190,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setPartyLeader(String partyName, String playerName) {
|
public static void setPartyLeader(String partyName, String playerName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
|
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
|
||||||
@ -208,7 +206,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +228,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static LinkedHashSet<String> getMembers(Player player) {
|
public static LinkedHashSet<String> getMembers(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
|
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
|
||||||
@ -245,7 +243,7 @@ public final class PartyAPI {
|
|||||||
* @return all the player names and uuids in the player's party
|
* @return all the player names and uuids in the player's party
|
||||||
*/
|
*/
|
||||||
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getAllMembers(player);
|
return mcMMO.p.getPartyManager().getAllMembers(player);
|
||||||
@ -260,7 +258,7 @@ public final class PartyAPI {
|
|||||||
* @return all online players in this party
|
* @return all online players in this party
|
||||||
*/
|
*/
|
||||||
public static List<Player> getOnlineMembers(String partyName) {
|
public static List<Player> getOnlineMembers(String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
|
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
|
||||||
|
@ -125,7 +125,7 @@ public class ChatManager {
|
|||||||
* @param targetChatChannel target chat channel
|
* @param targetChatChannel target chat channel
|
||||||
*/
|
*/
|
||||||
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
||||||
if(targetChatChannel == mmoPlayer.getChatChannel()) {
|
if (targetChatChannel == mmoPlayer.getChatChannel()) {
|
||||||
//Disabled message
|
//Disabled message
|
||||||
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||||
mmoPlayer.setChatMode(ChatChannel.NONE);
|
mmoPlayer.setChatMode(ChatChannel.NONE);
|
||||||
@ -144,7 +144,7 @@ public class ChatManager {
|
|||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < args.length; i++) {
|
for(int i = 0; i < args.length; i++) {
|
||||||
if(i + 1 >= args.length) {
|
if (i + 1 >= args.length) {
|
||||||
stringBuilder.append(args[i]);
|
stringBuilder.append(args[i]);
|
||||||
} else {
|
} else {
|
||||||
stringBuilder.append(args[i]).append(" ");
|
stringBuilder.append(args[i]).append(" ");
|
||||||
@ -162,12 +162,12 @@ public class ChatManager {
|
|||||||
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
|
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
|
||||||
switch (mmoPlayer.getChatChannel()) {
|
switch (mmoPlayer.getChatChannel()) {
|
||||||
case ADMIN:
|
case ADMIN:
|
||||||
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
if (mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PARTY:
|
case PARTY:
|
||||||
if(mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
|
if (mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -206,7 +206,7 @@ public class ChatManager {
|
|||||||
* @return true if the chat channel is enabled
|
* @return true if the chat channel is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
|
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
|
||||||
if(!isChatEnabled) {
|
if (!isChatEnabled) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
switch(chatChannel) {
|
switch(chatChannel) {
|
||||||
|
@ -20,12 +20,12 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(T t) {
|
public boolean test(T t) {
|
||||||
//Include the console in the audience
|
//Include the console in the audience
|
||||||
if(t instanceof ConsoleCommandSender) {
|
if (t instanceof ConsoleCommandSender) {
|
||||||
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
||||||
} else {
|
} else {
|
||||||
if(t instanceof Player player) {
|
if (t instanceof Player player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer != null) {
|
if (mcMMOPlayer != null) {
|
||||||
return mcMMOPlayer.getParty() == party;
|
return mcMMOPlayer.getParty() == party;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,15 +48,15 @@ public abstract class AbstractPlayerAuthor implements Author {
|
|||||||
*/
|
*/
|
||||||
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
||||||
//Already in cache
|
//Already in cache
|
||||||
if(sanitizedNameCache.containsKey(chatChannel)) {
|
if (sanitizedNameCache.containsKey(chatChannel)) {
|
||||||
//Update cache
|
//Update cache
|
||||||
if(useDisplayName && hasPlayerDisplayNameChanged()) {
|
if (useDisplayName && hasPlayerDisplayNameChanged()) {
|
||||||
updateLastKnownDisplayName();
|
updateLastKnownDisplayName();
|
||||||
updateSanitizedNameCache(chatChannel, true);
|
updateSanitizedNameCache(chatChannel, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Update last known display name
|
//Update last known display name
|
||||||
if(useDisplayName && hasPlayerDisplayNameChanged()) {
|
if (useDisplayName && hasPlayerDisplayNameChanged()) {
|
||||||
updateLastKnownDisplayName();
|
updateLastKnownDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public abstract class AbstractPlayerAuthor implements Author {
|
|||||||
* @param useDisplayName whether to use this authors display name
|
* @param useDisplayName whether to use this authors display name
|
||||||
*/
|
*/
|
||||||
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
||||||
if(useDisplayName) {
|
if (useDisplayName) {
|
||||||
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
|
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
|
||||||
} else {
|
} else {
|
||||||
//No need to sanitize a basic String
|
//No need to sanitize a basic String
|
||||||
|
@ -57,7 +57,7 @@ public class AdminChatMailer extends AbstractChatMailer {
|
|||||||
* @return the styled string, based on a locale entry
|
* @return the styled string, based on a locale entry
|
||||||
*/
|
*/
|
||||||
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
|
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
|
||||||
if(canColor) {
|
if (canColor) {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
|
||||||
} else {
|
} else {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
|
||||||
@ -83,7 +83,7 @@ public class AdminChatMailer extends AbstractChatMailer {
|
|||||||
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
|
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
|
|
||||||
if(!chatEvent.isCancelled()) {
|
if (!chatEvent.isCancelled()) {
|
||||||
sendMail(chatMessage);
|
sendMail(chatMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
|
|
||||||
if(!chatEvent.isCancelled()) {
|
if (!chatEvent.isCancelled()) {
|
||||||
sendMail(chatMessage);
|
sendMail(chatMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,14 +60,14 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
* @return the styled string, based on a locale entry
|
* @return the styled string, based on a locale entry
|
||||||
*/
|
*/
|
||||||
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
|
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
|
||||||
if(canColor) {
|
if (canColor) {
|
||||||
if(isLeader) {
|
if (isLeader) {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
|
||||||
} else {
|
} else {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(isLeader) {
|
if (isLeader) {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
|
||||||
} else {
|
} else {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));
|
||||||
|
@ -52,7 +52,7 @@ public class PartyChatMessage extends AbstractChatMessage {
|
|||||||
messagePartyChatSpies(spyMessage);
|
messagePartyChatSpies(spyMessage);
|
||||||
|
|
||||||
//Console message
|
//Console message
|
||||||
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
|
if (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
|
||||||
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ public class PartyChatMessage extends AbstractChatMessage {
|
|||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
//Check for toggled players
|
//Check for toggled players
|
||||||
if(mcMMOPlayer.isPartyChatSpying()) {
|
if (mcMMOPlayer.isPartyChatSpying()) {
|
||||||
Party adminParty = mcMMOPlayer.getParty();
|
Party adminParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
//Only message admins not part of this party
|
//Only message admins not part of this party
|
||||||
if(adminParty == null || adminParty != getParty()) {
|
if (adminParty == null || adminParty != getParty()) {
|
||||||
//TODO: Hacky, rewrite later
|
//TODO: Hacky, rewrite later
|
||||||
Audience audience = mcMMO.getAudiences().player(player);
|
Audience audience = mcMMO.getAudiences().player(player);
|
||||||
audience.sendMessage(spyMessage);
|
audience.sendMessage(spyMessage);
|
||||||
|
@ -47,7 +47,7 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerSkillCommands() {
|
private void registerSkillCommands() {
|
||||||
if(mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
|
if (mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
|
||||||
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,11 +56,11 @@ public class CommandManager {
|
|||||||
* Registers chat commands if the chat system is enabled
|
* Registers chat commands if the chat system is enabled
|
||||||
*/
|
*/
|
||||||
private void registerChatCommands() {
|
private void registerChatCommands() {
|
||||||
if(ChatConfig.getInstance().isChatEnabled()) {
|
if (ChatConfig.getInstance().isChatEnabled()) {
|
||||||
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
|
if (ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
|
||||||
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
||||||
}
|
}
|
||||||
if(pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
if (pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
||||||
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer issuer = context.getIssuer();
|
BukkitCommandIssuer issuer = context.getIssuer();
|
||||||
|
|
||||||
if(issuer.getIssuer() instanceof Player) {
|
if (issuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(issuer.getPlayer());
|
validateLoadedData(issuer.getPlayer());
|
||||||
} else {
|
} else {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
|
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
|
||||||
@ -88,7 +88,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer issuer = context.getIssuer();
|
BukkitCommandIssuer issuer = context.getIssuer();
|
||||||
|
|
||||||
if(issuer.getIssuer() instanceof Player) {
|
if (issuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(issuer.getPlayer());
|
validateLoadedData(issuer.getPlayer());
|
||||||
validateAdmin(issuer.getPlayer());
|
validateAdmin(issuer.getPlayer());
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
||||||
|
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -105,7 +105,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
||||||
|
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||||
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
||||||
//TODO: Is there even a point in validating permission? look into this later
|
//TODO: Is there even a point in validating permission? look into this later
|
||||||
@ -115,20 +115,20 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
|
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
|
||||||
if(!permissible.hasPermission(permissionNode)) {
|
if (!permissible.hasPermission(permissionNode)) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
|
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void validateAdmin(@NotNull Player player) {
|
public void validateAdmin(@NotNull Player player) {
|
||||||
if(!player.isOp() && !Permissions.adminChat(player)) {
|
if (!player.isOp() && !Permissions.adminChat(player)) {
|
||||||
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
|
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateLoadedData(@NotNull Player player) {
|
public void validateLoadedData(@NotNull Player player) {
|
||||||
if(UserManager.getPlayer(player) == null) {
|
if (UserManager.getPlayer(player) == null) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
|
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public class CommandManager {
|
|||||||
public void validatePlayerParty(@NotNull Player player) {
|
public void validatePlayerParty(@NotNull Player player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
|
if (!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,14 +200,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String skillName = "UNIDENTIFIED";
|
String skillName = "UNIDENTIFIED";
|
||||||
if (materialName.contains("ORE")) {
|
if (materialName.contains("ORE")) {
|
||||||
skillName = "Mining";
|
skillName = "Mining";
|
||||||
}
|
} 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("SHORT_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")) {
|
|
||||||
skillName = "Excavation";
|
skillName = "Excavation";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +219,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (skillName.equals("Mining")) {
|
if (skillName.equals("Mining")) {
|
||||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||||
}
|
} else if (skillName.equals("Woodcutting")) {
|
||||||
else if (skillName.equals("Woodcutting")) {
|
|
||||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,20 +235,15 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("PICKAXE")) {
|
if (materialName.contains("PICKAXE")) {
|
||||||
toolType = "Pickaxes";
|
toolType = "Pickaxes";
|
||||||
}
|
} else if (materialName.contains("AXE")) {
|
||||||
else if (materialName.contains("AXE")) {
|
|
||||||
toolType = "Axes";
|
toolType = "Axes";
|
||||||
}
|
} else if (materialName.contains("BOW")) {
|
||||||
else if (materialName.contains("BOW")) {
|
|
||||||
toolType = "Bows";
|
toolType = "Bows";
|
||||||
}
|
} else if (materialName.contains("HOE")) {
|
||||||
else if (materialName.contains("HOE")) {
|
|
||||||
toolType = "Hoes";
|
toolType = "Hoes";
|
||||||
}
|
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||||
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
|
||||||
toolType = "Shovels";
|
toolType = "Shovels";
|
||||||
}
|
} else if (materialName.contains("SWORD")) {
|
||||||
else if (materialName.contains("SWORD")) {
|
|
||||||
toolType = "Swords";
|
toolType = "Swords";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,14 +270,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||||
toolType = "Boots";
|
toolType = "Boots";
|
||||||
}
|
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||||
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
|
||||||
toolType = "Chestplates";
|
toolType = "Chestplates";
|
||||||
}
|
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||||
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
|
||||||
toolType = "Helmets";
|
toolType = "Helmets";
|
||||||
}
|
} else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
||||||
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
|
||||||
toolType = "Leggings";
|
toolType = "Leggings";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private void displayOtherCommands(CommandSender sender) {
|
private void displayOtherCommands(CommandSender sender) {
|
||||||
//Don't show them this category if they have none of the permissions
|
//Don't show them this category if they have none of the permissions
|
||||||
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||||
|
@ -23,12 +23,12 @@ public class McscoreboardCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
if (!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
|
if (!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
|
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,14 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
|
||||||
{
|
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||||
}
|
}
|
||||||
@ -72,34 +70,29 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldDisableToggle(args[1])) {
|
if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
mcMMO.p.setXPEventEnabled(false);
|
mcMMO.p.setXPEventEnabled(false);
|
||||||
}
|
} else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldEnableToggle(args[1])) {
|
|
||||||
mcMMO.p.setXPEventEnabled(true);
|
mcMMO.p.setXPEventEnabled(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newXpRate = Integer.parseInt(args[0]);
|
int newXpRate = Integer.parseInt(args[0]);
|
||||||
|
|
||||||
if(newXpRate < 0)
|
if (newXpRate < 0) {
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
|
||||||
{
|
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
//public class DropTreasureCommand implements CommandExecutor {
|
//public class DropTreasureCommand implements CommandExecutor {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
// if(sender instanceof Player) {
|
// if (sender instanceof Player) {
|
||||||
// if(!sender.isOp()) {
|
// if (!sender.isOp()) {
|
||||||
// sender.sendMessage("This command is for Operators only");
|
// sender.sendMessage("This command is for Operators only");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
@ -27,13 +27,13 @@
|
|||||||
// Location location = player.getLocation();
|
// Location location = player.getLocation();
|
||||||
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
//
|
//
|
||||||
// if(mmoPlayer == null) {
|
// if (mmoPlayer == null) {
|
||||||
// //TODO: Localize
|
// //TODO: Localize
|
||||||
// player.sendMessage("Your player data is not loaded yet");
|
// player.sendMessage("Your player data is not loaded yet");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(args.length == 0) {
|
// if (args.length == 0) {
|
||||||
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
|
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
|
||||||
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
|
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
|
||||||
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {
|
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {
|
||||||
|
@ -13,7 +13,7 @@ public class PlayerDebugCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||||
|
@ -25,9 +25,9 @@ public class AdminChatCommand extends BaseCommand {
|
|||||||
@Default @Conditions(CommandManager.ADMIN_CONDITION)
|
@Default @Conditions(CommandManager.ADMIN_CONDITION)
|
||||||
public void processCommand(String[] args) {
|
public void processCommand(String[] args) {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
||||||
if(args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
//Process with no arguments
|
//Process with no arguments
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
|
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
|
||||||
} else {
|
} else {
|
||||||
@ -35,10 +35,10 @@ public class AdminChatCommand extends BaseCommand {
|
|||||||
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
|
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Message contains the original command so it needs to be passed to this method to trim it
|
//Message contains the original command so it needs to be passed to this method to trim it
|
||||||
|
@ -30,9 +30,9 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
public void processCommand(String[] args) {
|
public void processCommand(String[] args) {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
||||||
|
|
||||||
if(args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
//Process with no arguments
|
//Process with no arguments
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
|
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
|
||||||
} else {
|
} else {
|
||||||
@ -45,7 +45,7 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
/*
|
/*
|
||||||
* Player Logic
|
* Player Logic
|
||||||
*/
|
*/
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
processCommandArgsPlayer(mmoPlayer, args);
|
processCommandArgsPlayer(mmoPlayer, args);
|
||||||
/*
|
/*
|
||||||
@ -72,14 +72,14 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
* @param args command arguments
|
* @param args command arguments
|
||||||
*/
|
*/
|
||||||
private void processCommandArgsConsole(@NotNull String[] args) {
|
private void processCommandArgsConsole(@NotNull String[] args) {
|
||||||
if(args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
//Only specific a party and not the message
|
//Only specific a party and not the message
|
||||||
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
|
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
|
||||||
} else {
|
} else {
|
||||||
//Grab party
|
//Grab party
|
||||||
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
|
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
|
||||||
|
|
||||||
if(targetParty != null) {
|
if (targetParty != null) {
|
||||||
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");
|
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");
|
||||||
|
@ -28,7 +28,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
|
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
|
||||||
if(oldDatabase == null) {
|
if (oldDatabase == null) {
|
||||||
sender.sendMessage("Unable to load the old database! Check your log for errors.");
|
sender.sendMessage("Unable to load the old database! Check your log for errors.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||||
} else {
|
} else {
|
||||||
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||||
@ -45,7 +45,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
|
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
|
||||||
@ -53,7 +53,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
|
@ -26,12 +26,11 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
profile.addXp(skill, value);
|
profile.addXp(skill, value);
|
||||||
profile.scheduleAsyncSave();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
@ -39,7 +38,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
|
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
|
||||||
@ -47,7 +46,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
|
@ -24,16 +24,16 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
PrimarySkillType skill;
|
PrimarySkillType skill;
|
||||||
|
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if(args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
|
if (args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionsCheckSelf(sender)) {
|
if (!permissionsCheckSelf(sender)) {
|
||||||
if(command.getPermissionMessage() != null)
|
if (command.getPermissionMessage() != null)
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
sender.sendMessage("(mcMMO) No permission!");
|
sender.sendMessage("(mcMMO) No permission!");
|
||||||
return true;
|
return true;
|
||||||
@ -49,15 +49,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && SkillTools.isChildSkill(skill))
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(sender.getName()) == null)
|
if (UserManager.getPlayer(sender.getName()) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -65,7 +63,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
|
|
||||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
|
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
|
||||||
return true;
|
return true;
|
||||||
} else if((args.length == 3 && !isSilent(args))
|
} else if ((args.length == 3 && !isSilent(args))
|
||||||
|| (args.length == 4 && isSilent(args))) {
|
|| (args.length == 4 && isSilent(args))) {
|
||||||
if (!permissionsCheckOthers(sender)) {
|
if (!permissionsCheckOthers(sender)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
@ -82,8 +80,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && SkillTools.isChildSkill(skill))
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -104,14 +101,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
//Check loading by name
|
//Check loading by name
|
||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
||||||
|
|
||||||
if(CommandUtils.unloadedProfile(sender, profile)) {
|
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill, value, isSilent(args));
|
editValues(null, profile, skill, value, isSilent(args));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +122,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
private boolean isSilent(String[] args) {
|
private boolean isSilent(String[] args) {
|
||||||
int length = args.length;
|
int length = args.length;
|
||||||
|
|
||||||
if(length == 0)
|
if (length == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return args[length-1].equalsIgnoreCase("-s");
|
return args[length-1].equalsIgnoreCase("-s");
|
||||||
@ -159,8 +155,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,8 +169,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player, value, isSilent);
|
handlePlayerMessageAll(player, value, isSilent);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill, value);
|
handleCommand(player, profile, skill, value);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -41,7 +41,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||||
} else {
|
} else {
|
||||||
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||||
@ -51,7 +51,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
|
||||||
@ -59,7 +59,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));
|
||||||
|
@ -48,8 +48,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
|
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +67,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
|
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,14 +85,13 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
||||||
|
|
||||||
//Check if it was present in DB
|
//Check if it was present in DB
|
||||||
if(CommandUtils.unloadedProfile(sender, profile)) {
|
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill);
|
editValues(null, profile, skill);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,8 +153,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,8 +167,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player);
|
handlePlayerMessageAll(player);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill);
|
handleCommand(player, profile, skill);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -12,8 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -207,8 +206,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -70,8 +69,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (isUnlockedFeature(party, partyFeature)) {
|
if (isUnlockedFeature(party, partyFeature)) {
|
||||||
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,7 @@ import java.util.Locale;
|
|||||||
public class PartyItemShareCommand implements CommandExecutor {
|
public class PartyItemShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -50,11 +49,9 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||||
toggle = true;
|
toggle = true;
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[2])) {
|
|
||||||
toggle = false;
|
toggle = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -62,8 +61,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getPartyManager().isPartyFull(player, targetParty))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, targetParty)) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
if (args[0].equalsIgnoreCase("lock")) {
|
if (args[0].equalsIgnoreCase("lock")) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (args[0].equalsIgnoreCase("unlock")) {
|
||||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,11 +32,9 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[1])) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendUsageStrings(sender);
|
sendUsageStrings(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +52,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePartyLock(CommandSender sender, boolean lock) {
|
private void togglePartyLock(CommandSender sender, boolean lock) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,15 @@ public enum PartySubcommandType {
|
|||||||
|
|
||||||
if (commandName.equalsIgnoreCase("?")) {
|
if (commandName.equalsIgnoreCase("?")) {
|
||||||
return HELP;
|
return HELP;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
||||||
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
|
||||||
return QUIT;
|
return QUIT;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("leader")) {
|
||||||
else if (commandName.equalsIgnoreCase("leader")) {
|
|
||||||
return OWNER;
|
return OWNER;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
||||||
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
|
||||||
return XPSHARE;
|
return XPSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||||
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
|
||||||
return ITEMSHARE;
|
return ITEMSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("ally")) {
|
||||||
else if (commandName.equalsIgnoreCase("ally")) {
|
|
||||||
return ALLIANCE;
|
return ALLIANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isConfirmRequired()) {
|
if (ptpRecord.isConfirmRequired()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,8 +55,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
||||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -45,22 +45,20 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (!UserManager.hasPlayerDataKey(player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -171,8 +169,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
|
||||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -228,14 +225,12 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
||||||
if(UserManager.getPlayer(targetPlayer) == null)
|
if (UserManager.getPlayer(targetPlayer) == null) {
|
||||||
{
|
|
||||||
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer(teleportingPlayer) == null)
|
if (UserManager.getPlayer(teleportingPlayer) == null) {
|
||||||
{
|
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -250,8 +245,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));
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ public class PtpToggleCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isEnabled()) {
|
if (ptpRecord.isEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.player;
|
|||||||
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.runnables.commands.McrankCommandAsyncTask;
|
import com.gmail.nossr50.runnables.commands.McRankCommandAsyncTask;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@ -85,8 +85,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -111,7 +110,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();
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
|
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) {
|
||||||
|
@ -4,7 +4,7 @@ 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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
import com.gmail.nossr50.runnables.commands.McTopCommandAsyncTask;
|
||||||
import com.gmail.nossr50.util.MetadataConstants;
|
import com.gmail.nossr50.util.MetadataConstants;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@ -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();
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
|
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) {
|
||||||
|
@ -24,22 +24,22 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
|
||||||
if(mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.length == 0) {
|
if (args.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else if(args.length < 2) {
|
} else if (args.length < 2) {
|
||||||
String option = args[0];
|
String option = args[0];
|
||||||
|
|
||||||
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
|
if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
|
||||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
|
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
|
||||||
return true;
|
return true;
|
||||||
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
|
} else if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
|
||||||
mmoPlayer.getExperienceBarManager().disableAllBars();
|
mmoPlayer.getExperienceBarManager().disableAllBars();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -50,7 +50,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
} else if (args.length == 2) {
|
} else if (args.length == 2) {
|
||||||
String skillName = args[1];
|
String skillName = args[1];
|
||||||
|
|
||||||
if(SkillUtils.isSkill(skillName)) {
|
if (SkillUtils.isSkill(skillName)) {
|
||||||
|
|
||||||
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
|
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
String option = args[0].toLowerCase();
|
String option = args[0].toLowerCase();
|
||||||
|
|
||||||
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
|
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
|
||||||
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
|
if (settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
|
||||||
//Change setting
|
//Change setting
|
||||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
|
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
|
||||||
return true;
|
return true;
|
||||||
@ -103,7 +103,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
|
|
||||||
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
|
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
|
||||||
case 2:
|
case 2:
|
||||||
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
|
if (!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
|
||||||
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
@ -29,7 +29,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// ACROBATICS_DODGE
|
// ACROBATICS_DODGE
|
||||||
if (canDodge) {
|
if (canDodge) {
|
||||||
String[] dodgeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_DODGE);
|
final String[] dodgeStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_DODGE);
|
||||||
dodgeChance = dodgeStrings[0];
|
dodgeChance = dodgeStrings[0];
|
||||||
dodgeChanceLucky = dodgeStrings[1];
|
dodgeChanceLucky = dodgeStrings[1];
|
||||||
}
|
}
|
||||||
@ -54,9 +54,8 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
||||||
|
|
||||||
if(abstractSubSkill != null)
|
if (abstractSubSkill != null) {
|
||||||
{
|
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
||||||
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
|
||||||
|
|
||||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -30,14 +29,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(Player player) {
|
protected String[] calculateAbilityDisplayValues(Player player) {
|
||||||
//TODO: Needed?
|
AlchemyManager alchemyManager = mmoPlayer.getAlchemyManager();
|
||||||
if(UserManager.getPlayer(player) == null)
|
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
|
||||||
return new String[] {"DATA NOT LOADED", "DATA NOT LOADED"};
|
|
||||||
}
|
|
||||||
|
|
||||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
|
||||||
String[] displayValues = new String[2];
|
String[] displayValues = new String[2];
|
||||||
|
|
||||||
boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);
|
boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);
|
||||||
@ -59,7 +51,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
// ALCHEMY_CONCOCTIONS
|
// ALCHEMY_CONCOCTIONS
|
||||||
if (canConcoctions) {
|
if (canConcoctions) {
|
||||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
AlchemyManager alchemyManager = mmoPlayer.getAlchemyManager();
|
||||||
tier = alchemyManager.getTier();
|
tier = alchemyManager.getTier();
|
||||||
ingredientCount = alchemyManager.getIngredients().size();
|
ingredientCount = alchemyManager.getIngredients().size();
|
||||||
ingredientList = alchemyManager.getIngredientList();
|
ingredientList = alchemyManager.getIngredientList();
|
||||||
|
@ -33,14 +33,14 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// ARCHERY_ARROW_RETRIEVAL
|
// ARCHERY_ARROW_RETRIEVAL
|
||||||
if (canRetrieve) {
|
if (canRetrieve) {
|
||||||
String[] retrieveStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
String[] retrieveStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||||
retrieveChance = retrieveStrings[0];
|
retrieveChance = retrieveStrings[0];
|
||||||
retrieveChanceLucky = retrieveStrings[1];
|
retrieveChanceLucky = retrieveStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ARCHERY_DAZE
|
// ARCHERY_DAZE
|
||||||
if (canDaze) {
|
if (canDaze) {
|
||||||
String[] dazeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_DAZE);
|
String[] dazeStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ARCHERY_DAZE);
|
||||||
dazeChance = dazeStrings[0];
|
dazeChance = dazeStrings[0];
|
||||||
dazeChanceLucky = dazeStrings[1];
|
dazeChanceLucky = dazeStrings[1];
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.axes.Axes;
|
import com.gmail.nossr50.skills.axes.Axes;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -38,7 +37,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// ARMOR IMPACT
|
// ARMOR IMPACT
|
||||||
if (canImpact) {
|
if (canImpact) {
|
||||||
impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage();
|
impactDamage = mmoPlayer.getAxesManager().getImpactDurabilityDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// AXE MASTERY
|
// AXE MASTERY
|
||||||
@ -48,7 +47,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
|
|
||||||
// CRITICAL HIT
|
// CRITICAL HIT
|
||||||
if (canCritical) {
|
if (canCritical) {
|
||||||
String[] criticalHitStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
String[] criticalHitStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||||
critChance = criticalHitStrings[0];
|
critChance = criticalHitStrings[0];
|
||||||
critChanceLucky = criticalHitStrings[1];
|
critChanceLucky = criticalHitStrings[1];
|
||||||
}
|
}
|
||||||
@ -96,7 +95,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
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.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
@ -42,7 +40,6 @@ public class CrossbowsCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
|
||||||
if (mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
@ -57,7 +54,7 @@ public class CrossbowsCommand extends SkillCommand {
|
|||||||
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
|
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
|
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -45,7 +44,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();
|
ExcavationManager excavationManager = mmoPlayer.getExcavationManager();
|
||||||
|
|
||||||
if (canGigaDrill) {
|
if (canGigaDrill) {
|
||||||
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
||||||
@ -54,7 +53,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||||
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||||
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
||||||
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.Probability;
|
import com.gmail.nossr50.util.random.Probability;
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -50,7 +49,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = mmoPlayer.getFishingManager();
|
||||||
|
|
||||||
// TREASURE HUNTER
|
// TREASURE HUNTER
|
||||||
if (canTreasureHunt) {
|
if (canTreasureHunt) {
|
||||||
@ -73,7 +72,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalEnchantChance >= 1)
|
if (totalEnchantChance >= 1)
|
||||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||||
else
|
else
|
||||||
magicChance = percent.format(0);
|
magicChance = percent.format(0);
|
||||||
|
@ -49,13 +49,13 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_VERDANT_BOUNTY);
|
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_VERDANT_BOUNTY);
|
||||||
tripleDropChance = tripleDropStrings[0];
|
tripleDropChance = tripleDropStrings[0];
|
||||||
tripleDropChanceLucky = tripleDropStrings[1];
|
tripleDropChanceLucky = tripleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -76,21 +76,21 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||||
|
|
||||||
String[] greenThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
String[] greenThumbStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||||
greenThumbChance = greenThumbStrings[0];
|
greenThumbChance = greenThumbStrings[0];
|
||||||
greenThumbChanceLucky = greenThumbStrings[1];
|
greenThumbChanceLucky = greenThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// HYLIAN LUCK
|
// HYLIAN LUCK
|
||||||
if (hasHylianLuck) {
|
if (hasHylianLuck) {
|
||||||
String[] hylianLuckStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
String[] hylianLuckStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||||
hylianLuckChance = hylianLuckStrings[0];
|
hylianLuckChance = hylianLuckStrings[0];
|
||||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHROOM THUMB
|
// SHROOM THUMB
|
||||||
if (canShroomThumb) {
|
if (canShroomThumb) {
|
||||||
String[] shroomThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
String[] shroomThumbStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||||
shroomThumbChance = shroomThumbStrings[0];
|
shroomThumbChance = shroomThumbStrings[0];
|
||||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
//package com.gmail.nossr50.commands.skills;
|
||||||
|
//
|
||||||
|
//import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
//import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
//import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
|
//import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
//import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
|
//import net.kyori.adventure.text.Component;
|
||||||
|
//import org.bukkit.ChatColor;
|
||||||
|
//import org.bukkit.entity.Player;
|
||||||
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//import static com.gmail.nossr50.datatypes.skills.SubSkillType.MACES_MACES_LIMIT_BREAK;
|
||||||
|
//
|
||||||
|
//public class MacesCommand extends SkillCommand {
|
||||||
|
//
|
||||||
|
// public MacesCommand() {
|
||||||
|
// super(PrimarySkillType.MACES);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected void dataCalculations(Player player, float skillValue) {}
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected void permissionsCheck(Player player) {}
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
|
// List<String> messages = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// if (SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
|
||||||
|
// messages.add(getStatMessage(MACES_MACES_LIMIT_BREAK,
|
||||||
|
// String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, MACES_MACES_LIMIT_BREAK, 1000))));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// messages.add(ChatColor.GRAY + "The Maces skill is a work in progress and is still being developed," +
|
||||||
|
// " feedback would be appreciated in the mcMMO discord server.");
|
||||||
|
// return messages;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected List<Component> getTextComponents(Player player) {
|
||||||
|
// List<Component> textComponents = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MACES);
|
||||||
|
//
|
||||||
|
// return textComponents;
|
||||||
|
// }
|
||||||
|
//}
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
@ -45,7 +44,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// BLAST MINING
|
// BLAST MINING
|
||||||
if (canBlast || canDemoExpert || canBiggerBombs) {
|
if (canBlast || canDemoExpert || canBiggerBombs) {
|
||||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
MiningManager miningManager = mmoPlayer.getMiningManager();
|
||||||
|
|
||||||
blastMiningRank = miningManager.getBlastMiningTier();
|
blastMiningRank = miningManager.getBlastMiningTier();
|
||||||
bonusTNTDrops = miningManager.getDropMultiplier();
|
bonusTNTDrops = miningManager.getDropMultiplier();
|
||||||
@ -57,14 +56,14 @@ public class MiningCommand extends SkillCommand {
|
|||||||
|
|
||||||
// Mastery TRIPLE DROPS
|
// Mastery TRIPLE DROPS
|
||||||
if (canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
String[] masteryTripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.MINING_MOTHER_LODE);
|
String[] masteryTripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.MINING_MOTHER_LODE);
|
||||||
tripleDropChance = masteryTripleDropStrings[0];
|
tripleDropChance = masteryTripleDropStrings[0];
|
||||||
tripleDropChanceLucky = masteryTripleDropStrings[1];
|
tripleDropChanceLucky = masteryTripleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.MINING_DOUBLE_DROPS);
|
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.MINING_DOUBLE_DROPS);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -112,7 +111,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
|
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
@ -26,15 +26,12 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
/*
|
/*
|
||||||
* Only allow players to use this command
|
* Only allow players to use this command
|
||||||
*/
|
*/
|
||||||
if(commandSender instanceof Player player)
|
if (commandSender instanceof Player player) {
|
||||||
{
|
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
||||||
if(args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(Permissions.mmoinfo(player))
|
if (Permissions.mmoinfo(player)) {
|
||||||
{
|
if (args[0].equalsIgnoreCase( "???")) {
|
||||||
if(args[0].equalsIgnoreCase( "???"))
|
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||||
@ -57,9 +54,8 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubSkillType matchSubSkill(String name) {
|
public SubSkillType matchSubSkill(String name) {
|
||||||
for(SubSkillType subSkillType : SubSkillType.values())
|
for(SubSkillType subSkillType : SubSkillType.values()) {
|
||||||
{
|
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
||||||
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
|
||||||
|| subSkillType.name().equalsIgnoreCase(name))
|
|| subSkillType.name().equalsIgnoreCase(name))
|
||||||
return subSkillType;
|
return subSkillType;
|
||||||
}
|
}
|
||||||
@ -74,8 +70,7 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayInfo(Player player, SubSkillType subSkillType)
|
private void displayInfo(Player player, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.skills.repair.Repair;
|
|||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
@ -68,7 +67,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SUPER REPAIR
|
// SUPER REPAIR
|
||||||
if (canSuperRepair) {
|
if (canSuperRepair) {
|
||||||
String[] superRepairStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
String[] superRepairStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||||
superRepairChance = superRepairStrings[0];
|
superRepairChance = superRepairStrings[0];
|
||||||
superRepairChanceLucky = superRepairStrings[1];
|
superRepairChanceLucky = superRepairStrings[1];
|
||||||
}
|
}
|
||||||
@ -94,7 +93,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
if (canArcaneForge) {
|
if (canArcaneForge) {
|
||||||
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
|
RepairManager repairManager = mmoPlayer.getRepairManager();
|
||||||
|
|
||||||
messages.add(getStatMessage(false, true,
|
messages.add(getStatMessage(false, true,
|
||||||
SubSkillType.REPAIR_ARCANE_FORGING,
|
SubSkillType.REPAIR_ARCANE_FORGING,
|
||||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -38,7 +37,7 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
SalvageManager salvageManager = mmoPlayer.getSalvageManager();
|
||||||
|
|
||||||
if (canScrapCollector) {
|
if (canScrapCollector) {
|
||||||
messages.add(getStatMessage(false, true,
|
messages.add(getStatMessage(false, true,
|
||||||
|
@ -34,6 +34,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||||
|
protected McMMOPlayer mmoPlayer;
|
||||||
|
|
||||||
private final CommandExecutor skillGuideCommand;
|
private final CommandExecutor skillGuideCommand;
|
||||||
|
|
||||||
@ -53,9 +54,9 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
boolean isLucky = Permissions.lucky(player, skill);
|
boolean isLucky = Permissions.lucky(player, skill);
|
||||||
boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0;
|
boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0;
|
||||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
float skillValue = mmoPlayer.getSkillLevel(skill);
|
||||||
|
|
||||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||||
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines())
|
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines())
|
||||||
@ -75,7 +76,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
dataCalculations(player, skillValue);
|
dataCalculations(player, skillValue);
|
||||||
|
|
||||||
sendSkillCommandHeader(mcMMO.p.getSkillTools().getLocalizedSkillName(skill),
|
sendSkillCommandHeader(mcMMO.p.getSkillTools().getLocalizedSkillName(skill),
|
||||||
player, mcMMOPlayer, (int) skillValue);
|
player, mmoPlayer, (int) skillValue);
|
||||||
|
|
||||||
//Make JSON text components
|
//Make JSON text components
|
||||||
List<Component> subskillTextComponents = getTextComponents(player);
|
List<Component> subskillTextComponents = getTextComponents(player);
|
||||||
@ -87,8 +88,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
|
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
|
||||||
|
|
||||||
/*for(TextComponent tc : subskillTextComponents)
|
/*for(TextComponent tc : subskillTextComponents) {
|
||||||
{
|
|
||||||
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@ -148,8 +148,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
// send header
|
// send header
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||||
|
|
||||||
if(!SkillTools.isChildSkill(skill))
|
if (!SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* NON-CHILD SKILLS
|
* NON-CHILD SKILLS
|
||||||
*/
|
*/
|
||||||
@ -174,10 +173,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
StringBuilder parentMessage = new StringBuilder();
|
StringBuilder parentMessage = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < parentList.size(); i++)
|
for(int i = 0; i < parentList.size(); i++) {
|
||||||
{
|
if (i+1 < parentList.size()) {
|
||||||
if(i+1 < parentList.size())
|
|
||||||
{
|
|
||||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||||
parentMessage.append(ChatColor.GRAY).append(", ");
|
parentMessage.append(ChatColor.GRAY).append(", ");
|
||||||
} else {
|
} else {
|
||||||
@ -236,11 +233,9 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if(abilityLengthCap <= 0)
|
if (abilityLengthCap <= 0) {
|
||||||
{
|
|
||||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,27 +248,24 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getStatMessage(SubSkillType subSkillType, String... vars)
|
protected String getStatMessage(SubSkillType subSkillType, String... vars) {
|
||||||
{
|
|
||||||
return getStatMessage(false, false, subSkillType, vars);
|
return getStatMessage(false, false, subSkillType, vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
|
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
|
||||||
{
|
|
||||||
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||||
|
|
||||||
if(isCustom)
|
if (isCustom)
|
||||||
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
||||||
return LocaleLoader.getString(templateKey, mergedList);
|
return LocaleLoader.getString(templateKey, mergedList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getLimitBreakDescriptionParameter() {
|
protected String getLimitBreakDescriptionParameter() {
|
||||||
if(mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
if (mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||||
return "(PVP/PVE)";
|
return "(PVP/PVE)";
|
||||||
} else {
|
} else {
|
||||||
return "(PVP)";
|
return "(PVP)";
|
||||||
|
@ -77,8 +77,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
while (allStrings.size() < 9) {
|
while (allStrings.size() < 9) {
|
||||||
if (pageIndexStart + allStrings.size() > guide.size()) {
|
if (pageIndexStart + allStrings.size() > guide.size()) {
|
||||||
allStrings.add("");
|
allStrings.add("");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
@ -34,7 +33,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// FUEL EFFICIENCY
|
// FUEL EFFICIENCY
|
||||||
if (canFuelEfficiency) {
|
if (canFuelEfficiency) {
|
||||||
burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier());
|
burnTimeModifier = String.valueOf(mmoPlayer.getSmeltingManager().getFuelEfficiencyMultiplier());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FLUX MINING
|
// FLUX MINING
|
||||||
@ -46,7 +45,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SECOND SMELT
|
// SECOND SMELT
|
||||||
if (canSecondSmelt) {
|
if (canSecondSmelt) {
|
||||||
String[] secondSmeltStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SMELTING_SECOND_SMELT);
|
String[] secondSmeltStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.SMELTING_SECOND_SMELT);
|
||||||
str_secondSmeltChance = secondSmeltStrings[0];
|
str_secondSmeltChance = secondSmeltStrings[0];
|
||||||
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||||
}
|
}
|
||||||
@ -81,7 +80,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
if (canUnderstandTheArt) {
|
if (canUnderstandTheArt) {
|
||||||
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART,
|
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART,
|
||||||
String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier())));
|
String.valueOf(mmoPlayer.getSmeltingManager().getVanillaXpMultiplier())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
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.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -39,7 +38,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// SWORDS_COUNTER_ATTACK
|
// SWORDS_COUNTER_ATTACK
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
String[] counterStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
String[] counterStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||||
counterChance = counterStrings[0];
|
counterChance = counterStrings[0];
|
||||||
counterChanceLucky = counterStrings[1];
|
counterChanceLucky = counterStrings[1];
|
||||||
}
|
}
|
||||||
@ -102,13 +101,12 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB)) {
|
||||||
{
|
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||||
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
|
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class TamingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
if (canGore) {
|
if (canGore) {
|
||||||
String[] goreStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.TAMING_GORE);
|
String[] goreStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.TAMING_GORE);
|
||||||
goreChance = goreStrings[0];
|
goreChance = goreStrings[0];
|
||||||
goreChanceLucky = goreStrings[1];
|
goreChanceLucky = goreStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
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.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
@ -32,17 +30,13 @@ public class TridentsCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
|
||||||
if (mmoPlayer == null) {
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
if (SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
|
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
|
if (SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
|
||||||
messages.add(getStatMessage(TRIDENTS_IMPALE,
|
messages.add(getStatMessage(TRIDENTS_IMPALE,
|
||||||
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
|
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -40,7 +39,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// UNARMED_ARROW_DEFLECT
|
// UNARMED_ARROW_DEFLECT
|
||||||
if (canDeflect) {
|
if (canDeflect) {
|
||||||
String[] deflectStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
String[] deflectStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||||
deflectChance = deflectStrings[0];
|
deflectChance = deflectStrings[0];
|
||||||
deflectChanceLucky = deflectStrings[1];
|
deflectChanceLucky = deflectStrings[1];
|
||||||
}
|
}
|
||||||
@ -54,19 +53,19 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// UNARMED_DISARM
|
// UNARMED_DISARM
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
String[] disarmStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_DISARM);
|
String[] disarmStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_DISARM);
|
||||||
disarmChance = disarmStrings[0];
|
disarmChance = disarmStrings[0];
|
||||||
disarmChanceLucky = disarmStrings[1];
|
disarmChanceLucky = disarmStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRON ARM
|
// IRON ARM
|
||||||
if (canIronArm) {
|
if (canIronArm) {
|
||||||
ironArmBonus = UserManager.getPlayer(player).getUnarmedManager().getSteelArmStyleDamage();
|
ironArmBonus = mmoPlayer.getUnarmedManager().getSteelArmStyleDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRON GRIP
|
// IRON GRIP
|
||||||
if (canIronGrip) {
|
if (canIronGrip) {
|
||||||
String[] ironGripStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_IRON_GRIP);
|
String[] ironGripStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_IRON_GRIP);
|
||||||
ironGripChance = ironGripStrings[0];
|
ironGripChance = ironGripStrings[0];
|
||||||
ironGripChanceLucky = ironGripStrings[1];
|
ironGripChanceLucky = ironGripStrings[1];
|
||||||
}
|
}
|
||||||
@ -114,7 +113,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Clean Cuts
|
//Clean Cuts
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
||||||
tripleDropChance = tripleDropStrings[0];
|
tripleDropChance = tripleDropStrings[0];
|
||||||
tripleDropChanceLucky = tripleDropStrings[1];
|
tripleDropChanceLucky = tripleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
|
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
if (canKnockOnWood) {
|
if (canKnockOnWood) {
|
||||||
String lootNote;
|
String lootNote;
|
||||||
|
|
||||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
if (RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
|
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
|
||||||
} else {
|
} else {
|
||||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");
|
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");
|
||||||
|
@ -504,8 +504,7 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix)
|
/*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
|
||||||
|
|
||||||
@ -517,50 +516,41 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
*
|
*
|
||||||
* @return the ChatColor for this element
|
* @return the ChatColor for this element
|
||||||
*/
|
*/
|
||||||
/*public ChatColor getJSONStatHoverDetailsColor()
|
/*public ChatColor getJSONStatHoverDetailsColor() {
|
||||||
{
|
|
||||||
String keyLocation = "Style.JSON.Hover.Details.Header.Color";
|
String keyLocation = "Style.JSON.Hover.Details.Header.Color";
|
||||||
return getChatColorFromKey(keyLocation);
|
return getChatColorFromKey(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderBold()
|
public boolean isJSONDetailsHeaderBold() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderItalic()
|
public boolean isJSONDetailsHeaderItalic() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderUnderlined()
|
public boolean isJSONDetailsHeaderUnderlined() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getJSONStatHoverDescriptionColor()
|
public ChatColor getJSONStatHoverDescriptionColor() {
|
||||||
{
|
|
||||||
String keyLocation = "Style.JSON.Hover.Details.Description.Color";
|
String keyLocation = "Style.JSON.Hover.Details.Description.Color";
|
||||||
return getChatColorFromKey(keyLocation);
|
return getChatColorFromKey(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionBold()
|
public boolean isJSONDetailsDescriptionBold() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionItalic()
|
public boolean isJSONDetailsDescriptionItalic() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionUnderlined()
|
public boolean isJSONDetailsDescriptionUnderlined() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getJSONActionBarColor(NotificationType notificationType)
|
public ChatColor getJSONActionBarColor(NotificationType notificationType) {
|
||||||
{
|
|
||||||
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
||||||
}*/
|
}*/
|
||||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||||
@ -580,22 +570,19 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
return ChatColor.WHITE;
|
return ChatColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix)
|
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix)
|
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix)
|
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
|
@ -52,7 +52,7 @@ public abstract class BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
|
|
||||||
if(copyDefaults && !savedDefaults) {
|
if (copyDefaults && !savedDefaults) {
|
||||||
copyMissingDefaultsFromResource();
|
copyMissingDefaultsFromResource();
|
||||||
savedDefaults = true;
|
savedDefaults = true;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public abstract class BukkitConfig {
|
|||||||
YamlConfiguration saveDefaultConfigToDisk() {
|
YamlConfiguration saveDefaultConfigToDisk() {
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "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("Unable to copy default config: " + fileName);
|
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -4,31 +4,40 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.util.LogUtils;
|
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;
|
||||||
|
import org.jetbrains.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract class LegacyConfigLoader {
|
public abstract class LegacyConfigLoader {
|
||||||
protected final File configFile;
|
protected final @NotNull File configFile;
|
||||||
protected final @NotNull File dataFolder;
|
protected final @NotNull File dataFolder;
|
||||||
protected String fileName;
|
protected @NotNull String fileName;
|
||||||
protected YamlConfiguration config;
|
protected YamlConfiguration config;
|
||||||
|
|
||||||
public LegacyConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
public LegacyConfigLoader(@NotNull String relativePath, @NotNull String fileName, @NotNull File dataFolder) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
||||||
loadFile();
|
loadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegacyConfigLoader(String fileName, @NotNull File dataFolder) {
|
public LegacyConfigLoader(@NotNull String fileName, @NotNull File dataFolder) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
configFile = new File(dataFolder, fileName);
|
configFile = new File(dataFolder, fileName);
|
||||||
loadFile();
|
loadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public LegacyConfigLoader(@NotNull File file) {
|
||||||
|
this.fileName = file.getName();
|
||||||
|
this.dataFolder = file.getParentFile();
|
||||||
|
configFile = new File(dataFolder, fileName);
|
||||||
|
loadFile();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public LegacyConfigLoader(String relativePath, String fileName) {
|
public LegacyConfigLoader(String relativePath, String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
|
@ -73,7 +73,7 @@ public class WorldBlacklist {
|
|||||||
closeRead(fileReader);
|
closeRead(fileReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blacklist.size() > 0)
|
if (blacklist.size() > 0)
|
||||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ public class ExperienceConfig extends BukkitConfig {
|
|||||||
|
|
||||||
/* Alchemy */
|
/* Alchemy */
|
||||||
public double getPotionXP(PotionStage stage) {
|
public double getPotionXP(PotionStage stage) {
|
||||||
return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
return config.getDouble("Experience_Values.Alchemy.Potion_Brewing.Stage_" + stage.toNumerical(), 10D);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Archery */
|
/* Archery */
|
||||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.config.mods;
|
|||||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.apache.commons.lang.ClassUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ public class CustomEntityLegacyConfig extends LegacyConfigLoader {
|
|||||||
String className = config.getString(entityName + ".Class", "");
|
String className = config.getString(entityName + ".Class", "");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
clazz = ClassUtils.getClass(className);
|
clazz = Class.forName(className);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||||
mcMMO.p.getLogger().warning("This custom entity may not function properly.");
|
mcMMO.p.getLogger().warning("This custom entity may not function properly.");
|
||||||
|
@ -3,21 +3,29 @@ 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 com.gmail.nossr50.util.ItemUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
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;
|
||||||
import org.bukkit.potion.*;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.potion.PotionType;
|
||||||
|
import org.jetbrains.annotations.VisibleForTesting;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.setItemName;
|
||||||
|
import static com.gmail.nossr50.util.PotionUtil.*;
|
||||||
|
|
||||||
public class PotionConfig extends LegacyConfigLoader {
|
public class PotionConfig extends LegacyConfigLoader {
|
||||||
private static PotionConfig instance;
|
|
||||||
|
|
||||||
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<>();
|
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<>();
|
||||||
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<>();
|
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<>();
|
||||||
@ -28,30 +36,34 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<>();
|
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<>();
|
||||||
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<>();
|
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<>();
|
||||||
|
|
||||||
private final Map<String, AlchemyPotion> potionMap = new HashMap<>();
|
/**
|
||||||
|
* Map of potion names to AlchemyPotion objects.
|
||||||
|
*/
|
||||||
|
private final Map<String, AlchemyPotion> alchemyPotions = new HashMap<>();
|
||||||
|
|
||||||
private PotionConfig() {
|
public PotionConfig() {
|
||||||
super("potions.yml");
|
super("potions.yml");
|
||||||
loadKeys();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionConfig getInstance() {
|
@VisibleForTesting
|
||||||
if (instance == null) {
|
PotionConfig(File file) {
|
||||||
instance = new PotionConfig();
|
super(file);
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadPotions() {
|
||||||
loadConcoctions();
|
loadConcoctions();
|
||||||
loadPotionMap();
|
loadPotionMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConcoctions() {
|
@VisibleForTesting
|
||||||
ConfigurationSection concoctionSection = config.getConfigurationSection("Concoctions");
|
void loadConcoctions() {
|
||||||
|
final ConfigurationSection concoctionSection = config.getConfigurationSection("Concoctions");
|
||||||
|
|
||||||
|
// Load the ingredients for each tier
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierOne, concoctionSection.getStringList("Tier_One_Ingredients"));
|
loadConcoctionsTier(concoctionsIngredientsTierOne, concoctionSection.getStringList("Tier_One_Ingredients"));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierTwo, concoctionSection.getStringList("Tier_Two_Ingredients"));
|
loadConcoctionsTier(concoctionsIngredientsTierTwo, concoctionSection.getStringList("Tier_Two_Ingredients"));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierThree, concoctionSection.getStringList("Tier_Three_Ingredients"));
|
loadConcoctionsTier(concoctionsIngredientsTierThree, concoctionSection.getStringList("Tier_Three_Ingredients"));
|
||||||
@ -71,7 +83,7 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadConcoctionsTier(List<ItemStack> ingredientList, List<String> ingredientStrings) {
|
private void loadConcoctionsTier(List<ItemStack> ingredientList, List<String> ingredientStrings) {
|
||||||
if (ingredientStrings != null && ingredientStrings.size() > 0) {
|
if (ingredientStrings != null && !ingredientStrings.isEmpty()) {
|
||||||
for (String ingredientString : ingredientStrings) {
|
for (String ingredientString : ingredientStrings) {
|
||||||
ItemStack ingredient = loadIngredient(ingredientString);
|
ItemStack ingredient = loadIngredient(ingredientString);
|
||||||
|
|
||||||
@ -85,23 +97,24 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
/**
|
/**
|
||||||
* Find the Potions configuration section and load all defined potions.
|
* Find the Potions configuration section and load all defined potions.
|
||||||
*/
|
*/
|
||||||
private void loadPotionMap() {
|
int loadPotionMap() {
|
||||||
ConfigurationSection potionSection = config.getConfigurationSection("Potions");
|
ConfigurationSection potionSection = config.getConfigurationSection("Potions");
|
||||||
int pass = 0;
|
int potionsLoaded = 0;
|
||||||
int fail = 0;
|
int failures = 0;
|
||||||
|
|
||||||
for (String potionName : potionSection.getKeys(false)) {
|
for (String potionName : potionSection.getKeys(false)) {
|
||||||
AlchemyPotion potion = loadPotion(potionSection.getConfigurationSection(potionName));
|
AlchemyPotion potion = loadPotion(potionSection.getConfigurationSection(potionName));
|
||||||
|
|
||||||
if (potion != null) {
|
if (potion != null) {
|
||||||
potionMap.put(potionName, potion);
|
alchemyPotions.put(potionName, potion);
|
||||||
pass++;
|
potionsLoaded++;
|
||||||
} else {
|
} else {
|
||||||
fail++;
|
failures++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
|
mcMMO.p.getLogger().info("Loaded " + potionsLoaded + " Alchemy potions, skipped " + failures + ".");
|
||||||
|
return potionsLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,37 +127,70 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
*/
|
*/
|
||||||
private AlchemyPotion loadPotion(ConfigurationSection potion_section) {
|
private AlchemyPotion loadPotion(ConfigurationSection potion_section) {
|
||||||
try {
|
try {
|
||||||
|
final String key = potion_section.getName();
|
||||||
|
|
||||||
|
final ConfigurationSection potionData = potion_section.getConfigurationSection("PotionData");
|
||||||
|
boolean extended = false;
|
||||||
|
boolean upgraded = false;
|
||||||
|
|
||||||
String name = potion_section.getString("Name");
|
if (potionData != null) {
|
||||||
if (name != null) {
|
extended = potionData.getBoolean("Extended", false);
|
||||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
upgraded = potionData.getBoolean("Upgraded", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PotionData data;
|
Material material;
|
||||||
if (!potion_section.contains("PotionData")) { // Backwards config compatability
|
final String materialString = potion_section.getString("Material", null);
|
||||||
short dataValue = Short.parseShort(potion_section.getName());
|
if (materialString != null) {
|
||||||
Potion potion = Potion.fromDamage(dataValue);
|
material = ItemUtils.exhaustiveMaterialLookup(materialString);
|
||||||
data = new PotionData(potion.getType(), potion.hasExtendedDuration(), potion.getLevel() == 2);
|
if (material == null) {
|
||||||
|
mcMMO.p.getLogger().warning("PotionConfig: Failed to parse material for potion " + key + ": " + materialString);
|
||||||
|
mcMMO.p.getLogger().warning("PotionConfig: Defaulting to POTION");
|
||||||
|
material = Material.POTION;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ConfigurationSection potionData = potion_section.getConfigurationSection("PotionData");
|
mcMMO.p.getLogger().warning("PotionConfig: Missing Material config entry for potion " + key + "," +
|
||||||
data = new PotionData(PotionType.valueOf(potionData.getString("PotionType", "WATER")), potionData.getBoolean("Extended", false), potionData.getBoolean("Upgraded", false));
|
" from configuration section: " + potion_section + ", defaulting to POTION");
|
||||||
|
material = Material.POTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
Material material = Material.POTION;
|
final ItemStack itemStack = new ItemStack(material, 1);
|
||||||
String mat = potion_section.getString("Material", null);
|
final PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
||||||
if (mat != null) {
|
|
||||||
material = Material.valueOf(mat);
|
if (potionMeta == null) {
|
||||||
|
mcMMO.p.getLogger().severe("PotionConfig: Failed to get PotionMeta for " + key + ", from configuration section:" +
|
||||||
|
" " + potion_section);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
// extended and upgraded seem to be mutually exclusive
|
||||||
|
if (extended && upgraded) {
|
||||||
|
mcMMO.p.getLogger().warning("Potion " + key + " has both Extended and Upgraded set to true," +
|
||||||
|
" defaulting to Extended.");
|
||||||
|
upgraded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String potionTypeStr = potionData.getString("PotionType", null);
|
||||||
|
if (potionTypeStr == null) {
|
||||||
|
mcMMO.p.getLogger().severe("PotionConfig: Missing PotionType for " + key + ", from configuration section:" +
|
||||||
|
" " + potion_section);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This works via side effects
|
||||||
|
// TODO: Redesign later, side effects are stupid
|
||||||
|
if(!setPotionType(potionMeta, potionTypeStr, upgraded, extended)) {
|
||||||
|
mcMMO.p.getLogger().severe("PotionConfig: Failed to set parameters of potion for " + key + ": " + potionTypeStr);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String> lore = new ArrayList<>();
|
||||||
if (potion_section.contains("Lore")) {
|
if (potion_section.contains("Lore")) {
|
||||||
for (String line : potion_section.getStringList("Lore")) {
|
for (String line : potion_section.getStringList("Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
potionMeta.setLore(lore);
|
||||||
|
|
||||||
List<PotionEffect> effects = new ArrayList<>();
|
|
||||||
if (potion_section.contains("Effects")) {
|
if (potion_section.contains("Effects")) {
|
||||||
for (String effect : potion_section.getStringList("Effects")) {
|
for (String effect : potion_section.getStringList("Effects")) {
|
||||||
String[] parts = effect.split(" ");
|
String[] parts = effect.split(" ");
|
||||||
@ -154,9 +200,9 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
int duration = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
|
int duration = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
effects.add(new PotionEffect(type, duration, amplifier));
|
potionMeta.addCustomEffect(new PotionEffect(type, duration, amplifier), true);
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Failed to parse effect for potion " + name + ": " + effect);
|
mcMMO.p.getLogger().severe("PotionConfig: Failed to parse effect for potion " + key + ": " + effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,28 +211,62 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
if (potion_section.contains("Color")) {
|
if (potion_section.contains("Color")) {
|
||||||
color = Color.fromRGB(potion_section.getInt("Color"));
|
color = Color.fromRGB(potion_section.getInt("Color"));
|
||||||
} else {
|
} else {
|
||||||
color = this.generateColor(effects);
|
color = this.generateColor(potionMeta.getCustomEffects());
|
||||||
}
|
}
|
||||||
|
potionMeta.setColor(color);
|
||||||
|
|
||||||
Map<ItemStack, String> children = new HashMap<>();
|
final Map<ItemStack, String> children = new HashMap<>();
|
||||||
if (potion_section.contains("Children")) {
|
if (potion_section.contains("Children")) {
|
||||||
for (String child : potion_section.getConfigurationSection("Children").getKeys(false)) {
|
for (String child : potion_section.getConfigurationSection("Children").getKeys(false)) {
|
||||||
ItemStack ingredient = loadIngredient(child);
|
ItemStack ingredient = loadIngredient(child);
|
||||||
if (ingredient != null) {
|
if (ingredient != null) {
|
||||||
children.put(ingredient, potion_section.getConfigurationSection("Children").getString(child));
|
children.put(ingredient, potion_section.getConfigurationSection("Children").getString(child));
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Failed to parse child for potion " + name + ": " + child);
|
mcMMO.p.getLogger().severe("PotionConfig: Failed to parse child for potion " + key + ": " + child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Set the name of the potion
|
||||||
|
setPotionDisplayName(potion_section, potionMeta);
|
||||||
|
|
||||||
return new AlchemyPotion(material, data, name, lore, effects, color, children);
|
// TODO: Might not need to .setItemMeta
|
||||||
|
itemStack.setItemMeta(potionMeta);
|
||||||
|
return new AlchemyPotion(potion_section.getName(), itemStack, children);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mcMMO.p.getLogger().warning("Failed to load Alchemy potion: " + potion_section.getName());
|
mcMMO.p.getLogger().warning("PotionConfig: Failed to load Alchemy potion: " + potion_section.getName());
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean setPotionType(PotionMeta potionMeta, String potionTypeStr, boolean upgraded, boolean extended) {
|
||||||
|
final PotionType potionType = matchPotionType(potionTypeStr, upgraded, extended);
|
||||||
|
|
||||||
|
if (potionType == null) {
|
||||||
|
mcMMO.p.getLogger().severe("PotionConfig: Failed to parse potion type for: " + potionTypeStr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set base
|
||||||
|
setBasePotionType(potionMeta, potionType, extended, upgraded);
|
||||||
|
|
||||||
|
// Legacy only
|
||||||
|
setUpgradedAndExtendedProperties(potionType, potionMeta, upgraded, extended);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPotionDisplayName(ConfigurationSection section, PotionMeta potionMeta) {
|
||||||
|
// If a potion doesn't have any custom effects, there is no reason to override the vanilla name
|
||||||
|
if (potionMeta.getCustomEffects().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String configuredName = section.getString("Name", null);
|
||||||
|
if (configuredName != null) {
|
||||||
|
setItemName(potionMeta, configuredName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a string representation of an ingredient.
|
* Parse a string representation of an ingredient.
|
||||||
* Format: '<MATERIAL>[:data]'
|
* Format: '<MATERIAL>[:data]'
|
||||||
@ -210,43 +290,63 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ingredients for the given tier.
|
||||||
|
* @param tier Tier to get ingredients for.
|
||||||
|
* @return List of ingredients for the given tier.
|
||||||
|
*/
|
||||||
public List<ItemStack> getIngredients(int tier) {
|
public List<ItemStack> getIngredients(int tier) {
|
||||||
switch (tier) {
|
return switch (tier) {
|
||||||
case 8:
|
case 8 -> concoctionsIngredientsTierEight;
|
||||||
return concoctionsIngredientsTierEight;
|
case 7 -> concoctionsIngredientsTierSeven;
|
||||||
case 7:
|
case 6 -> concoctionsIngredientsTierSix;
|
||||||
return concoctionsIngredientsTierSeven;
|
case 5 -> concoctionsIngredientsTierFive;
|
||||||
case 6:
|
case 4 -> concoctionsIngredientsTierFour;
|
||||||
return concoctionsIngredientsTierSix;
|
case 3 -> concoctionsIngredientsTierThree;
|
||||||
case 5:
|
case 2 -> concoctionsIngredientsTierTwo;
|
||||||
return concoctionsIngredientsTierFive;
|
default -> concoctionsIngredientsTierOne;
|
||||||
case 4:
|
};
|
||||||
return concoctionsIngredientsTierFour;
|
|
||||||
case 3:
|
|
||||||
return concoctionsIngredientsTierThree;
|
|
||||||
case 2:
|
|
||||||
return concoctionsIngredientsTierTwo;
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
return concoctionsIngredientsTierOne;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given ItemStack is a valid potion.
|
||||||
|
* @param item ItemStack to be checked.
|
||||||
|
* @return True if the given ItemStack is a valid potion, false otherwise.
|
||||||
|
*/
|
||||||
public boolean isValidPotion(ItemStack item) {
|
public boolean isValidPotion(ItemStack item) {
|
||||||
return getPotion(item) != null;
|
return getPotion(item) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AlchemyPotion that corresponds to the given name.
|
||||||
|
* @param name Name of the potion to be checked.
|
||||||
|
* @return AlchemyPotion that corresponds to the given name.
|
||||||
|
*/
|
||||||
public AlchemyPotion getPotion(String name) {
|
public AlchemyPotion getPotion(String name) {
|
||||||
return potionMap.get(name);
|
return alchemyPotions.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AlchemyPotion that corresponds to the given ItemStack.
|
||||||
|
*
|
||||||
|
* @param item ItemStack to be checked.
|
||||||
|
*
|
||||||
|
* @return AlchemyPotion that corresponds to the given ItemStack.
|
||||||
|
*/
|
||||||
public AlchemyPotion getPotion(ItemStack item) {
|
public AlchemyPotion getPotion(ItemStack item) {
|
||||||
for (AlchemyPotion potion : potionMap.values()) {
|
final List<AlchemyPotion> potionList = alchemyPotions.values()
|
||||||
if (potion.isSimilar(item)) {
|
.stream()
|
||||||
return potion;
|
.filter(potion -> potion.isSimilarPotion(item))
|
||||||
}
|
.toList();
|
||||||
|
if(potionList.size() > 1) {
|
||||||
|
mcMMO.p.getLogger().severe("Multiple potions defined in config have matched this potion, for mcMMO to behave" +
|
||||||
|
" properly there should only be one match found.");
|
||||||
|
mcMMO.p.getLogger().severe("Potion ItemStack:" + item.toString());
|
||||||
|
mcMMO.p.getLogger().severe("Alchemy Potions from config matching this item: "
|
||||||
|
+ potionList.stream().map(AlchemyPotion::toString).collect(Collectors.joining(", ")));
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
return potionList.isEmpty() ? null : potionList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color generateColor(List<PotionEffect> effects) {
|
public Color generateColor(List<PotionEffect> effects) {
|
||||||
@ -278,5 +378,4 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
}
|
}
|
||||||
return Color.fromRGB(red / colors.size(), green / colors.size(), blue / colors.size());
|
return Color.fromRGB(red / colors.size(), green / colors.size(), blue / colors.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class RepairConfigManager {
|
|||||||
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
if(fileName.equals(REPAIR_VANILLA_YML))
|
if (fileName.equals(REPAIR_VANILLA_YML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pattern.matcher(fileName).matches()) {
|
if (!pattern.matcher(fileName).matches()) {
|
||||||
|
@ -21,7 +21,7 @@ public class SalvageConfigManager {
|
|||||||
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
if(fileName.equals(SALVAGE_VANILLA_YML))
|
if (fileName.equals(SALVAGE_VANILLA_YML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pattern.matcher(fileName).matches()) {
|
if (!pattern.matcher(fileName).matches()) {
|
||||||
|
@ -5,6 +5,7 @@ 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 com.gmail.nossr50.util.LogUtils;
|
||||||
|
import com.gmail.nossr50.util.PotionUtil;
|
||||||
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;
|
||||||
@ -13,12 +14,13 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.PotionUtil.matchPotionType;
|
||||||
|
|
||||||
public class FishingTreasureConfig extends BukkitConfig {
|
public class FishingTreasureConfig extends BukkitConfig {
|
||||||
|
|
||||||
public static final String FILENAME = "fishing_treasures.yml";
|
public static final String FILENAME = "fishing_treasures.yml";
|
||||||
@ -48,7 +50,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
||||||
|
|
||||||
if(enchantment_drop_rates != null) {
|
if (enchantment_drop_rates != null) {
|
||||||
for (String tier : enchantment_drop_rates.getKeys(false)) {
|
for (String tier : enchantment_drop_rates.getKeys(false)) {
|
||||||
double totalEnchantDropRate = 0;
|
double totalEnchantDropRate = 0;
|
||||||
double totalItemDropRate = 0;
|
double totalItemDropRate = 0;
|
||||||
@ -204,30 +206,40 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (materialName.contains("POTION")) {
|
if (materialName.contains("POTION")) {
|
||||||
|
// Update for 1.20.5
|
||||||
|
|
||||||
Material mat = Material.matchMaterial(materialName);
|
Material mat = Material.matchMaterial(materialName);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
reason.add("Potion format for " + FILENAME + " has changed");
|
reason.add("Potion format for " + FILENAME + " has changed");
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(mat, amount, data);
|
item = new ItemStack(mat, amount, data);
|
||||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
PotionMeta potionMeta = (PotionMeta) item.getItemMeta();
|
||||||
|
|
||||||
if (itemMeta == null) {
|
if (potionMeta == null) {
|
||||||
mcMMO.p.getLogger().severe("Item meta when adding potion to fishing treasure was null, contact the mcMMO devs!");
|
mcMMO.p.getLogger().severe("FishingConfig: Item meta when adding potion to fishing treasure was null," +
|
||||||
|
" contact the mcMMO devs!");
|
||||||
|
reason.add("FishingConfig: Item meta when adding potion to fishing treasure was null");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PotionType potionType = null;
|
String potionTypeStr;
|
||||||
try {
|
potionTypeStr = config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER");
|
||||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
||||||
}
|
|
||||||
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
final PotionType potionType = matchPotionType(potionTypeStr, extended, upgraded);
|
||||||
|
|
||||||
|
if (potionType == null) {
|
||||||
|
reason.add("FishingConfig: Could not derive potion type from: " + potionTypeStr +", " + extended + ", " + upgraded);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the base potion type
|
||||||
|
// NOTE: Upgraded/Extended are ignored in 1.20.5 and later
|
||||||
|
PotionUtil.setBasePotionType(potionMeta, potionType, upgraded, extended);
|
||||||
|
|
||||||
if (customName != null) {
|
if (customName != null) {
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', customName));
|
potionMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', customName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||||
@ -235,9 +247,9 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
itemMeta.setLore(lore);
|
potionMeta.setLore(lore);
|
||||||
}
|
}
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(potionMeta);
|
||||||
}
|
}
|
||||||
} else if (material == Material.ENCHANTED_BOOK) {
|
} else if (material == Material.ENCHANTED_BOOK) {
|
||||||
//If any whitelisted enchants exist we use whitelist-based matching
|
//If any whitelisted enchants exist we use whitelist-based matching
|
||||||
@ -355,7 +367,8 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
||||||
|
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
mcMMO.p.getLogger().warning("Skipping invalid enchantment in " + FILENAME + ": " + enchantmentName);
|
mcMMO.p.getLogger().info("Skipping invalid enchantment in '" + FILENAME + "', named:"
|
||||||
|
+ enchantmentName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ 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.BlockUtils;
|
||||||
import com.gmail.nossr50.util.LogUtils;
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
|
import com.gmail.nossr50.util.PotionUtil;
|
||||||
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;
|
||||||
@ -14,7 +15,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -165,22 +165,33 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
Material mat = Material.matchMaterial(materialName);
|
Material mat = Material.matchMaterial(materialName);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
reason.add("Potion format for " + FILENAME + " has changed");
|
reason.add("Potion format for " + FILENAME + " has changed");
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(mat, amount, data);
|
item = new ItemStack(mat, amount, data);
|
||||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
PotionMeta potionMeta = (PotionMeta) item.getItemMeta();
|
||||||
|
if (potionMeta == null) {
|
||||||
PotionType potionType = null;
|
mcMMO.p.getLogger().severe("Item meta when adding potion to treasure was null, contact the mcMMO devs!");
|
||||||
try {
|
reason.add("Item meta when adding potion to treasure was null, contact the mcMMO devs!");
|
||||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
continue;
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String potionTypeStr;
|
||||||
|
potionTypeStr = config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER");
|
||||||
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
PotionType potionType = PotionUtil.matchPotionType(potionTypeStr, extended, upgraded);
|
||||||
|
|
||||||
|
if (potionType == null) {
|
||||||
|
reason.add("Could not derive potion type from: " + potionTypeStr +", " + extended + ", " + upgraded);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the base potion type
|
||||||
|
// NOTE: extended/upgraded are ignored in 1.20.5 and later
|
||||||
|
PotionUtil.setBasePotionType(potionMeta, potionType, extended, upgraded);
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
potionMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||||
@ -188,9 +199,9 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
itemMeta.setLore(lore);
|
potionMeta.setLore(lore);
|
||||||
}
|
}
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(potionMeta);
|
||||||
}
|
}
|
||||||
} else if (material != null) {
|
} else if (material != null) {
|
||||||
item = new ItemStack(material, amount, data);
|
item = new ItemStack(material, amount, data);
|
||||||
|
@ -33,7 +33,7 @@ public class FlatFileDataProcessor {
|
|||||||
assert !lineData.isEmpty();
|
assert !lineData.isEmpty();
|
||||||
|
|
||||||
//Make sure the data line is "correct"
|
//Make sure the data line is "correct"
|
||||||
if(lineData.charAt(lineData.length() - 1) != ':') {
|
if (lineData.charAt(lineData.length() - 1) != ':') {
|
||||||
// Length checks depend on last rawSplitData being ':'
|
// Length checks depend on last rawSplitData being ':'
|
||||||
// We add it here if it is missing
|
// We add it here if it is missing
|
||||||
lineData = lineData.concat(":");
|
lineData = lineData.concat(":");
|
||||||
@ -48,9 +48,9 @@ public class FlatFileDataProcessor {
|
|||||||
boolean anyBadData = false;
|
boolean anyBadData = false;
|
||||||
|
|
||||||
//This is the minimum size of the split array needed to be considered proper data
|
//This is the minimum size of the split array needed to be considered proper data
|
||||||
if(splitDataLine.length < getMinimumSplitDataLength()) {
|
if (splitDataLine.length < getMinimumSplitDataLength()) {
|
||||||
//Data is considered junk
|
//Data is considered junk
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -59,9 +59,9 @@ public class FlatFileDataProcessor {
|
|||||||
builder.appendFlag(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE);
|
builder.appendFlag(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE);
|
||||||
|
|
||||||
//TODO: This block here is probably pointless
|
//TODO: This block here is probably pointless
|
||||||
if(splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
if (splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
||||||
&& splitDataLine[0] != null && !splitDataLine[0].isEmpty()) {
|
&& splitDataLine[0] != null && !splitDataLine[0].isEmpty()) {
|
||||||
if(splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
|
if (splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
|
||||||
logger.severe("Not enough data found to recover corrupted player data for user: "+splitDataLine[0]);
|
logger.severe("Not enough data found to recover corrupted player data for user: "+splitDataLine[0]);
|
||||||
registerData(builder.appendFlag(FlatFileDataFlag.TOO_INCOMPLETE));
|
registerData(builder.appendFlag(FlatFileDataFlag.TOO_INCOMPLETE));
|
||||||
return;
|
return;
|
||||||
@ -81,14 +81,14 @@ public class FlatFileDataProcessor {
|
|||||||
String name = splitDataLine[USERNAME_INDEX];
|
String name = splitDataLine[USERNAME_INDEX];
|
||||||
String strOfUUID = splitDataLine[UUID_INDEX];
|
String strOfUUID = splitDataLine[UUID_INDEX];
|
||||||
|
|
||||||
if(name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
reportBadDataLine("No name found for data", "[MISSING NAME]", lineData);
|
reportBadDataLine("No name found for data", "[MISSING NAME]", lineData);
|
||||||
builder.appendFlag(FlatFileDataFlag.MISSING_NAME);
|
builder.appendFlag(FlatFileDataFlag.MISSING_NAME);
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[USERNAME_INDEX] = true;
|
badDataValues[USERNAME_INDEX] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
|
if (strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
|
||||||
invalidUUID = true;
|
invalidUUID = true;
|
||||||
badDataValues[UUID_INDEX] = true;
|
badDataValues[UUID_INDEX] = true;
|
||||||
reportBadDataLine("Empty/null UUID for user", "Empty/null", lineData);
|
reportBadDataLine("Empty/null UUID for user", "Empty/null", lineData);
|
||||||
@ -110,20 +110,20 @@ public class FlatFileDataProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Duplicate UUID is no good, reject them
|
//Duplicate UUID is no good, reject them
|
||||||
if(!invalidUUID && uuid != null && uuids.contains(uuid)) {
|
if (!invalidUUID && uuid != null && uuids.contains(uuid)) {
|
||||||
registerData(builder.appendFlag(FlatFileDataFlag.DUPLICATE_UUID));
|
registerData(builder.appendFlag(FlatFileDataFlag.DUPLICATE_UUID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
|
|
||||||
if(names.contains(name)) {
|
if (names.contains(name)) {
|
||||||
builder.appendFlag(FlatFileDataFlag.DUPLICATE_NAME);
|
builder.appendFlag(FlatFileDataFlag.DUPLICATE_NAME);
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[USERNAME_INDEX] = true;
|
badDataValues[USERNAME_INDEX] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
names.add(name);
|
names.add(name);
|
||||||
|
|
||||||
//Make sure the data is up to date schema wise, if it isn't we adjust it to the correct size and flag it for repair
|
//Make sure the data is up to date schema wise, if it isn't we adjust it to the correct size and flag it for repair
|
||||||
@ -136,9 +136,9 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
//Check each data for bad values
|
//Check each data for bad values
|
||||||
for(int i = 0; i < DATA_ENTRY_COUNT; i++) {
|
for(int i = 0; i < DATA_ENTRY_COUNT; i++) {
|
||||||
if(shouldNotBeEmpty(splitDataLine[i], i)) {
|
if (shouldNotBeEmpty(splitDataLine[i], i)) {
|
||||||
|
|
||||||
if(i == OVERHAUL_LAST_LOGIN) {
|
if (i == OVERHAUL_LAST_LOGIN) {
|
||||||
builder.appendFlag(FlatFileDataFlag.LAST_LOGIN_SCHEMA_UPGRADE);
|
builder.appendFlag(FlatFileDataFlag.LAST_LOGIN_SCHEMA_UPGRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,13 +149,13 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
boolean isCorrectType = isOfExpectedType(splitDataLine[i], getExpectedValueType(i));
|
boolean isCorrectType = isOfExpectedType(splitDataLine[i], getExpectedValueType(i));
|
||||||
|
|
||||||
if(!isCorrectType) {
|
if (!isCorrectType) {
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[i] = true;
|
badDataValues[i] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(anyBadData) {
|
if (anyBadData) {
|
||||||
builder.appendFlag(FlatFileDataFlag.BAD_VALUES);
|
builder.appendFlag(FlatFileDataFlag.BAD_VALUES);
|
||||||
builder.appendBadDataValues(badDataValues);
|
builder.appendBadDataValues(badDataValues);
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ public class FlatFileDataProcessor {
|
|||||||
public @NotNull String[] isDataSchemaUpToDate(@NotNull String[] splitDataLine, @NotNull FlatFileDataBuilder builder, boolean[] badDataValues) {
|
public @NotNull String[] isDataSchemaUpToDate(@NotNull String[] splitDataLine, @NotNull FlatFileDataBuilder builder, boolean[] badDataValues) {
|
||||||
assert splitDataLine.length <= DATA_ENTRY_COUNT; //should NEVER be higher
|
assert splitDataLine.length <= DATA_ENTRY_COUNT; //should NEVER be higher
|
||||||
|
|
||||||
if(splitDataLine.length < DATA_ENTRY_COUNT) {
|
if (splitDataLine.length < DATA_ENTRY_COUNT) {
|
||||||
int oldLength = splitDataLine.length;
|
int oldLength = splitDataLine.length;
|
||||||
splitDataLine = Arrays.copyOf(splitDataLine, DATA_ENTRY_COUNT);
|
splitDataLine = Arrays.copyOf(splitDataLine, DATA_ENTRY_COUNT);
|
||||||
int newLength = splitDataLine.length;
|
int newLength = splitDataLine.length;
|
||||||
@ -184,7 +184,7 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
|
|
||||||
public boolean shouldNotBeEmpty(@Nullable String data, int index) {
|
public boolean shouldNotBeEmpty(@Nullable String data, int index) {
|
||||||
if(getExpectedValueType(index) == ExpectedType.IGNORED) {
|
if (getExpectedValueType(index) == ExpectedType.IGNORED) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return data == null || data.isEmpty();
|
return data == null || data.isEmpty();
|
||||||
@ -248,73 +248,31 @@ public class FlatFileDataProcessor {
|
|||||||
FlatFileDataContainer flatFileDataContainer = builder.build();
|
FlatFileDataContainer flatFileDataContainer = builder.build();
|
||||||
flatFileDataContainers.add(flatFileDataContainer);
|
flatFileDataContainers.add(flatFileDataContainer);
|
||||||
|
|
||||||
if(flatFileDataContainer.getDataFlags() != null)
|
if (flatFileDataContainer.getDataFlags() != null)
|
||||||
flatFileDataFlags.addAll(flatFileDataContainer.getDataFlags());
|
flatFileDataFlags.addAll(flatFileDataContainer.getDataFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull ExpectedType getExpectedValueType(int dataIndex) throws IndexOutOfBoundsException {
|
public static @NotNull ExpectedType getExpectedValueType(int dataIndex) throws IndexOutOfBoundsException {
|
||||||
switch(dataIndex) {
|
return switch (dataIndex) {
|
||||||
case USERNAME_INDEX:
|
case USERNAME_INDEX -> ExpectedType.STRING; //Assumption: Used to be for something, no longer used
|
||||||
return ExpectedType.STRING;
|
//Assumption: Used to be for something, no longer used
|
||||||
case 2: //Assumption: Used to be for something, no longer used
|
//Assumption: Used to be used for something, no longer used
|
||||||
case 3: //Assumption: Used to be for something, no longer used
|
//Assumption: Used to be used for something, no longer used
|
||||||
case 23: //Assumption: Used to be used for something, no longer used
|
case 2, 3, 23, 33, HEALTHBAR, LEGACY_LAST_LOGIN -> ExpectedType.IGNORED;
|
||||||
case 33: //Assumption: Used to be used for something, no longer used
|
case SKILLS_MINING, SKILLS_REPAIR, SKILLS_UNARMED, SKILLS_HERBALISM, SKILLS_EXCAVATION, SKILLS_ARCHERY,
|
||||||
case HEALTHBAR:
|
SKILLS_SWORDS, SKILLS_AXES, SKILLS_WOODCUTTING, SKILLS_ACROBATICS, SKILLS_TAMING, SKILLS_FISHING,
|
||||||
case LEGACY_LAST_LOGIN:
|
SKILLS_ALCHEMY, SKILLS_CROSSBOWS, SKILLS_TRIDENTS, SKILLS_MACES, COOLDOWN_BERSERK,
|
||||||
return ExpectedType.IGNORED;
|
COOLDOWN_GIGA_DRILL_BREAKER, COOLDOWN_TREE_FELLER, COOLDOWN_GREEN_TERRA, COOLDOWN_SERRATED_STRIKES,
|
||||||
case SKILLS_MINING:
|
COOLDOWN_SKULL_SPLITTER, COOLDOWN_SUPER_BREAKER, COOLDOWN_BLAST_MINING, SCOREBOARD_TIPS,
|
||||||
case SKILLS_REPAIR:
|
COOLDOWN_CHIMAERA_WING, COOLDOWN_SUPER_SHOTGUN, COOLDOWN_TRIDENTS, COOLDOWN_ARCHERY, COOLDOWN_MACES ->
|
||||||
case SKILLS_UNARMED:
|
ExpectedType.INTEGER;
|
||||||
case SKILLS_HERBALISM:
|
case EXP_MINING, EXP_WOODCUTTING, EXP_REPAIR, EXP_UNARMED, EXP_HERBALISM, EXP_EXCAVATION, EXP_ARCHERY,
|
||||||
case SKILLS_EXCAVATION:
|
EXP_SWORDS, EXP_AXES, EXP_ACROBATICS, EXP_TAMING, EXP_FISHING, EXP_ALCHEMY, EXP_CROSSBOWS,
|
||||||
case SKILLS_ARCHERY:
|
EXP_TRIDENTS, EXP_MACES -> ExpectedType.FLOAT;
|
||||||
case SKILLS_SWORDS:
|
case UUID_INDEX -> ExpectedType.UUID;
|
||||||
case SKILLS_AXES:
|
case OVERHAUL_LAST_LOGIN -> ExpectedType.LONG;
|
||||||
case SKILLS_WOODCUTTING:
|
default -> throw new IndexOutOfBoundsException();
|
||||||
case SKILLS_ACROBATICS:
|
};
|
||||||
case SKILLS_TAMING:
|
|
||||||
case SKILLS_FISHING:
|
|
||||||
case SKILLS_ALCHEMY:
|
|
||||||
case SKILLS_CROSSBOWS:
|
|
||||||
case SKILLS_TRIDENTS:
|
|
||||||
case COOLDOWN_BERSERK:
|
|
||||||
case COOLDOWN_GIGA_DRILL_BREAKER:
|
|
||||||
case COOLDOWN_TREE_FELLER:
|
|
||||||
case COOLDOWN_GREEN_TERRA:
|
|
||||||
case COOLDOWN_SERRATED_STRIKES:
|
|
||||||
case COOLDOWN_SKULL_SPLITTER:
|
|
||||||
case COOLDOWN_SUPER_BREAKER:
|
|
||||||
case COOLDOWN_BLAST_MINING:
|
|
||||||
case SCOREBOARD_TIPS:
|
|
||||||
case COOLDOWN_CHIMAERA_WING:
|
|
||||||
case COOLDOWN_SUPER_SHOTGUN:
|
|
||||||
case COOLDOWN_TRIDENTS:
|
|
||||||
case COOLDOWN_ARCHERY:
|
|
||||||
return ExpectedType.INTEGER;
|
|
||||||
case EXP_MINING:
|
|
||||||
case EXP_WOODCUTTING:
|
|
||||||
case EXP_REPAIR:
|
|
||||||
case EXP_UNARMED:
|
|
||||||
case EXP_HERBALISM:
|
|
||||||
case EXP_EXCAVATION:
|
|
||||||
case EXP_ARCHERY:
|
|
||||||
case EXP_SWORDS:
|
|
||||||
case EXP_AXES:
|
|
||||||
case EXP_ACROBATICS:
|
|
||||||
case EXP_TAMING:
|
|
||||||
case EXP_FISHING:
|
|
||||||
case EXP_ALCHEMY:
|
|
||||||
case EXP_CROSSBOWS:
|
|
||||||
case EXP_TRIDENTS:
|
|
||||||
return ExpectedType.FLOAT;
|
|
||||||
case UUID_INDEX:
|
|
||||||
return ExpectedType.UUID;
|
|
||||||
case OVERHAUL_LAST_LOGIN:
|
|
||||||
return ExpectedType.LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IndexOutOfBoundsException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull List<FlatFileDataContainer> getFlatFileDataContainers() {
|
public @NotNull List<FlatFileDataContainer> getFlatFileDataContainers() {
|
||||||
@ -337,12 +295,12 @@ public class FlatFileDataProcessor {
|
|||||||
for(FlatFileDataContainer dataContainer : flatFileDataContainers) {
|
for(FlatFileDataContainer dataContainer : flatFileDataContainers) {
|
||||||
String[] splitData = FlatFileDataUtil.getPreparedSaveDataLine(dataContainer);
|
String[] splitData = FlatFileDataUtil.getPreparedSaveDataLine(dataContainer);
|
||||||
|
|
||||||
if(splitData == null)
|
if (splitData == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//We add a trailing : as it is needed for some reason (is it?)
|
//We add a trailing : as it is needed for some reason (is it?)
|
||||||
//TODO: Is the trailing ":" actually necessary?
|
//TODO: Is the trailing ":" actually necessary?
|
||||||
String fromSplit = org.apache.commons.lang.StringUtils.join(splitData, ":") + ":";
|
String fromSplit = org.apache.commons.lang3.StringUtils.join(splitData, ":") + ":";
|
||||||
stringBuilder.append(fromSplit).append("\r\n");
|
stringBuilder.append(fromSplit).append("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +87,11 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
public static final int COOLDOWN_SUPER_SHOTGUN = 49;
|
public static final int COOLDOWN_SUPER_SHOTGUN = 49;
|
||||||
public static final int COOLDOWN_TRIDENTS = 50;
|
public static final int COOLDOWN_TRIDENTS = 50;
|
||||||
public static final int COOLDOWN_ARCHERY = 51;
|
public static final int COOLDOWN_ARCHERY = 51;
|
||||||
|
public static final int EXP_MACES = 52;
|
||||||
|
public static final int SKILLS_MACES = 53;
|
||||||
|
public static final int COOLDOWN_MACES = 54;
|
||||||
//Update this everytime new data is added
|
//Update this everytime new data is added
|
||||||
public static final int DATA_ENTRY_COUNT = COOLDOWN_ARCHERY + 1;
|
public static final int DATA_ENTRY_COUNT = COOLDOWN_MACES + 1;
|
||||||
|
|
||||||
FlatFileDatabaseManager(@NotNull File usersFile, @NotNull Logger logger, long purgeTime, int startingLevel, boolean testing) {
|
FlatFileDatabaseManager(@NotNull File usersFile, @NotNull Logger logger, long purgeTime, int startingLevel, boolean testing) {
|
||||||
this.usersFile = usersFile;
|
this.usersFile = usersFile;
|
||||||
@ -98,15 +101,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
this.startingLevel = startingLevel;
|
this.startingLevel = startingLevel;
|
||||||
this.testing = testing;
|
this.testing = testing;
|
||||||
|
|
||||||
if(!usersFile.exists()) {
|
if (!usersFile.exists()) {
|
||||||
initEmptyDB();
|
initEmptyDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!testing) {
|
if (!testing) {
|
||||||
List<FlatFileDataFlag> flatFileDataFlags = checkFileHealthAndStructure();
|
List<FlatFileDataFlag> flatFileDataFlags = checkFileHealthAndStructure();
|
||||||
|
|
||||||
if(flatFileDataFlags != null) {
|
if (flatFileDataFlags != null) {
|
||||||
if(!flatFileDataFlags.isEmpty()) {
|
if (!flatFileDataFlags.isEmpty()) {
|
||||||
logger.info("Detected "+flatFileDataFlags.size() + " data entries which need correction.");
|
logger.info("Detected "+flatFileDataFlags.size() + " data entries which need correction.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,8 +152,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
// If they're still around, rewrite them to the file.
|
// If they're still around, rewrite them to the file.
|
||||||
if (!powerless) {
|
if (!powerless) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
purgedUsers++;
|
purgedUsers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +221,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
if (lastPlayed == -1) {
|
if (lastPlayed == -1) {
|
||||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
||||||
|
|
||||||
if(player.getLastPlayed() != 0) {
|
if (player.getLastPlayed() != 0) {
|
||||||
lastPlayed = player.getLastPlayed();
|
lastPlayed = player.getLastPlayed();
|
||||||
rewrite = true;
|
rewrite = true;
|
||||||
}
|
}
|
||||||
@ -231,7 +233,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
if (rewrite) {
|
if (rewrite) {
|
||||||
// Rewrite their data with a valid time
|
// Rewrite their data with a valid time
|
||||||
character[OVERHAUL_LAST_LOGIN] = Long.toString(lastPlayed);
|
character[OVERHAUL_LAST_LOGIN] = Long.toString(lastPlayed);
|
||||||
String newLine = org.apache.commons.lang.StringUtils.join(character, ":");
|
String newLine = org.apache.commons.lang3.StringUtils.join(character, ":");
|
||||||
writer.append(newLine).append("\r\n");
|
writer.append(newLine).append("\r\n");
|
||||||
} else {
|
} else {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
@ -243,7 +245,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out = new FileWriter(usersFilePath);
|
out = new FileWriter(usersFilePath);
|
||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
|
|
||||||
if(testing) {
|
if (testing) {
|
||||||
System.out.println(writer);
|
System.out.println(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,15 +353,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
boolean wroteUser = false;
|
boolean wroteUser = false;
|
||||||
// While not at the end of the file
|
// While not at the end of the file
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check for incomplete or corrupted data
|
//Check for incomplete or corrupted data
|
||||||
if(!line.contains(":")) {
|
if (!line.contains(":")) {
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -370,9 +372,9 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String[] splitData = line.split(":");
|
String[] splitData = line.split(":");
|
||||||
|
|
||||||
//This would be rare, but check the splitData for having enough entries to contain a UUID
|
//This would be rare, but check the splitData for having enough entries to contain a UUID
|
||||||
if(splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
if (splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -394,7 +396,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
/*
|
/*
|
||||||
* If we couldn't find the user in the DB we need to add him
|
* If we couldn't find the user in the DB we need to add him
|
||||||
*/
|
*/
|
||||||
if(!wroteUser) {
|
if (!wroteUser) {
|
||||||
writeUserToLine(profile, writer);
|
writeUserToLine(profile, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,12 +480,24 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
appendable.append(String.valueOf(profile.getSkillLevel(PrimarySkillType.CROSSBOWS))).append(":");
|
appendable.append(String.valueOf(profile.getSkillLevel(PrimarySkillType.CROSSBOWS))).append(":");
|
||||||
appendable.append(String.valueOf(profile.getSkillXpLevel(PrimarySkillType.TRIDENTS))).append(":");
|
appendable.append(String.valueOf(profile.getSkillXpLevel(PrimarySkillType.TRIDENTS))).append(":");
|
||||||
appendable.append(String.valueOf(profile.getSkillLevel(PrimarySkillType.TRIDENTS))).append(":");
|
appendable.append(String.valueOf(profile.getSkillLevel(PrimarySkillType.TRIDENTS))).append(":");
|
||||||
|
// public static final int COOLDOWN_SUPER_SHOTGUN = 49;
|
||||||
|
appendable.append(String.valueOf(profile.getAbilityDATS(SuperAbilityType.SUPER_SHOTGUN))).append(":");
|
||||||
|
// public static final int COOLDOWN_TRIDENTS = 50;
|
||||||
|
appendable.append(String.valueOf(profile.getAbilityDATS(SuperAbilityType.TRIDENTS_SUPER_ABILITY))).append(":");
|
||||||
|
// public static final int COOLDOWN_ARCHERY = 51;
|
||||||
|
appendable.append(String.valueOf(profile.getAbilityDATS(SuperAbilityType.EXPLOSIVE_SHOT))).append(":");
|
||||||
|
// public static final int EXP_MACES = 52;
|
||||||
|
appendable.append(String.valueOf(profile.getSkillXpLevel(PrimarySkillType.MACES))).append(":");
|
||||||
|
// public static final int SKILLS_MACES = 53;
|
||||||
|
appendable.append(String.valueOf(profile.getSkillLevel(PrimarySkillType.MACES))).append(":");
|
||||||
|
// public static final int COOLDOWN_MACES = 54;
|
||||||
|
appendable.append(String.valueOf(profile.getAbilityDATS(SuperAbilityType.MACES_SUPER_ABILITY))).append(":");
|
||||||
appendable.append("\r\n");
|
appendable.append("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType primarySkillType, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType primarySkillType, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
|
if (primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
|
||||||
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
@ -557,11 +571,11 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
private @NotNull UserQuery getUserQuery(@Nullable UUID uuid, @Nullable String playerName) throws NullPointerException {
|
private @NotNull UserQuery getUserQuery(@Nullable UUID uuid, @Nullable String playerName) throws NullPointerException {
|
||||||
boolean hasName = playerName != null && !playerName.equalsIgnoreCase("null");
|
boolean hasName = playerName != null && !playerName.equalsIgnoreCase("null");
|
||||||
|
|
||||||
if(hasName && uuid != null) {
|
if (hasName && uuid != null) {
|
||||||
return new UserQueryFull(playerName, uuid);
|
return new UserQueryFull(playerName, uuid);
|
||||||
} else if (uuid != null) {
|
} else if (uuid != null) {
|
||||||
return new UserQueryUUIDImpl(uuid);
|
return new UserQueryUUIDImpl(uuid);
|
||||||
} else if(hasName) {
|
} else if (hasName) {
|
||||||
return new UserQueryNameImpl(playerName);
|
return new UserQueryNameImpl(playerName);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Both name and UUID cannot be null, at least one must be non-null!");
|
throw new NullPointerException("Both name and UUID cannot be null, at least one must be non-null!");
|
||||||
@ -595,7 +609,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,12 +619,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (USERNAME_INDEX + 1)) {
|
if (rawSplitData.length < (USERNAME_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we found the player
|
// we found the player
|
||||||
if(playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
|
if (playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
|
||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -645,24 +659,24 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find if the line contains the player we want.
|
// Find if the line contains the player we want.
|
||||||
String[] rawSplitData = line.split(":");
|
String[] rawSplitData = line.split(":");
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
if (rawSplitData.length < (UUID_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
||||||
if(fromDataUUID.equals(uuid)) {
|
if (fromDataUUID.equals(uuid)) {
|
||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(testing) {
|
if (testing) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -701,20 +715,20 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find if the line contains the player we want.
|
// Find if the line contains the player we want.
|
||||||
String[] rawSplitData = line.split(":");
|
String[] rawSplitData = line.split(":");
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
if (rawSplitData.length < (UUID_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
||||||
if(fromDataUUID.equals(uuid)) {
|
if (fromDataUUID.equals(uuid)) {
|
||||||
//Matched UUID, now check if name matches
|
//Matched UUID, now check if name matches
|
||||||
String dbPlayerName = rawSplitData[USERNAME_INDEX];
|
String dbPlayerName = rawSplitData[USERNAME_INDEX];
|
||||||
|
|
||||||
@ -731,7 +745,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(testing) {
|
if (testing) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,7 +773,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull PlayerProfile grabUnloadedProfile(@NotNull UUID uuid, @Nullable String playerName) {
|
private @NotNull PlayerProfile grabUnloadedProfile(@NotNull UUID uuid, @Nullable String playerName) {
|
||||||
if(playerName == null) {
|
if (playerName == null) {
|
||||||
playerName = ""; //No name for you boy!
|
playerName = ""; //No name for you boy!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,7 +792,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +904,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME_INDEX]).toString();
|
character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME_INDEX]).toString();
|
||||||
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
|
line = org.apache.commons.lang3.StringUtils.join(character, ":") + ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@ -987,6 +1001,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
List<PlayerStat> alchemy = new ArrayList<>();
|
List<PlayerStat> alchemy = new ArrayList<>();
|
||||||
List<PlayerStat> crossbows = new ArrayList<>();
|
List<PlayerStat> crossbows = new ArrayList<>();
|
||||||
List<PlayerStat> tridents = new ArrayList<>();
|
List<PlayerStat> tridents = new ArrayList<>();
|
||||||
|
List<PlayerStat> maces = new ArrayList<>();
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String playerName = null;
|
String playerName = null;
|
||||||
@ -998,7 +1013,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
|
|
||||||
if(line.startsWith("#"))
|
if (line.startsWith("#"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String[] data = line.split(":");
|
String[] data = line.split(":");
|
||||||
@ -1022,6 +1037,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.WOODCUTTING));
|
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.WOODCUTTING));
|
||||||
powerLevel += putStat(crossbows, playerName, skills.get(PrimarySkillType.CROSSBOWS));
|
powerLevel += putStat(crossbows, playerName, skills.get(PrimarySkillType.CROSSBOWS));
|
||||||
powerLevel += putStat(tridents, playerName, skills.get(PrimarySkillType.TRIDENTS));
|
powerLevel += putStat(tridents, playerName, skills.get(PrimarySkillType.TRIDENTS));
|
||||||
|
powerLevel += putStat(maces, playerName, skills.get(PrimarySkillType.MACES));
|
||||||
|
|
||||||
putStat(powerLevels, playerName, powerLevel);
|
putStat(powerLevels, playerName, powerLevel);
|
||||||
}
|
}
|
||||||
@ -1059,6 +1075,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
alchemy.sort(c);
|
alchemy.sort(c);
|
||||||
crossbows.sort(c);
|
crossbows.sort(c);
|
||||||
tridents.sort(c);
|
tridents.sort(c);
|
||||||
|
maces.sort(c);
|
||||||
powerLevels.sort(c);
|
powerLevels.sort(c);
|
||||||
|
|
||||||
playerStatHash.put(PrimarySkillType.MINING, mining);
|
playerStatHash.put(PrimarySkillType.MINING, mining);
|
||||||
@ -1076,6 +1093,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
playerStatHash.put(PrimarySkillType.ALCHEMY, alchemy);
|
playerStatHash.put(PrimarySkillType.ALCHEMY, alchemy);
|
||||||
playerStatHash.put(PrimarySkillType.CROSSBOWS, crossbows);
|
playerStatHash.put(PrimarySkillType.CROSSBOWS, crossbows);
|
||||||
playerStatHash.put(PrimarySkillType.TRIDENTS, tridents);
|
playerStatHash.put(PrimarySkillType.TRIDENTS, tridents);
|
||||||
|
playerStatHash.put(PrimarySkillType.MACES, maces);
|
||||||
|
|
||||||
return LeaderboardStatus.UPDATED;
|
return LeaderboardStatus.UPDATED;
|
||||||
}
|
}
|
||||||
@ -1126,12 +1144,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//Analyze the data
|
//Analyze the data
|
||||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||||
//Commented lines
|
//Commented lines
|
||||||
if(currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
|
if (currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
|
||||||
dbCommentDate = currentLine;
|
dbCommentDate = currentLine;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentLine.isEmpty())
|
if (currentLine.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//TODO: We are never passing empty lines, should we remove the flag for them?
|
//TODO: We are never passing empty lines, should we remove the flag for them?
|
||||||
@ -1139,12 +1157,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Only update the file if needed
|
//Only update the file if needed
|
||||||
if(!dataProcessor.getFlatFileDataFlags().isEmpty()) {
|
if (!dataProcessor.getFlatFileDataFlags().isEmpty()) {
|
||||||
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
||||||
logger.info("Updating 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)
|
||||||
fileWriter.write(dbCommentDate + "\r\n");
|
fileWriter.write(dbCommentDate + "\r\n");
|
||||||
|
|
||||||
fileWriter.write(dataProcessor.processDataForSave().toString());
|
fileWriter.write(dataProcessor.processDataForSave().toString());
|
||||||
@ -1157,7 +1175,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flagsFound == null || flagsFound.isEmpty()) {
|
if (flagsFound == null || flagsFound.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return flagsFound;
|
return flagsFound;
|
||||||
@ -1165,7 +1183,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void closeResources(BufferedReader bufferedReader, FileWriter fileWriter) {
|
private void closeResources(BufferedReader bufferedReader, FileWriter fileWriter) {
|
||||||
if(bufferedReader != null) {
|
if (bufferedReader != null) {
|
||||||
try {
|
try {
|
||||||
bufferedReader.close();
|
bufferedReader.close();
|
||||||
}
|
}
|
||||||
@ -1239,6 +1257,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.ALCHEMY, EXP_ALCHEMY, username);
|
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.ALCHEMY, EXP_ALCHEMY, username);
|
||||||
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.CROSSBOWS, EXP_CROSSBOWS, username);
|
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.CROSSBOWS, EXP_CROSSBOWS, username);
|
||||||
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.TRIDENTS, EXP_TRIDENTS, username);
|
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.TRIDENTS, EXP_TRIDENTS, username);
|
||||||
|
tryLoadSkillFloatValuesFromRawData(skillsXp, character, PrimarySkillType.MACES, EXP_MACES, username);
|
||||||
|
|
||||||
// Taming - Unused
|
// Taming - Unused
|
||||||
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.SUPER_BREAKER, COOLDOWN_SUPER_BREAKER, username);
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.SUPER_BREAKER, COOLDOWN_SUPER_BREAKER, username);
|
||||||
@ -1254,6 +1273,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.BLAST_MINING, COOLDOWN_BLAST_MINING, username);
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.BLAST_MINING, COOLDOWN_BLAST_MINING, username);
|
||||||
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.SUPER_SHOTGUN, COOLDOWN_SUPER_SHOTGUN, username);
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.SUPER_SHOTGUN, COOLDOWN_SUPER_SHOTGUN, username);
|
||||||
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.TRIDENTS_SUPER_ABILITY, COOLDOWN_TRIDENTS, username);
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.TRIDENTS_SUPER_ABILITY, COOLDOWN_TRIDENTS, username);
|
||||||
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.MACES_SUPER_ABILITY, COOLDOWN_MACES, username);
|
||||||
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
try {
|
try {
|
||||||
@ -1343,6 +1363,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ALCHEMY, SKILLS_ALCHEMY, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ALCHEMY, SKILLS_ALCHEMY, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.CROSSBOWS, SKILLS_CROSSBOWS, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.CROSSBOWS, SKILLS_CROSSBOWS, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.TRIDENTS, SKILLS_TRIDENTS, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.TRIDENTS, SKILLS_TRIDENTS, username);
|
||||||
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.MACES, SKILLS_MACES, username);
|
||||||
|
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
this.h2 = h2;
|
this.h2 = h2;
|
||||||
String connectionString = getConnectionString(h2);
|
String connectionString = getConnectionString(h2);
|
||||||
|
|
||||||
if(!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
|
if (!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
|
||||||
connectionString+=
|
connectionString+=
|
||||||
"&allowPublicKeyRetrieval=true";
|
"&allowPublicKeyRetrieval=true";
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
|
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
|
||||||
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
|
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
|
||||||
|
|
||||||
if(!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
|
if (!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
|
||||||
&& mcMMO.p.getGeneralConfig().getMySQLSSL())
|
&& mcMMO.p.getGeneralConfig().getMySQLSSL())
|
||||||
connectionString +=
|
connectionString +=
|
||||||
"?verifyServerCertificate=false"+
|
"?verifyServerCertificate=false"+
|
||||||
@ -169,7 +169,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ "taming = 0 AND mining = 0 AND woodcutting = 0 AND repair = 0 "
|
+ "taming = 0 AND mining = 0 AND woodcutting = 0 AND repair = 0 "
|
||||||
+ "AND unarmed = 0 AND herbalism = 0 AND excavation = 0 AND "
|
+ "AND unarmed = 0 AND herbalism = 0 AND excavation = 0 AND "
|
||||||
+ "archery = 0 AND swords = 0 AND axes = 0 AND acrobatics = 0 "
|
+ "archery = 0 AND swords = 0 AND axes = 0 AND acrobatics = 0 "
|
||||||
+ "AND fishing = 0 AND alchemy = 0 AND crossbows = 0 AND tridents = 0;");
|
+ "AND fishing = 0 AND alchemy = 0 AND crossbows = 0 AND tridents = 0 AND maces = 0;");
|
||||||
|
|
||||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "experience`.`user_id` = `s`.`user_id`)");
|
statement.executeUpdate("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "experience`.`user_id` = `s`.`user_id`)");
|
||||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "huds`.`user_id` = `s`.`user_id`)");
|
statement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "huds`.`user_id` = `s`.`user_id`)");
|
||||||
@ -247,7 +247,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if(uuid != null)
|
if (uuid != null)
|
||||||
cleanupUser(uuid);
|
cleanupUser(uuid);
|
||||||
|
|
||||||
Misc.profileCleanup(playerName);
|
Misc.profileCleanup(playerName);
|
||||||
@ -291,7 +291,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
|
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
|
||||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||||
+ ", fishing = ?, alchemy = ?, crossbows = ?, tridents = ?, total = ? WHERE user_id = ?");
|
+ ", fishing = ?, alchemy = ?, crossbows = ?, tridents = ?, maces = ?, total = ? WHERE user_id = ?");
|
||||||
statement.setInt(1, profile.getSkillLevel(PrimarySkillType.TAMING));
|
statement.setInt(1, profile.getSkillLevel(PrimarySkillType.TAMING));
|
||||||
statement.setInt(2, profile.getSkillLevel(PrimarySkillType.MINING));
|
statement.setInt(2, profile.getSkillLevel(PrimarySkillType.MINING));
|
||||||
statement.setInt(3, profile.getSkillLevel(PrimarySkillType.REPAIR));
|
statement.setInt(3, profile.getSkillLevel(PrimarySkillType.REPAIR));
|
||||||
@ -307,11 +307,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
statement.setInt(13, profile.getSkillLevel(PrimarySkillType.ALCHEMY));
|
statement.setInt(13, profile.getSkillLevel(PrimarySkillType.ALCHEMY));
|
||||||
statement.setInt(14, profile.getSkillLevel(PrimarySkillType.CROSSBOWS));
|
statement.setInt(14, profile.getSkillLevel(PrimarySkillType.CROSSBOWS));
|
||||||
statement.setInt(15, profile.getSkillLevel(PrimarySkillType.TRIDENTS));
|
statement.setInt(15, profile.getSkillLevel(PrimarySkillType.TRIDENTS));
|
||||||
|
statement.setInt(16, profile.getSkillLevel(PrimarySkillType.MACES));
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS)
|
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS)
|
||||||
total += profile.getSkillLevel(primarySkillType);
|
total += profile.getSkillLevel(primarySkillType);
|
||||||
statement.setInt(16, total);
|
statement.setInt(17, total);
|
||||||
statement.setInt(17, id);
|
statement.setInt(18, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -323,7 +324,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
|
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
|
||||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||||
+ ", fishing = ?, alchemy = ?, crossbows = ?, tridents = ? WHERE user_id = ?");
|
+ ", fishing = ?, alchemy = ?, crossbows = ?, tridents = ?, maces = ? WHERE user_id = ?");
|
||||||
statement.setInt(1, profile.getSkillXpLevel(PrimarySkillType.TAMING));
|
statement.setInt(1, profile.getSkillXpLevel(PrimarySkillType.TAMING));
|
||||||
statement.setInt(2, profile.getSkillXpLevel(PrimarySkillType.MINING));
|
statement.setInt(2, profile.getSkillXpLevel(PrimarySkillType.MINING));
|
||||||
statement.setInt(3, profile.getSkillXpLevel(PrimarySkillType.REPAIR));
|
statement.setInt(3, profile.getSkillXpLevel(PrimarySkillType.REPAIR));
|
||||||
@ -339,7 +340,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
statement.setInt(13, profile.getSkillXpLevel(PrimarySkillType.ALCHEMY));
|
statement.setInt(13, profile.getSkillXpLevel(PrimarySkillType.ALCHEMY));
|
||||||
statement.setInt(14, profile.getSkillXpLevel(PrimarySkillType.CROSSBOWS));
|
statement.setInt(14, profile.getSkillXpLevel(PrimarySkillType.CROSSBOWS));
|
||||||
statement.setInt(15, profile.getSkillXpLevel(PrimarySkillType.TRIDENTS));
|
statement.setInt(15, profile.getSkillXpLevel(PrimarySkillType.TRIDENTS));
|
||||||
statement.setInt(16, id);
|
statement.setInt(16, profile.getSkillXpLevel(PrimarySkillType.MACES));
|
||||||
|
statement.setInt(17, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -350,7 +352,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "cooldowns SET "
|
statement = connection.prepareStatement("UPDATE " + tablePrefix + "cooldowns SET "
|
||||||
+ " mining = ?, woodcutting = ?, unarmed = ?"
|
+ " mining = ?, woodcutting = ?, unarmed = ?"
|
||||||
+ ", herbalism = ?, excavation = ?, swords = ?"
|
+ ", herbalism = ?, excavation = ?, swords = ?"
|
||||||
+ ", axes = ?, blast_mining = ?, chimaera_wing = ?, crossbows = ?, tridents = ? WHERE user_id = ?");
|
+ ", axes = ?, blast_mining = ?, chimaera_wing = ?, crossbows = ?"
|
||||||
|
+ ", tridents = ?, maces = ? WHERE user_id = ?");
|
||||||
statement.setLong(1, profile.getAbilityDATS(SuperAbilityType.SUPER_BREAKER));
|
statement.setLong(1, profile.getAbilityDATS(SuperAbilityType.SUPER_BREAKER));
|
||||||
statement.setLong(2, profile.getAbilityDATS(SuperAbilityType.TREE_FELLER));
|
statement.setLong(2, profile.getAbilityDATS(SuperAbilityType.TREE_FELLER));
|
||||||
statement.setLong(3, profile.getAbilityDATS(SuperAbilityType.BERSERK));
|
statement.setLong(3, profile.getAbilityDATS(SuperAbilityType.BERSERK));
|
||||||
@ -362,7 +365,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
statement.setLong(9, profile.getUniqueData(UniqueDataType.CHIMAERA_WING_DATS));
|
statement.setLong(9, profile.getUniqueData(UniqueDataType.CHIMAERA_WING_DATS));
|
||||||
statement.setLong(10, profile.getAbilityDATS(SuperAbilityType.SUPER_SHOTGUN));
|
statement.setLong(10, profile.getAbilityDATS(SuperAbilityType.SUPER_SHOTGUN));
|
||||||
statement.setLong(11, profile.getAbilityDATS(SuperAbilityType.TRIDENTS_SUPER_ABILITY));
|
statement.setLong(11, profile.getAbilityDATS(SuperAbilityType.TRIDENTS_SUPER_ABILITY));
|
||||||
statement.setInt(12, id);
|
statement.setLong(12, profile.getAbilityDATS(SuperAbilityType.MACES_SUPER_ABILITY));
|
||||||
|
statement.setInt(13, id);
|
||||||
success = (statement.executeUpdate() != 0);
|
success = (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -396,7 +400,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
List<PlayerStat> stats = new ArrayList<>();
|
List<PlayerStat> stats = new ArrayList<>();
|
||||||
|
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(skill != null && SkillTools.isChildSkill(skill)) {
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
@ -627,7 +631,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadPlayerFromDB(@Nullable UUID uuid, @Nullable String playerName) throws RuntimeException {
|
private PlayerProfile loadPlayerFromDB(@Nullable UUID uuid, @Nullable String playerName) throws RuntimeException {
|
||||||
if(uuid == null && playerName == null) {
|
if (uuid == null && playerName == null) {
|
||||||
throw new RuntimeException("Error looking up player, both UUID and playerName are null and one must not be.");
|
throw new RuntimeException("Error looking up player, both UUID and playerName are null and one must not be.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,9 +652,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
statement = connection.prepareStatement(
|
statement = connection.prepareStatement(
|
||||||
"SELECT " +
|
"SELECT " +
|
||||||
"s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, s.crossbows, s.tridents, " +
|
"s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, s.crossbows, s.tridents, s.maces, " +
|
||||||
"e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, e.crossbows, e.tridents, " +
|
"e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, e.crossbows, e.tridents, e.maces, " +
|
||||||
"c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, c.chimaera_wing, c.crossbows, c.tridents, " +
|
"c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, c.chimaera_wing, c.crossbows, c.tridents, c.maces, " +
|
||||||
"h.mobhealthbar, h.scoreboardtips, u.uuid, u.`user` "
|
"h.mobhealthbar, h.scoreboardtips, u.uuid, u.`user` "
|
||||||
+ "FROM " + tablePrefix + "users u "
|
+ "FROM " + tablePrefix + "users u "
|
||||||
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
|
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
|
||||||
@ -922,6 +926,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ "`chimaera_wing` int(32) unsigned NOT NULL DEFAULT '0',"
|
+ "`chimaera_wing` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||||
+ "`crossbows` int(32) unsigned NOT NULL DEFAULT '0',"
|
+ "`crossbows` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||||
+ "`tridents` int(32) unsigned NOT NULL DEFAULT '0',"
|
+ "`tridents` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||||
|
+ "`maces` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||||
+ "PRIMARY KEY (`user_id`)) "
|
+ "PRIMARY KEY (`user_id`)) "
|
||||||
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
||||||
tryClose(createStatement);
|
tryClose(createStatement);
|
||||||
@ -950,6 +955,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||||
+ "`crossbows` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
+ "`crossbows` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||||
+ "`tridents` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
+ "`tridents` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||||
|
+ "`maces` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||||
+ "`total` int(10) unsigned NOT NULL DEFAULT "+totalLevel+","
|
+ "`total` int(10) unsigned NOT NULL DEFAULT "+totalLevel+","
|
||||||
+ "PRIMARY KEY (`user_id`)) "
|
+ "PRIMARY KEY (`user_id`)) "
|
||||||
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
||||||
@ -1017,20 +1023,24 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
tryClose(connection);
|
tryClose(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
String skills = "skills";
|
final String skills = "skills";
|
||||||
String crossbows = "crossbows";
|
final String crossbows = "crossbows";
|
||||||
String tridents = "tridents";
|
final String tridents = "tridents";
|
||||||
String experience = "experience";
|
final String maces = "maces";
|
||||||
String cooldowns = "cooldowns";
|
final String experience = "experience";
|
||||||
|
final String cooldowns = "cooldowns";
|
||||||
|
|
||||||
updateStructure(skills, crossbows, String.valueOf(32));
|
updateStructure(skills, crossbows, String.valueOf(32));
|
||||||
updateStructure(skills, tridents, String.valueOf(32));
|
updateStructure(skills, tridents, String.valueOf(32));
|
||||||
|
updateStructure(skills, maces, String.valueOf(32));
|
||||||
|
|
||||||
updateStructure(experience, crossbows, String.valueOf(10));
|
updateStructure(experience, crossbows, String.valueOf(10));
|
||||||
updateStructure(experience, tridents, String.valueOf(10));
|
updateStructure(experience, tridents, String.valueOf(10));
|
||||||
|
updateStructure(experience, maces, String.valueOf(10));
|
||||||
|
|
||||||
updateStructure(cooldowns, crossbows, String.valueOf(10));
|
updateStructure(cooldowns, crossbows, String.valueOf(10));
|
||||||
updateStructure(cooldowns, tridents, String.valueOf(10));
|
updateStructure(cooldowns, tridents, String.valueOf(10));
|
||||||
|
updateStructure(cooldowns, maces, String.valueOf(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStructure(String tableName, String columnName, String columnSize) {
|
private void updateStructure(String tableName, String columnName, String columnSize) {
|
||||||
@ -1213,15 +1223,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
||||||
MobHealthbarType mobHealthbarType;
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
|
||||||
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query
|
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query
|
||||||
// changes (a new skill is added)
|
// changes (a new skill is added)
|
||||||
final int OFFSET_XP = 15;
|
final int OFFSET_XP = 16;
|
||||||
final int OFFSET_DATS = 28;
|
final int OFFSET_DATS = 29;
|
||||||
final int OFFSET_OTHER = 41;
|
final int OFFSET_OTHER = 42;
|
||||||
|
|
||||||
skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
||||||
skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
|
skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
|
||||||
@ -1238,6 +1247,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
||||||
skills.put(PrimarySkillType.CROSSBOWS, result.getInt(OFFSET_SKILLS + 14));
|
skills.put(PrimarySkillType.CROSSBOWS, result.getInt(OFFSET_SKILLS + 14));
|
||||||
skills.put(PrimarySkillType.TRIDENTS, result.getInt(OFFSET_SKILLS + 15));
|
skills.put(PrimarySkillType.TRIDENTS, result.getInt(OFFSET_SKILLS + 15));
|
||||||
|
skills.put(PrimarySkillType.MACES, result.getInt(OFFSET_SKILLS + 16));
|
||||||
|
|
||||||
skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_XP + 1));
|
skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_XP + 1));
|
||||||
skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_XP + 2));
|
skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_XP + 2));
|
||||||
@ -1254,6 +1264,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
||||||
skillsXp.put(PrimarySkillType.CROSSBOWS, result.getFloat(OFFSET_XP + 14));
|
skillsXp.put(PrimarySkillType.CROSSBOWS, result.getFloat(OFFSET_XP + 14));
|
||||||
skillsXp.put(PrimarySkillType.TRIDENTS, result.getFloat(OFFSET_XP + 15));
|
skillsXp.put(PrimarySkillType.TRIDENTS, result.getFloat(OFFSET_XP + 15));
|
||||||
|
skillsXp.put(PrimarySkillType.MACES, result.getFloat(OFFSET_XP + 16));
|
||||||
|
|
||||||
// Taming - Unused - result.getInt(OFFSET_DATS + 1)
|
// Taming - Unused - result.getInt(OFFSET_DATS + 1)
|
||||||
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));
|
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));
|
||||||
@ -1262,6 +1273,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
skillsDATS.put(SuperAbilityType.BERSERK, result.getInt(OFFSET_DATS + 5));
|
skillsDATS.put(SuperAbilityType.BERSERK, result.getInt(OFFSET_DATS + 5));
|
||||||
skillsDATS.put(SuperAbilityType.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
skillsDATS.put(SuperAbilityType.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
||||||
skillsDATS.put(SuperAbilityType.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
skillsDATS.put(SuperAbilityType.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
||||||
|
skillsDATS.put(SuperAbilityType.EXPLOSIVE_SHOT, result.getInt(OFFSET_DATS + 8));
|
||||||
// Archery - Unused - result.getInt(OFFSET_DATS + 8)
|
// Archery - Unused - result.getInt(OFFSET_DATS + 8)
|
||||||
skillsDATS.put(SuperAbilityType.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
skillsDATS.put(SuperAbilityType.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
||||||
skillsDATS.put(SuperAbilityType.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
skillsDATS.put(SuperAbilityType.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
||||||
@ -1270,6 +1282,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
uniqueData.put(UniqueDataType.CHIMAERA_WING_DATS, result.getInt(OFFSET_DATS + 13));
|
uniqueData.put(UniqueDataType.CHIMAERA_WING_DATS, result.getInt(OFFSET_DATS + 13));
|
||||||
skillsDATS.put(SuperAbilityType.SUPER_SHOTGUN, result.getInt(OFFSET_DATS + 14));
|
skillsDATS.put(SuperAbilityType.SUPER_SHOTGUN, result.getInt(OFFSET_DATS + 14));
|
||||||
skillsDATS.put(SuperAbilityType.TRIDENTS_SUPER_ABILITY, result.getInt(OFFSET_DATS + 15));
|
skillsDATS.put(SuperAbilityType.TRIDENTS_SUPER_ABILITY, result.getInt(OFFSET_DATS + 15));
|
||||||
|
skillsDATS.put(SuperAbilityType.MACES_SUPER_ABILITY, result.getInt(OFFSET_DATS + 16));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
scoreboardTipsShown = result.getInt(OFFSET_OTHER + 2);
|
scoreboardTipsShown = result.getInt(OFFSET_OTHER + 2);
|
||||||
|
@ -28,7 +28,7 @@ public class FlatFileDataBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull FlatFileDataContainer build() {
|
public @NotNull FlatFileDataContainer build() {
|
||||||
if(dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
|
if (dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
|
||||||
return new BadCategorizedFlatFileData(uniqueProcessingId, dataFlags, splitStringData, badDataValues);
|
return new BadCategorizedFlatFileData(uniqueProcessingId, dataFlags, splitStringData, badDataValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ import static com.gmail.nossr50.database.FlatFileDatabaseManager.*;
|
|||||||
public class FlatFileDataUtil {
|
public class FlatFileDataUtil {
|
||||||
|
|
||||||
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
|
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
|
||||||
if(dataContainer.getDataFlags() == null) {
|
if (dataContainer.getDataFlags() == null) {
|
||||||
return dataContainer.getSplitData();
|
return dataContainer.getSplitData();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Data of this type is not salvageable
|
//Data of this type is not salvageable
|
||||||
//TODO: Test that we ignore the things we are supposed to ignore
|
//TODO: Test that we ignore the things we are supposed to ignore
|
||||||
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
|
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
|
||||||
if(dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|
if (dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
|
||||||
@ -29,7 +29,7 @@ public class FlatFileDataUtil {
|
|||||||
/*
|
/*
|
||||||
* First fix the bad data values if they exist
|
* First fix the bad data values if they exist
|
||||||
*/
|
*/
|
||||||
if(dataContainer instanceof BadCategorizedFlatFileData badData) {
|
if (dataContainer instanceof BadCategorizedFlatFileData badData) {
|
||||||
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
||||||
} else {
|
} else {
|
||||||
splitData = dataContainer.getSplitData();
|
splitData = dataContainer.getSplitData();
|
||||||
@ -42,7 +42,7 @@ public class FlatFileDataUtil {
|
|||||||
|
|
||||||
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
|
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
|
||||||
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
|
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
|
||||||
if(badDataValues[i]) {
|
if (badDataValues[i]) {
|
||||||
//This data value was marked as bad so we zero initialize it
|
//This data value was marked as bad so we zero initialize it
|
||||||
splitData[i] = getZeroInitialisedData(i, 0);
|
splitData[i] = getZeroInitialisedData(i, 0);
|
||||||
}
|
}
|
||||||
@ -56,67 +56,29 @@ public class FlatFileDataUtil {
|
|||||||
* @return the "zero" initialized data corresponding to the index
|
* @return the "zero" initialized data corresponding to the index
|
||||||
*/
|
*/
|
||||||
public static @NotNull String getZeroInitialisedData(int index, int startingLevel) throws IndexOutOfBoundsException {
|
public static @NotNull String getZeroInitialisedData(int index, int startingLevel) throws IndexOutOfBoundsException {
|
||||||
switch(index) {
|
//TODO: Add UUID recovery? Might not even be worth it.
|
||||||
case USERNAME_INDEX:
|
return switch (index) {
|
||||||
return LEGACY_INVALID_OLD_USERNAME; //We'll keep using this value for legacy compatibility reasons (not sure if needed but don't care)
|
case USERNAME_INDEX ->
|
||||||
case 2: //Assumption: Used to be for something, no longer used
|
LEGACY_INVALID_OLD_USERNAME; //We'll keep using this value for legacy compatibility reasons (not sure if needed but don't care)
|
||||||
case 3: //Assumption: Used to be for something, no longer used
|
//Assumption: Used to be for something, no longer used
|
||||||
case 23: //Assumption: Used to be used for something, no longer used
|
//Assumption: Used to be for something, no longer used
|
||||||
case 33: //Assumption: Used to be used for something, no longer used
|
//Assumption: Used to be used for something, no longer used
|
||||||
case LEGACY_LAST_LOGIN:
|
//Assumption: Used to be used for something, no longer used
|
||||||
case HEALTHBAR:
|
case 2, 3, 23, 33, LEGACY_LAST_LOGIN, HEALTHBAR -> "IGNORED";
|
||||||
return "IGNORED";
|
case SKILLS_MINING, SKILLS_REPAIR, SKILLS_UNARMED, SKILLS_HERBALISM, SKILLS_EXCAVATION, SKILLS_ARCHERY,
|
||||||
case SKILLS_MINING:
|
SKILLS_SWORDS, SKILLS_AXES, SKILLS_WOODCUTTING, SKILLS_ACROBATICS, SKILLS_TAMING, SKILLS_FISHING,
|
||||||
case SKILLS_REPAIR:
|
SKILLS_ALCHEMY, SKILLS_CROSSBOWS, SKILLS_TRIDENTS, SKILLS_MACES -> String.valueOf(startingLevel);
|
||||||
case SKILLS_UNARMED:
|
case OVERHAUL_LAST_LOGIN -> String.valueOf(-1L);
|
||||||
case SKILLS_HERBALISM:
|
case COOLDOWN_BERSERK, COOLDOWN_GIGA_DRILL_BREAKER, COOLDOWN_TREE_FELLER, COOLDOWN_GREEN_TERRA,
|
||||||
case SKILLS_EXCAVATION:
|
COOLDOWN_SERRATED_STRIKES, COOLDOWN_SKULL_SPLITTER, COOLDOWN_SUPER_BREAKER, COOLDOWN_BLAST_MINING,
|
||||||
case SKILLS_ARCHERY:
|
COOLDOWN_SUPER_SHOTGUN, COOLDOWN_TRIDENTS, COOLDOWN_ARCHERY, COOLDOWN_MACES, SCOREBOARD_TIPS, COOLDOWN_CHIMAERA_WING,
|
||||||
case SKILLS_SWORDS:
|
EXP_MINING, EXP_WOODCUTTING, EXP_REPAIR, EXP_UNARMED, EXP_HERBALISM, EXP_EXCAVATION, EXP_ARCHERY,
|
||||||
case SKILLS_AXES:
|
EXP_SWORDS, EXP_AXES, EXP_ACROBATICS, EXP_TAMING, EXP_FISHING, EXP_ALCHEMY, EXP_CROSSBOWS,
|
||||||
case SKILLS_WOODCUTTING:
|
EXP_TRIDENTS, EXP_MACES -> "0";
|
||||||
case SKILLS_ACROBATICS:
|
case UUID_INDEX ->
|
||||||
case SKILLS_TAMING:
|
throw new IndexOutOfBoundsException(); //TODO: Add UUID recovery? Might not even be worth it.
|
||||||
case SKILLS_FISHING:
|
default -> throw new IndexOutOfBoundsException();
|
||||||
case SKILLS_ALCHEMY:
|
};
|
||||||
case SKILLS_CROSSBOWS:
|
|
||||||
case SKILLS_TRIDENTS:
|
|
||||||
return String.valueOf(startingLevel);
|
|
||||||
case OVERHAUL_LAST_LOGIN:
|
|
||||||
return String.valueOf(-1L);
|
|
||||||
case COOLDOWN_BERSERK:
|
|
||||||
case COOLDOWN_GIGA_DRILL_BREAKER:
|
|
||||||
case COOLDOWN_TREE_FELLER:
|
|
||||||
case COOLDOWN_GREEN_TERRA:
|
|
||||||
case COOLDOWN_SERRATED_STRIKES:
|
|
||||||
case COOLDOWN_SKULL_SPLITTER:
|
|
||||||
case COOLDOWN_SUPER_BREAKER:
|
|
||||||
case COOLDOWN_BLAST_MINING:
|
|
||||||
case COOLDOWN_SUPER_SHOTGUN:
|
|
||||||
case COOLDOWN_TRIDENTS:
|
|
||||||
case COOLDOWN_ARCHERY:
|
|
||||||
case SCOREBOARD_TIPS:
|
|
||||||
case COOLDOWN_CHIMAERA_WING:
|
|
||||||
case EXP_MINING:
|
|
||||||
case EXP_WOODCUTTING:
|
|
||||||
case EXP_REPAIR:
|
|
||||||
case EXP_UNARMED:
|
|
||||||
case EXP_HERBALISM:
|
|
||||||
case EXP_EXCAVATION:
|
|
||||||
case EXP_ARCHERY:
|
|
||||||
case EXP_SWORDS:
|
|
||||||
case EXP_AXES:
|
|
||||||
case EXP_ACROBATICS:
|
|
||||||
case EXP_TAMING:
|
|
||||||
case EXP_FISHING:
|
|
||||||
case EXP_ALCHEMY:
|
|
||||||
case EXP_CROSSBOWS:
|
|
||||||
case EXP_TRIDENTS:
|
|
||||||
return "0";
|
|
||||||
case UUID_INDEX:
|
|
||||||
throw new IndexOutOfBoundsException(); //TODO: Add UUID recovery? Might not even be worth it.
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IndexOutOfBoundsException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,56 +25,56 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
||||||
|
|
||||||
//Broadcaster should be online
|
//Broadcaster should be online
|
||||||
if(!broadcastingPlayer.isOnline()) {
|
if (!broadcastingPlayer.isOnline()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
||||||
|
|
||||||
if(mmoBroadcastingPlayer == null) {
|
if (mmoBroadcastingPlayer == null) {
|
||||||
//This should never be null, but just in case...
|
//This should never be null, but just in case...
|
||||||
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player listeningPlayer) {
|
if (t instanceof Player listeningPlayer) {
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
if (mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if (mmoListeningPlayer == null) {
|
||||||
return false; //No profile so therefor no party
|
return false; //No profile so therefor no party
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
||||||
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
||||||
|
|
||||||
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
||||||
return false; //No party on either player when being in the same party is required
|
return false; //No party on either player when being in the same party is required
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
||||||
return false; //Not in the same party when it is required
|
return false; //Not in the same party when it is required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same world check
|
//Same world check
|
||||||
if(isLevelUpBroadcastsSameWorldOnly()) {
|
if (isLevelUpBroadcastsSameWorldOnly()) {
|
||||||
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
||||||
return false; //Not in the same world when its required
|
return false; //Not in the same world when its required
|
||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
|
if (mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
|
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Visibility checks
|
//Visibility checks
|
||||||
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
||||||
return false; //Player who leveled should be invisible to this player so don't send the message
|
return false; //Player who leveled should be invisible to this player so don't send the message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,56 +25,56 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
||||||
|
|
||||||
//Broadcaster should be online
|
//Broadcaster should be online
|
||||||
if(!broadcastingPlayer.isOnline()) {
|
if (!broadcastingPlayer.isOnline()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
||||||
|
|
||||||
if(mmoBroadcastingPlayer == null) {
|
if (mmoBroadcastingPlayer == null) {
|
||||||
//This should never be null, but just in case...
|
//This should never be null, but just in case...
|
||||||
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player listeningPlayer) {
|
if (t instanceof Player listeningPlayer) {
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
if (mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if (mmoListeningPlayer == null) {
|
||||||
return false; //No profile so therefor no party
|
return false; //No profile so therefor no party
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
||||||
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
||||||
|
|
||||||
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
||||||
return false; //No party on either player when being in the same party is required
|
return false; //No party on either player when being in the same party is required
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
||||||
return false; //Not in the same party when it is required
|
return false; //Not in the same party when it is required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same world check
|
//Same world check
|
||||||
if(isPowerLevelUpBroadcastsSameWorldOnly()) {
|
if (isPowerLevelUpBroadcastsSameWorldOnly()) {
|
||||||
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
||||||
return false; //Not in the same world when its required
|
return false; //Not in the same world when its required
|
||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
if (mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
|
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Visibility checks
|
//Visibility checks
|
||||||
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
||||||
return false; //Player who leveled should be invisible to this player so don't send the message
|
return false; //Player who leveled should be invisible to this player so don't send the message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ public enum DatabaseType {
|
|||||||
|
|
||||||
if (typeName.equalsIgnoreCase("file")) {
|
if (typeName.equalsIgnoreCase("file")) {
|
||||||
return FLATFILE;
|
return FLATFILE;
|
||||||
}
|
} else if (typeName.equalsIgnoreCase("mysql")) {
|
||||||
else if (typeName.equalsIgnoreCase("mysql")) {
|
|
||||||
return SQL;
|
return SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ public class SkillXpGain implements Delayed {
|
|||||||
public int compareTo(SkillXpGain other) {
|
public int compareTo(SkillXpGain other) {
|
||||||
if (this.expiryTime < other.expiryTime) {
|
if (this.expiryTime < other.expiryTime) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (this.expiryTime > other.expiryTime) {
|
||||||
else if (this.expiryTime > other.expiryTime) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8,10 +8,8 @@ public class McMMOUrl {
|
|||||||
public static final String urlSpigot = "https://spigot.mcmmo.org";
|
public static final String urlSpigot = "https://spigot.mcmmo.org";
|
||||||
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
||||||
|
|
||||||
public static String getUrl(McMMOWebLinks webLinks)
|
public static String getUrl(McMMOWebLinks webLinks) {
|
||||||
{
|
switch(webLinks) {
|
||||||
switch(webLinks)
|
|
||||||
{
|
|
||||||
case WIKI:
|
case WIKI:
|
||||||
return urlWiki;
|
return urlWiki;
|
||||||
case PATREON:
|
case PATREON:
|
||||||
|
@ -11,20 +11,16 @@ public enum McMMOWebLinks {
|
|||||||
HELP_TRANSLATE,
|
HELP_TRANSLATE,
|
||||||
WIKI;
|
WIKI;
|
||||||
|
|
||||||
public String getUrl()
|
public String getUrl() {
|
||||||
{
|
|
||||||
return McMMOUrl.getUrl(this);
|
return McMMOUrl.getUrl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNiceTitle()
|
public String getNiceTitle() {
|
||||||
{
|
|
||||||
return StringUtils.getCapitalized(toString());
|
return StringUtils.getCapitalized(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleDescription()
|
public String getLocaleDescription() {
|
||||||
{
|
switch (this) {
|
||||||
switch (this)
|
|
||||||
{
|
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
return LocaleLoader.getString( "JSON.URL.Website");
|
return LocaleLoader.getString( "JSON.URL.Website");
|
||||||
case DISCORD:
|
case DISCORD:
|
||||||
|
@ -8,8 +8,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
*/
|
*/
|
||||||
public class OldName extends FixedMetadataValue {
|
public class OldName extends FixedMetadataValue {
|
||||||
|
|
||||||
public OldName(String oldName, mcMMO plugin)
|
public OldName(String oldName, mcMMO plugin) {
|
||||||
{
|
|
||||||
super(plugin, oldName);
|
super(plugin, oldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,17 +15,13 @@ public enum ItemShareType {
|
|||||||
public static ItemShareType getShareType(ItemStack itemStack) {
|
public static ItemShareType getShareType(ItemStack itemStack) {
|
||||||
if (ItemUtils.isMobDrop(itemStack)) {
|
if (ItemUtils.isMobDrop(itemStack)) {
|
||||||
return LOOT;
|
return LOOT;
|
||||||
}
|
} else if (ItemUtils.isMiningDrop(itemStack)) {
|
||||||
else if (ItemUtils.isMiningDrop(itemStack)) {
|
|
||||||
return MINING;
|
return MINING;
|
||||||
}
|
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
||||||
else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
|
||||||
return HERBALISM;
|
return HERBALISM;
|
||||||
}
|
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||||
else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
|
||||||
return WOODCUTTING;
|
return WOODCUTTING;
|
||||||
}
|
} else if (ItemUtils.isMiscDrop(itemStack)) {
|
||||||
else if (ItemUtils.isMiscDrop(itemStack)) {
|
|
||||||
return MISC;
|
return MISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +85,11 @@ public class Party {
|
|||||||
return onlineMembers;
|
return onlineMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> getVisibleMembers(Player player)
|
public List<Player> getVisibleMembers(Player player) {
|
||||||
{
|
|
||||||
ArrayList<Player> visibleMembers = new ArrayList<>();
|
ArrayList<Player> visibleMembers = new ArrayList<>();
|
||||||
|
|
||||||
for(Player p : onlineMembers)
|
for(Player p : onlineMembers) {
|
||||||
{
|
if (player.canSee(p))
|
||||||
if(player.canSee(p))
|
|
||||||
visibleMembers.add(p);
|
visibleMembers.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +345,7 @@ public class Party {
|
|||||||
for(UUID playerUUID : members.keySet()) {
|
for(UUID playerUUID : members.keySet()) {
|
||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
||||||
|
|
||||||
if(offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
if (offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
||||||
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
|
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
|
||||||
coloredNames.add(onlineColor + offlinePlayer.getName());
|
coloredNames.add(onlineColor + offlinePlayer.getName());
|
||||||
} else {
|
} else {
|
||||||
@ -361,7 +359,7 @@ public class Party {
|
|||||||
|
|
||||||
private void buildChatMessage(@NotNull StringBuilder stringBuilder, String @NotNull [] names) {
|
private void buildChatMessage(@NotNull StringBuilder stringBuilder, String @NotNull [] names) {
|
||||||
for(int i = 0; i < names.length; i++) {
|
for(int i = 0; i < names.length; i++) {
|
||||||
if(i + 1 >= names.length) {
|
if (i + 1 >= names.length) {
|
||||||
stringBuilder
|
stringBuilder
|
||||||
.append(names[i]);
|
.append(names[i]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,8 +14,7 @@ public enum ShareMode {
|
|||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
if (string.equalsIgnoreCase("even")) {
|
if (string.equalsIgnoreCase("even")) {
|
||||||
return EQUAL;
|
return EQUAL;
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(string)) {
|
||||||
else if (CommandUtils.shouldDisableToggle(string)) {
|
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
|
|||||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||||
|
import com.gmail.nossr50.skills.maces.MacesManager;
|
||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
@ -71,6 +72,9 @@ import java.util.EnumMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.EventUtils.callPlayerAbilityActivateEvent;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
public class McMMOPlayer implements Identified {
|
public class McMMOPlayer implements Identified {
|
||||||
private final @NotNull Identity identity;
|
private final @NotNull Identity identity;
|
||||||
|
|
||||||
@ -119,6 +123,8 @@ public class McMMOPlayer implements Identified {
|
|||||||
private PrimarySkillType lastSkillShownScoreboard = PrimarySkillType.values()[0];
|
private PrimarySkillType lastSkillShownScoreboard = PrimarySkillType.values()[0];
|
||||||
|
|
||||||
public McMMOPlayer(Player player, PlayerProfile profile) {
|
public McMMOPlayer(Player player, PlayerProfile profile) {
|
||||||
|
requireNonNull(player, "player cannot be null");
|
||||||
|
requireNonNull(profile, "profile cannot be null");
|
||||||
this.playerName = player.getName();
|
this.playerName = player.getName();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
identity = Identity.identity(uuid);
|
identity = Identity.identity(uuid);
|
||||||
@ -151,7 +157,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
this.chatChannel = ChatChannel.NONE;
|
this.chatChannel = ChatChannel.NONE;
|
||||||
|
|
||||||
if(ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
|
if (ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
|
||||||
chatSpy = true;
|
chatSpy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,6 +226,9 @@ public class McMMOPlayer implements Identified {
|
|||||||
case WOODCUTTING:
|
case WOODCUTTING:
|
||||||
skillManagers.put(primarySkillType, new WoodcuttingManager(this));
|
skillManagers.put(primarySkillType, new WoodcuttingManager(this));
|
||||||
break;
|
break;
|
||||||
|
case MACES:
|
||||||
|
skillManagers.put(primarySkillType, new MacesManager(this));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidSkillException("The skill named has no manager! Contact the devs!");
|
throw new InvalidSkillException("The skill named has no manager! Contact the devs!");
|
||||||
}
|
}
|
||||||
@ -241,42 +250,38 @@ public class McMMOPlayer implements Identified {
|
|||||||
this.lastSkillShownScoreboard = primarySkillType;
|
this.lastSkillShownScoreboard = primarySkillType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
|
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource) {
|
||||||
{
|
|
||||||
//Check if they've reached the power level cap just now
|
//Check if they've reached the power level cap just now
|
||||||
if(hasReachedPowerLevelCap()) {
|
if (hasReachedPowerLevelCap()) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
||||||
} else if(hasReachedLevelCap(primarySkillType)) {
|
} else if (hasReachedLevelCap(primarySkillType)) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill",
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill",
|
||||||
String.valueOf(mcMMO.p.getSkillTools().getLevelCap(primarySkillType)),
|
String.valueOf(mcMMO.p.getSkillTools().getLevelCap(primarySkillType)),
|
||||||
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates from Party sources
|
//Updates from Party sources
|
||||||
if(xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
if (xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Updates from passive sources (Alchemy, Smelting, etc...)
|
//Updates from passive sources (Alchemy, Smelting, etc...)
|
||||||
if(xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
if (xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateXPBar(primarySkillType, plugin);
|
updateXPBar(primarySkillType, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel)
|
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel) {
|
||||||
{
|
|
||||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
|
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||||
{
|
|
||||||
//XP BAR UPDATES
|
//XP BAR UPDATES
|
||||||
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
|
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
|
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType) {
|
||||||
{
|
if (SkillTools.isChildSkill(primarySkillType)) {
|
||||||
if(SkillTools.isChildSkill(primarySkillType)) {
|
|
||||||
return 1.0D;
|
return 1.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,6 +318,10 @@ public class McMMOPlayer implements Identified {
|
|||||||
return (TridentsManager) skillManagers.get(PrimarySkillType.TRIDENTS);
|
return (TridentsManager) skillManagers.get(PrimarySkillType.TRIDENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MacesManager getMacesManager() {
|
||||||
|
return (MacesManager) skillManagers.get(PrimarySkillType.MACES);
|
||||||
|
}
|
||||||
|
|
||||||
public ExcavationManager getExcavationManager() {
|
public ExcavationManager getExcavationManager() {
|
||||||
return (ExcavationManager) skillManagers.get(PrimarySkillType.EXCAVATION);
|
return (ExcavationManager) skillManagers.get(PrimarySkillType.EXCAVATION);
|
||||||
}
|
}
|
||||||
@ -589,7 +598,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasReachedLevelCap(PrimarySkillType primarySkillType) {
|
public boolean hasReachedLevelCap(PrimarySkillType primarySkillType) {
|
||||||
if(hasReachedPowerLevelCap())
|
if (hasReachedPowerLevelCap())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return getSkillLevel(primarySkillType) >= mcMMO.p.getSkillTools().getLevelCap(primarySkillType);
|
return getSkillLevel(primarySkillType) >= mcMMO.p.getSkillTools().getLevelCap(primarySkillType);
|
||||||
@ -611,7 +620,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(xp <= 0) {
|
if (xp <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +652,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
|
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
|
||||||
@ -696,7 +705,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param primarySkillType The skill to check
|
* @param primarySkillType The skill to check
|
||||||
*/
|
*/
|
||||||
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(hasReachedLevelCap(primarySkillType))
|
if (hasReachedLevelCap(primarySkillType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
|
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
|
||||||
@ -739,11 +748,11 @@ public class McMMOPlayer implements Identified {
|
|||||||
* Players & Profiles
|
* Players & Profiles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Player getPlayer() {
|
public @NotNull Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile getProfile() {
|
public @NotNull PlayerProfile getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,8 +902,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
//TODO: This is hacky and temporary solution until skills are move to the new system
|
//TODO: This is hacky and temporary solution until skills are move to the new system
|
||||||
//Potential problems with this include skills with two super abilities (ie mining)
|
//Potential problems with this include skills with two super abilities (ie mining)
|
||||||
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
if (!RankUtils.hasUnlockedSubskill(player, subSkillType)) {
|
||||||
{
|
|
||||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
||||||
|
|
||||||
//Inform the player they are not yet skilled enough
|
//Inform the player they are not yet skilled enough
|
||||||
@ -917,7 +925,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EventUtils.callPlayerAbilityActivateEvent(player, primarySkillType).isCancelled()) {
|
if (callPlayerAbilityActivateEvent(this, primarySkillType).isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,8 +936,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
//Ability cap of 0 or below means no cap
|
//Ability cap of 0 or below means no cap
|
||||||
if(abilityLengthCap > 0)
|
if (abilityLengthCap > 0) {
|
||||||
{
|
|
||||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
||||||
} else {
|
} else {
|
||||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(primarySkillType) / abilityLengthVar), superAbilityType.getMaxLength());
|
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(primarySkillType) / abilityLengthVar), superAbilityType.getMaxLength());
|
||||||
@ -1011,7 +1018,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* IF THE TOOL IS AN AXE
|
* IF THE TOOL IS AN AXE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(tool == ToolType.AXE) {
|
if (tool == ToolType.AXE) {
|
||||||
processAxeToolMessages();
|
processAxeToolMessages();
|
||||||
} else {
|
} else {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
||||||
@ -1032,20 +1039,20 @@ public class McMMOPlayer implements Identified {
|
|||||||
/*
|
/*
|
||||||
* IF BOTH TREE FELLER & SKULL SPLITTER ARE ON CD
|
* IF BOTH TREE FELLER & SKULL SPLITTER ARE ON CD
|
||||||
*/
|
*/
|
||||||
if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
||||||
tooTiredMultiple(PrimarySkillType.WOODCUTTING, SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER, SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
tooTiredMultiple(PrimarySkillType.WOODCUTTING, SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER, SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
||||||
/*
|
/*
|
||||||
* IF TREE FELLER IS ON CD
|
* IF TREE FELLER IS ON CD
|
||||||
* AND PLAYER IS LOOKING AT TREE
|
* AND PLAYER IS LOOKING AT TREE
|
||||||
*/
|
*/
|
||||||
} else if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
|
} else if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
|
||||||
&& BlockUtils.isPartOfTree(rayCast)) {
|
&& BlockUtils.isPartOfTree(rayCast)) {
|
||||||
raiseToolWithCooldowns(SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER);
|
raiseToolWithCooldowns(SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IF SKULL SPLITTER IS ON CD
|
* IF SKULL SPLITTER IS ON CD
|
||||||
*/
|
*/
|
||||||
} else if(isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
} else if (isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
||||||
raiseToolWithCooldowns(SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
raiseToolWithCooldowns(SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
||||||
} else {
|
} else {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, ToolType.AXE.getRaiseTool());
|
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, ToolType.AXE.getRaiseTool());
|
||||||
@ -1143,7 +1150,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
*/
|
*/
|
||||||
public void logout(boolean syncSave) {
|
public void logout(boolean syncSave) {
|
||||||
Player thisPlayer = getPlayer();
|
Player thisPlayer = getPlayer();
|
||||||
if(getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
if (getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
||||||
RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(MetadataConstants.METADATA_KEY_RUPTURE).get(0);
|
RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(MetadataConstants.METADATA_KEY_RUPTURE).get(0);
|
||||||
|
|
||||||
//Punish a logout
|
//Punish a logout
|
||||||
@ -1162,7 +1169,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
UserManager.remove(thisPlayer);
|
UserManager.remove(thisPlayer);
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||||
|
|
||||||
if (inParty()) {
|
if (inParty()) {
|
||||||
|
@ -100,7 +100,7 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
||||||
if(lastLogin != null)
|
if (lastLogin != null)
|
||||||
this.lastLogin = lastLogin;
|
this.lastLogin = lastLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,17 +130,16 @@ public class PlayerProfile {
|
|||||||
if (changed) {
|
if (changed) {
|
||||||
mcMMO.p.getLogger().severe("PlayerProfile saving failed for player: " + playerName + " " + uuid);
|
mcMMO.p.getLogger().severe("PlayerProfile saving failed for player: " + playerName + " " + uuid);
|
||||||
|
|
||||||
if(saveAttempts > 0) {
|
if (saveAttempts > 0) {
|
||||||
mcMMO.p.getLogger().severe("Attempted to save profile for player "+getPlayerName()
|
mcMMO.p.getLogger().severe("Attempted to save profile for player "+getPlayerName()
|
||||||
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveAttempts < 10)
|
if (saveAttempts < 10) {
|
||||||
{
|
|
||||||
saveAttempts++;
|
saveAttempts++;
|
||||||
|
|
||||||
//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)
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||||
else
|
else
|
||||||
scheduleAsyncSave();
|
scheduleAsyncSave();
|
||||||
@ -271,7 +270,7 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillXpLevel(PrimarySkillType skill) {
|
public int getSkillXpLevel(PrimarySkillType skill) {
|
||||||
if(SkillTools.isChildSkill(skill)) {
|
if (SkillTools.isChildSkill(skill)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ public class PlayerProfile {
|
|||||||
markProfileDirty();
|
markProfileDirty();
|
||||||
|
|
||||||
//Don't allow levels to be negative
|
//Don't allow levels to be negative
|
||||||
if(level < 0)
|
if (level < 0)
|
||||||
level = 0;
|
level = 0;
|
||||||
|
|
||||||
skills.put(skill, level);
|
skills.put(skill, level);
|
||||||
@ -372,8 +371,7 @@ public class PlayerProfile {
|
|||||||
for (PrimarySkillType parentSkill : parentSkills) {
|
for (PrimarySkillType parentSkill : parentSkills) {
|
||||||
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skillsXp.put(skill, skillsXp.get(skill) + xp);
|
skillsXp.put(skill, skillsXp.get(skill) + xp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,7 +422,7 @@ public class PlayerProfile {
|
|||||||
* @return the total amount of Xp until next level
|
* @return the total amount of Xp until next level
|
||||||
*/
|
*/
|
||||||
public int getXpToLevel(PrimarySkillType primarySkillType) {
|
public int getXpToLevel(PrimarySkillType primarySkillType) {
|
||||||
if(SkillTools.isChildSkill(primarySkillType)) {
|
if (SkillTools.isChildSkill(primarySkillType)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public enum MaterialType {
|
|||||||
return Material.DIAMOND;
|
return Material.DIAMOND;
|
||||||
|
|
||||||
case NETHERITE:
|
case NETHERITE:
|
||||||
if(Material.getMaterial("NETHERITE_SCRAP") != null)
|
if (Material.getMaterial("NETHERITE_SCRAP") != null)
|
||||||
return Material.getMaterial("NETHERITE_SCRAP");
|
return Material.getMaterial("NETHERITE_SCRAP");
|
||||||
else
|
else
|
||||||
return Material.DIAMOND;
|
return Material.DIAMOND;
|
||||||
|
@ -9,11 +9,9 @@ public enum ModConfigType {
|
|||||||
public static ModConfigType getModConfigType(String materialName) {
|
public static ModConfigType getModConfigType(String materialName) {
|
||||||
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
||||||
return ARMOR;
|
return ARMOR;
|
||||||
}
|
} else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
||||||
else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
|
||||||
return TOOLS;
|
return TOOLS;
|
||||||
}
|
} else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
||||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
|
||||||
return BLOCKS;
|
return BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ public enum PrimarySkillType {
|
|||||||
EXCAVATION,
|
EXCAVATION,
|
||||||
FISHING,
|
FISHING,
|
||||||
HERBALISM,
|
HERBALISM,
|
||||||
|
MACES,
|
||||||
MINING,
|
MINING,
|
||||||
REPAIR,
|
REPAIR,
|
||||||
SALVAGE,
|
SALVAGE,
|
||||||
|
@ -57,6 +57,9 @@ public enum SubSkillType {
|
|||||||
HERBALISM_HYLIAN_LUCK,
|
HERBALISM_HYLIAN_LUCK,
|
||||||
HERBALISM_SHROOM_THUMB,
|
HERBALISM_SHROOM_THUMB,
|
||||||
|
|
||||||
|
/* Maces */
|
||||||
|
MACES_MACES_LIMIT_BREAK(10),
|
||||||
|
|
||||||
/* Mining */
|
/* Mining */
|
||||||
MINING_BIGGER_BOMBS(1),
|
MINING_BIGGER_BOMBS(1),
|
||||||
MINING_BLAST_MINING(8),
|
MINING_BLAST_MINING(8),
|
||||||
@ -125,18 +128,15 @@ public enum SubSkillType {
|
|||||||
* If our SubSkillType has more than 1 rank define it
|
* If our SubSkillType has more than 1 rank define it
|
||||||
* @param numRanks The number of ranks our SubSkillType has
|
* @param numRanks The number of ranks our SubSkillType has
|
||||||
*/
|
*/
|
||||||
SubSkillType(int numRanks)
|
SubSkillType(int numRanks) {
|
||||||
{
|
|
||||||
this.numRanks = numRanks;
|
this.numRanks = numRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubSkillType()
|
SubSkillType() {
|
||||||
{
|
|
||||||
this.numRanks = 0;
|
this.numRanks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumRanks()
|
public int getNumRanks() {
|
||||||
{
|
|
||||||
return numRanks;
|
return numRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,8 +167,7 @@ public enum SubSkillType {
|
|||||||
* Get the string representation of the permission node for this subskill
|
* Get the string representation of the permission node for this subskill
|
||||||
* @return the permission node for this subskill
|
* @return the permission node for this subskill
|
||||||
*/
|
*/
|
||||||
public String getPermissionNodeAddress()
|
public String getPermissionNodeAddress() {
|
||||||
{
|
|
||||||
//TODO: This could be optimized
|
//TODO: This could be optimized
|
||||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH);
|
return "mcmmo.ability." + getParentSkill().toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
@ -198,12 +197,10 @@ public enum SubSkillType {
|
|||||||
* Split the string up so we can capitalize each part
|
* Split the string up so we can capitalize each part
|
||||||
*/
|
*/
|
||||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
if(subskillNameWithoutPrefix.contains("_"))
|
if (subskillNameWithoutPrefix.contains("_")) {
|
||||||
{
|
|
||||||
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
for(String string : splitStrings)
|
for(String string : splitStrings) {
|
||||||
{
|
|
||||||
endResult.append(StringUtils.getCapitalized(string));
|
endResult.append(StringUtils.getCapitalized(string));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -225,8 +222,7 @@ public enum SubSkillType {
|
|||||||
* Returns the name of the parent skill from the Locale file
|
* Returns the name of the parent skill from the Locale file
|
||||||
* @return The parent skill as defined in the locale
|
* @return The parent skill as defined in the locale
|
||||||
*/
|
*/
|
||||||
public String getParentNiceNameLocale()
|
public String getParentNiceNameLocale() {
|
||||||
{
|
|
||||||
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +231,7 @@ public enum SubSkillType {
|
|||||||
* @param subSkillType target subskill
|
* @param subSkillType target subskill
|
||||||
* @return the "nice" name without spaces
|
* @return the "nice" name without spaces
|
||||||
*/
|
*/
|
||||||
public String getNiceNameNoSpaces(SubSkillType subSkillType)
|
public String getNiceNameNoSpaces(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return getConfigName(subSkillType.toString());
|
return getConfigName(subSkillType.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,18 +255,15 @@ public enum SubSkillType {
|
|||||||
return subStringIndex;
|
return subStringIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleKeyRoot()
|
public String getLocaleKeyRoot() {
|
||||||
{
|
|
||||||
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleName()
|
public String getLocaleName() {
|
||||||
{
|
|
||||||
return getFromLocaleSubAddress(".Name");
|
return getFromLocaleSubAddress(".Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleDescription()
|
public String getLocaleDescription() {
|
||||||
{
|
|
||||||
return getFromLocaleSubAddress(".Description");
|
return getFromLocaleSubAddress(".Description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,13 +273,11 @@ public enum SubSkillType {
|
|||||||
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
|
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
|
||||||
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
|
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
|
||||||
|
|
||||||
public String getLocaleStat(String... vars)
|
public String getLocaleStat(String... vars) {
|
||||||
{
|
|
||||||
return LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars);
|
return LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustomLocaleStat(String... vars)
|
public String getCustomLocaleStat(String... vars) {
|
||||||
{
|
|
||||||
return LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
|
return LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,8 +285,7 @@ public enum SubSkillType {
|
|||||||
return LocaleLoader.getString(getLocaleKeyRoot() + s);
|
return LocaleLoader.getString(getLocaleKeyRoot() + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLocaleKeyFromSubAddress(String s)
|
private String getLocaleKeyFromSubAddress(String s) {
|
||||||
{
|
|
||||||
return getLocaleKeyRoot() + s;
|
return getLocaleKeyRoot() + s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,19 +72,26 @@ public enum SuperAbilityType {
|
|||||||
"Swords.Skills.SS.Other.Off",
|
"Swords.Skills.SS.Other.Off",
|
||||||
"Swords.SubSkill.SerratedStrikes.Name"),
|
"Swords.SubSkill.SerratedStrikes.Name"),
|
||||||
SUPER_SHOTGUN(
|
SUPER_SHOTGUN(
|
||||||
null,
|
"Placeholder",
|
||||||
null,
|
"Placeholder",
|
||||||
"Crossbows.Skills.SSG.Other.On",
|
"Placeholder",
|
||||||
"Crossbows.Skills.SSG.Refresh",
|
"Placeholder",
|
||||||
null,
|
"Placeholder",
|
||||||
"Crossbows.SubSkill.SuperShotgun.Name"),
|
"Placeholder"),
|
||||||
TRIDENTS_SUPER_ABILITY(
|
TRIDENTS_SUPER_ABILITY(
|
||||||
"Tridents.Skills.TA.On",
|
"Placeholder",
|
||||||
"Tridents.Skills.TA.Off",
|
"Placeholder",
|
||||||
"Tridents.Skills.TA.Other.On",
|
"Placeholder",
|
||||||
"Tridents.Skills.TA.Refresh",
|
"Placeholder",
|
||||||
"Tridents.Skills.TA.Other.Off",
|
"Placeholder",
|
||||||
"Tridents.SubSkill.TridentAbility.Name"),
|
"Placeholder"),
|
||||||
|
MACES_SUPER_ABILITY(
|
||||||
|
"Placeholder",
|
||||||
|
"Placeholder",
|
||||||
|
"Placeholder",
|
||||||
|
"Placeholder",
|
||||||
|
"Placeholder",
|
||||||
|
"Placeholder"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has cooldown - but has to share a skill with Super Breaker, so needs special treatment
|
* Has cooldown - but has to share a skill with Super Breaker, so needs special treatment
|
||||||
@ -199,16 +206,15 @@ public enum SuperAbilityType {
|
|||||||
public boolean getPermissions(Player player) {
|
public boolean getPermissions(Player player) {
|
||||||
return switch (this) {
|
return switch (this) {
|
||||||
case BERSERK -> Permissions.berserk(player);
|
case BERSERK -> Permissions.berserk(player);
|
||||||
case EXPLOSIVE_SHOT -> Permissions.explosiveShot(player);
|
|
||||||
case BLAST_MINING -> Permissions.remoteDetonation(player);
|
case BLAST_MINING -> Permissions.remoteDetonation(player);
|
||||||
case GIGA_DRILL_BREAKER -> Permissions.gigaDrillBreaker(player);
|
case GIGA_DRILL_BREAKER -> Permissions.gigaDrillBreaker(player);
|
||||||
case GREEN_TERRA -> Permissions.greenTerra(player);
|
case GREEN_TERRA -> Permissions.greenTerra(player);
|
||||||
case SERRATED_STRIKES -> Permissions.serratedStrikes(player);
|
case SERRATED_STRIKES -> Permissions.serratedStrikes(player);
|
||||||
case SKULL_SPLITTER -> Permissions.skullSplitter(player);
|
case SKULL_SPLITTER -> Permissions.skullSplitter(player);
|
||||||
case SUPER_BREAKER -> Permissions.superBreaker(player);
|
case SUPER_BREAKER -> Permissions.superBreaker(player);
|
||||||
case SUPER_SHOTGUN -> Permissions.superShotgun(player);
|
|
||||||
case TREE_FELLER -> Permissions.treeFeller(player);
|
case TREE_FELLER -> Permissions.treeFeller(player);
|
||||||
case TRIDENTS_SUPER_ABILITY -> Permissions.tridentsSuper(player);
|
// TODO: once implemented, return permissions for the following abilities
|
||||||
|
case EXPLOSIVE_SHOT, TRIDENTS_SUPER_ABILITY, SUPER_SHOTGUN, MACES_SUPER_ABILITY -> false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ public enum ToolType {
|
|||||||
SWORD("Swords.Ability.Lower", "Swords.Ability.Ready"),
|
SWORD("Swords.Ability.Lower", "Swords.Ability.Ready"),
|
||||||
CROSSBOW("Crossbows.Ability.Lower", "Crossbows.Ability.Ready"),
|
CROSSBOW("Crossbows.Ability.Lower", "Crossbows.Ability.Ready"),
|
||||||
BOW("Archery.Ability.Lower", "Archery.Ability.Ready"),
|
BOW("Archery.Ability.Lower", "Archery.Ability.Ready"),
|
||||||
TRIDENTS("Tridents.Ability.Lower", "Tridents.Ability.Ready");
|
TRIDENTS("Tridents.Ability.Lower", "Tridents.Ability.Ready"),
|
||||||
|
MACES("Maces.Ability.Lower", "Maces.Ability.Ready");
|
||||||
|
|
||||||
private final String lowerTool;
|
private final String lowerTool;
|
||||||
private final String raiseTool;
|
private final String raiseTool;
|
||||||
@ -45,6 +46,8 @@ public enum ToolType {
|
|||||||
return ItemUtils.isCrossbow(itemStack);
|
return ItemUtils.isCrossbow(itemStack);
|
||||||
case TRIDENTS:
|
case TRIDENTS:
|
||||||
return ItemUtils.isTrident(itemStack);
|
return ItemUtils.isTrident(itemStack);
|
||||||
|
case MACES:
|
||||||
|
return ItemUtils.isMace(itemStack);
|
||||||
|
|
||||||
case FISTS:
|
case FISTS:
|
||||||
return itemStack.getType() == Material.AIR;
|
return itemStack.getType() == Material.AIR;
|
||||||
|
@ -1,167 +1,149 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.alchemy;
|
package com.gmail.nossr50.datatypes.skills.alchemy;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Color;
|
import com.gmail.nossr50.util.PotionUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.Potion;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.bukkit.potion.PotionData;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.PotionUtil.samePotionType;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
public class AlchemyPotion {
|
public class AlchemyPotion {
|
||||||
private final Material material;
|
private final @NotNull String potionConfigName;
|
||||||
private PotionData data;
|
private final @NotNull ItemStack potionItemStack;
|
||||||
private String name;
|
private final @NotNull Map<ItemStack, String> alchemyPotionChildren;
|
||||||
private List<String> lore;
|
|
||||||
private List<PotionEffect> effects;
|
|
||||||
private Color color;
|
|
||||||
private Map<ItemStack, String> children;
|
|
||||||
|
|
||||||
public AlchemyPotion(Material material, PotionData data, String name, List<String> lore, List<PotionEffect> effects, Color color, Map<ItemStack, String> children) {
|
public AlchemyPotion(@NotNull String potionConfigName, @NotNull ItemStack potionItemStack,
|
||||||
this.material = material;
|
@NotNull Map<ItemStack, String> alchemyPotionChildren) {
|
||||||
this.data = data;
|
this.potionConfigName = requireNonNull(potionConfigName, "potionConfigName cannot be null");
|
||||||
this.lore = lore;
|
this.potionItemStack = requireNonNull(potionItemStack, "potionItemStack cannot be null");
|
||||||
this.name = name;
|
this.alchemyPotionChildren = requireNonNull(alchemyPotionChildren, "alchemyPotionChildren cannot be null");
|
||||||
this.effects = effects;
|
|
||||||
this.children = children;
|
|
||||||
this.color = color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public @NotNull ItemStack toItemStack(int amount) {
|
||||||
return "AlchemyPotion{" + data + ", " + name + ", Effects[" + effects.size() + "], Children[" + children.size() + "]}";
|
final ItemStack clone = potionItemStack.clone();
|
||||||
|
clone.setAmount(Math.max(1, amount));
|
||||||
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack toItemStack(int amount) {
|
public @NotNull Map<ItemStack, String> getAlchemyPotionChildren() {
|
||||||
ItemStack potion = new ItemStack(material, amount);
|
return alchemyPotionChildren;
|
||||||
PotionMeta meta = (PotionMeta) potion.getItemMeta();
|
|
||||||
|
|
||||||
meta.setBasePotionData(data);
|
|
||||||
if (this.getName() != null) {
|
|
||||||
meta.setDisplayName(this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getLore() != null && !this.getLore().isEmpty()) {
|
|
||||||
meta.setLore(this.getLore());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.getEffects().isEmpty()) {
|
|
||||||
for (PotionEffect effect : this.getEffects()) {
|
|
||||||
meta.addCustomEffect(effect, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getColor() != null) {
|
|
||||||
meta.setColor(this.getColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
potion.setItemMeta(meta);
|
|
||||||
return potion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getMaterial() {
|
public @Nullable AlchemyPotion getChild(@NotNull ItemStack ingredient) {
|
||||||
return material;
|
if (!alchemyPotionChildren.isEmpty()) {
|
||||||
}
|
for (Entry<ItemStack, String> child : alchemyPotionChildren.entrySet()) {
|
||||||
|
|
||||||
public Potion toPotion(int amount) {
|
|
||||||
return Potion.fromItemStack(this.toItemStack(amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PotionData getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(PotionData data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getLore() {
|
|
||||||
return lore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLore(List<String> lore) {
|
|
||||||
this.lore = lore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PotionEffect> getEffects() {
|
|
||||||
return effects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEffects(List<PotionEffect> effects) {
|
|
||||||
this.effects = effects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<ItemStack, String> getChildren() {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChildren(Map<ItemStack, String> children) {
|
|
||||||
this.children = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AlchemyPotion getChild(ItemStack ingredient) {
|
|
||||||
if (!children.isEmpty()) {
|
|
||||||
for (Entry<ItemStack, String> child : children.entrySet()) {
|
|
||||||
if (ingredient.isSimilar(child.getKey())) {
|
if (ingredient.isSimilar(child.getKey())) {
|
||||||
return PotionConfig.getInstance().getPotion(child.getValue());
|
return mcMMO.p.getPotionConfig().getPotion(child.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSimilar(ItemStack item) {
|
public boolean isSimilarPotion(@NotNull ItemStack otherPotion) {
|
||||||
if (item.getType() != material) {
|
requireNonNull(otherPotion, "otherPotion cannot be null");
|
||||||
|
if (otherPotion.getType() != potionItemStack.getType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!item.hasItemMeta()) {
|
|
||||||
|
// no potion meta, no match
|
||||||
|
if (!otherPotion.hasItemMeta()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
|
||||||
PotionData that = meta.getBasePotionData();
|
/*
|
||||||
if (data.getType() != that.getType()) {
|
* Compare custom effects on both potions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final PotionMeta otherPotionMeta = (PotionMeta) otherPotion.getItemMeta();
|
||||||
|
// compare custom effects on both potions, this has to be done in two traversals
|
||||||
|
// comparing thisPotionMeta -> otherPotionMeta and otherPotionMeta -> thisPotionMeta
|
||||||
|
if (hasDifferingCustomEffects(getAlchemyPotionMeta(), otherPotionMeta)
|
||||||
|
|| hasDifferingCustomEffects(otherPotionMeta, getAlchemyPotionMeta())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (data.isExtended() != that.isExtended()) {
|
|
||||||
|
if (!samePotionType(getAlchemyPotionMeta(), otherPotionMeta)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (data.isUpgraded() != that.isUpgraded()) {
|
|
||||||
|
// Legacy only comparison, compare PotionData
|
||||||
|
if (!PotionUtil.isPotionDataEqual(getAlchemyPotionMeta(), otherPotionMeta)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PotionEffect effect : effects) {
|
|
||||||
if (!meta.hasCustomEffect(effect.getType())) {
|
/*
|
||||||
return false;
|
* If one potion has lore and the other does not, then they are not the same potion.
|
||||||
|
* If both have lore, compare the lore.
|
||||||
|
* If neither have lore, they may be the same potion.
|
||||||
|
*/
|
||||||
|
if (!otherPotionMeta.hasLore() && getAlchemyPotionMeta().hasLore()
|
||||||
|
|| !getAlchemyPotionMeta().hasLore() && otherPotionMeta.hasLore()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !otherPotionMeta.hasLore() || !getAlchemyPotionMeta().hasLore()
|
||||||
|
|| otherPotionMeta.getLore().equals(getAlchemyPotionMeta().getLore());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasDifferingCustomEffects(PotionMeta potionMeta, PotionMeta otherPotionMeta) {
|
||||||
|
for (int i = 0; i < potionMeta.getCustomEffects().size(); i++) {
|
||||||
|
var effect = potionMeta.getCustomEffects().get(i);
|
||||||
|
|
||||||
|
// One has an effect the other does not, they are not the same potion
|
||||||
|
if (!otherPotionMeta.hasCustomEffect(effect.getType())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var otherEffect = otherPotionMeta.getCustomEffects().get(i);
|
||||||
|
// Amplifier or duration are not equal, they are not the same potion
|
||||||
|
if (effect.getAmplifier() != otherEffect.getAmplifier()
|
||||||
|
|| effect.getDuration() != otherEffect.getDuration()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!meta.hasLore() && !lore.isEmpty()) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
if (!(lore.isEmpty() && !meta.hasLore()) && !meta.getLore().equals(lore)) {
|
public PotionMeta getAlchemyPotionMeta() {
|
||||||
return false;
|
return (PotionMeta) potionItemStack.getItemMeta();
|
||||||
}
|
}
|
||||||
if (!meta.hasDisplayName() && name != null) {
|
|
||||||
return false;
|
public boolean isSplash() {
|
||||||
}
|
return potionItemStack.getType() == Material.SPLASH_POTION;
|
||||||
return (name == null && !meta.hasDisplayName()) || meta.getDisplayName().equals(name);
|
}
|
||||||
|
|
||||||
|
public boolean isLingering() {
|
||||||
|
return potionItemStack.getType() == Material.LINGERING_POTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
AlchemyPotion that = (AlchemyPotion) o;
|
||||||
|
return Objects.equals(potionConfigName, that.potionConfigName) && Objects.equals(potionItemStack, that.potionItemStack) && Objects.equals(alchemyPotionChildren, that.alchemyPotionChildren);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(potionConfigName, potionItemStack, alchemyPotionChildren);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AlchemyPotion{" +
|
||||||
|
"potionConfigName='" + potionConfigName + '\'' +
|
||||||
|
", potionItemStack=" + potionItemStack +
|
||||||
|
", alchemyPotionChildren=" + alchemyPotionChildren +
|
||||||
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.alchemy;
|
package com.gmail.nossr50.datatypes.skills.alchemy;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import com.gmail.nossr50.util.PotionUtil;
|
||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionType;
|
|
||||||
|
|
||||||
import java.util.List;
|
import static com.gmail.nossr50.util.PotionUtil.*;
|
||||||
|
|
||||||
public enum PotionStage {
|
public enum PotionStage {
|
||||||
FIVE(5),
|
FIVE(5),
|
||||||
@ -35,36 +34,37 @@ public enum PotionStage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static PotionStage getPotionStage(AlchemyPotion input, AlchemyPotion output) {
|
public static PotionStage getPotionStage(AlchemyPotion input, AlchemyPotion output) {
|
||||||
PotionStage potionStage = getPotionStage(output);
|
PotionStage outputPotionStage = getPotionStage(output);
|
||||||
if (!isWaterBottle(input) && getPotionStage(input) == potionStage) {
|
PotionStage inputPotionStage = getPotionStage(input);
|
||||||
potionStage = PotionStage.FIVE;
|
if (!isWaterBottle(input) && inputPotionStage == outputPotionStage) {
|
||||||
|
outputPotionStage = PotionStage.FIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return potionStage;
|
return outputPotionStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWaterBottle(AlchemyPotion input) {
|
private static boolean isWaterBottle(AlchemyPotion alchemyPotion) {
|
||||||
return input.getData().getType() == PotionType.WATER;
|
return isPotionTypeWater(alchemyPotion.getAlchemyPotionMeta());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
|
public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
|
||||||
PotionData data = alchemyPotion.getData();
|
final PotionMeta potionMeta = alchemyPotion.getAlchemyPotionMeta();
|
||||||
List<PotionEffect> effects = alchemyPotion.getEffects();
|
|
||||||
|
|
||||||
int stage = 1;
|
int stage = 1;
|
||||||
|
|
||||||
// Check if potion has an effect of any sort
|
// Check if potion has an effect of any sort
|
||||||
if (data.getType().getEffectType() != null || !effects.isEmpty()) {
|
if (!potionMeta.getCustomEffects().isEmpty()
|
||||||
|
|| PotionUtil.hasBasePotionEffects(potionMeta)) {
|
||||||
stage++;
|
stage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if potion has a glowstone dust amplifier
|
// Check if potion has a glowstone dust amplifier
|
||||||
// Else check if the potion has a custom effect with an amplifier added by mcMMO
|
// Else check if the potion has a custom effect with an amplifier added by mcMMO
|
||||||
if (data.isUpgraded()) {
|
if (isStrong(potionMeta)) {
|
||||||
stage++;
|
stage++;
|
||||||
} else if(!effects.isEmpty()) {
|
} else if (!potionMeta.getCustomEffects().isEmpty()) {
|
||||||
for (PotionEffect effect : effects){
|
for (PotionEffect effect : potionMeta.getCustomEffects()){
|
||||||
if(effect.getAmplifier() > 0){
|
if (effect.getAmplifier() > 0){
|
||||||
stage++;
|
stage++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -72,12 +72,12 @@ public enum PotionStage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if potion has a redstone dust amplifier
|
// Check if potion has a redstone dust amplifier
|
||||||
if (data.isExtended()) {
|
if (isLong(potionMeta)) {
|
||||||
stage++;
|
stage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if potion has a gunpowder amplifier
|
// Check if potion has a gunpowder amplifier
|
||||||
if (alchemyPotion.getMaterial() == Material.SPLASH_POTION || alchemyPotion.getMaterial() == Material.LINGERING_POTION) {
|
if (alchemyPotion.isSplash() || alchemyPotion.isLingering()) {
|
||||||
stage++;
|
stage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user