Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddbd6479e5 | ||
|
|
84862f7b28 | ||
|
|
9eea5631e7 | ||
|
|
ee3c934858 | ||
|
|
35650efe47 | ||
|
|
6f7b800a7d | ||
|
|
08f3340399 | ||
|
|
d36551a94b | ||
|
|
42ed601fd7 | ||
|
|
3cd800aeac | ||
|
|
a8e4f886a5 | ||
|
|
fffdca4515 | ||
|
|
03fe0f6116 |
@@ -47,8 +47,8 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.42.0'
|
||||
implementation 'com.willfp:libreforge:3.110.0'
|
||||
compileOnly 'com.willfp:eco:6.44.0'
|
||||
implementation 'com.willfp:libreforge:3.116.0'
|
||||
implementation 'org.joml:joml:1.10.4'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Checkstyle configuration that checks the sun coding conventions from:
|
||||
|
||||
- the Java Language Specification at
|
||||
https://docs.oracle.com/javase/specs/jls/se11/html/index.html
|
||||
|
||||
- the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
|
||||
|
||||
- the Javadoc guidelines at
|
||||
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
|
||||
|
||||
- the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
|
||||
|
||||
- some best practices
|
||||
|
||||
Checkstyle is very configurable. Be sure to read the documentation at
|
||||
https://checkstyle.org (or in your downloaded distribution).
|
||||
|
||||
Most Checks are configurable, be sure to consult the documentation.
|
||||
|
||||
To completely disable a check, just comment it out or delete it from the file.
|
||||
To suppress certain violations please review suppression filters.
|
||||
|
||||
Finally, it is worth reading the documentation.
|
||||
|
||||
-->
|
||||
|
||||
<module name="Checker">
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="config/checkstyle/suppression.xml"/>
|
||||
</module>
|
||||
|
||||
<!--
|
||||
If you set the basedir property below, then all reported file
|
||||
names will be relative to the specified directory. See
|
||||
https://checkstyle.org/config.html#Checker
|
||||
|
||||
<property name="basedir" value="${basedir}"/>
|
||||
-->
|
||||
<property name="severity" value="error"/>
|
||||
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
|
||||
<!-- Excludes all 'module-info.java' files -->
|
||||
<!-- See https://checkstyle.org/config_filefilters.html -->
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks whether files end with a new line. -->
|
||||
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
|
||||
<module name="NewlineAtEndOfFile"/>
|
||||
|
||||
<!-- Checks that property files contain the same keys. -->
|
||||
<!-- See https://checkstyle.org/config_misc.html#Translation -->
|
||||
<module name="Translation"/>
|
||||
|
||||
<!-- Checks for Size Violations. -->
|
||||
<!-- See https://checkstyle.org/config_sizes.html -->
|
||||
<module name="FileLength"/>
|
||||
<module name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="200"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See https://checkstyle.org/config_whitespace.html -->
|
||||
<module name="FileTabCharacter"/>
|
||||
|
||||
<!-- Miscellaneous other checks. -->
|
||||
<!-- See https://checkstyle.org/config_misc.html -->
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\s+$"/>
|
||||
<property name="minimum" value="0"/>
|
||||
<property name="maximum" value="0"/>
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
</module>
|
||||
|
||||
<!-- Checks for Headers -->
|
||||
<!-- See https://checkstyle.org/config_header.html -->
|
||||
<!-- <module name="Header"> -->
|
||||
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
|
||||
<!-- <property name="fileExtensions" value="java"/> -->
|
||||
<!-- </module> -->
|
||||
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!-- Checks for Javadoc comments. -->
|
||||
<!-- See https://checkstyle.org/config_javadoc.html -->
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="JavadocMethod"/>
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocVariable"/>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="MissingJavadocMethod"/>
|
||||
|
||||
<!-- Checks for Naming Conventions. -->
|
||||
<!-- See https://checkstyle.org/config_naming.html -->
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalFinalVariableName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
|
||||
<!-- Checks for imports -->
|
||||
<!-- See https://checkstyle.org/config_imports.html -->
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks for Size Violations. -->
|
||||
<!-- See https://checkstyle.org/config_sizes.html -->
|
||||
<!-- <module name="MethodLength"/> -->
|
||||
<module name="ParameterNumber"/>
|
||||
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See https://checkstyle.org/config_whitespace.html -->
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="GenericWhitespace"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceAfter"/>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
<module name="WhitespaceAround"/>
|
||||
|
||||
<!-- Modifier Checks -->
|
||||
<!-- See https://checkstyle.org/config_modifiers.html -->
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
|
||||
<!-- Checks for blocks. You know, those {}'s -->
|
||||
<!-- See https://checkstyle.org/config_blocks.html -->
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="RightCurly"/>
|
||||
|
||||
<!-- Checks for common coding problems -->
|
||||
<!-- See https://checkstyle.org/config_coding.html -->
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<!-- <module name="MagicNumber"/> -->
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
|
||||
<!-- Checks for class design -->
|
||||
<!-- See https://checkstyle.org/config_design.html -->
|
||||
<!-- <module name="DesignForExtension"/> -->
|
||||
<module name="FinalClass"/>
|
||||
<!-- <module name="HideUtilityClassConstructor"/> -->
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="VisibilityModifier"/>
|
||||
<module name="RequireThis"/>
|
||||
|
||||
<!-- Miscellaneous other checks. -->
|
||||
<!-- See https://checkstyle.org/config_misc.html -->
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="FinalParameters"/>
|
||||
<module name="TodoComment"/>
|
||||
<module name="UpperEll"/>
|
||||
|
||||
</module>
|
||||
</module>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<!-- Fields don't need javadoc -->
|
||||
<suppress files="Effects.java" checks="JavadocVariable"/>
|
||||
<suppress files="Skills.java" checks="JavadocVariable"/>
|
||||
<suppress files="Stats.java" checks="JavadocVariable"/>
|
||||
</suppressions>
|
||||
@@ -77,10 +77,6 @@ class EcoPetsPlugin : LibReforgePlugin() {
|
||||
)
|
||||
}
|
||||
|
||||
override fun getMinimumEcoVersion(): String {
|
||||
return "6.37.0"
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
lateinit var instance: EcoPetsPlugin
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
package com.willfp.ecopets.commands
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.command.impl.PluginCommand
|
||||
import com.willfp.ecopets.pets.Pets
|
||||
import com.willfp.libreforge.LibReforgePlugin
|
||||
import com.willfp.libreforge.lrcdb.CommandExport
|
||||
import com.willfp.libreforge.lrcdb.CommandImport
|
||||
import com.willfp.libreforge.lrcdb.ExportableConfig
|
||||
import org.bukkit.command.CommandSender
|
||||
|
||||
class CommandEcopets(plugin: EcoPlugin) : PluginCommand(plugin, "ecopets", "ecopets.command.ecopets", false) {
|
||||
class CommandEcopets(plugin: LibReforgePlugin) : PluginCommand(plugin, "ecopets", "ecopets.command.ecopets", false) {
|
||||
init {
|
||||
this.addSubcommand(CommandReload(plugin))
|
||||
.addSubcommand(CommandGive(plugin))
|
||||
.addSubcommand(CommandGiveEgg(plugin))
|
||||
.addSubcommand(CommandGiveXP(plugin))
|
||||
.addSubcommand(CommandReset(plugin))
|
||||
.addSubcommand(CommandImport("pets", plugin))
|
||||
.addSubcommand(CommandExport(plugin) {
|
||||
Pets.values().map {
|
||||
ExportableConfig(
|
||||
it.id,
|
||||
it.config
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||
|
||||
@@ -172,13 +172,15 @@ class Pet(
|
||||
}
|
||||
)
|
||||
|
||||
effects = config.getSubsections("effects").mapNotNull {
|
||||
Effects.compile(it, "Pet $id")
|
||||
}.toSet()
|
||||
effects = Effects.compile(
|
||||
config.getSubsections("effects"),
|
||||
"Pet $id"
|
||||
)
|
||||
|
||||
conditions = config.getSubsections("conditions").mapNotNull {
|
||||
Conditions.compile(it, "Pet $id")
|
||||
}.toSet()
|
||||
conditions = Conditions.compile(
|
||||
config.getSubsections("conditions"),
|
||||
"Pet $id"
|
||||
)
|
||||
|
||||
for (string in config.getStrings("level-commands")) {
|
||||
val split = string.split(":")
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.PlayerQuitEvent
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.abs
|
||||
|
||||
@@ -44,10 +44,18 @@ class PetDisplay(
|
||||
|
||||
location.y += NumberUtils.fastSin(tick / (2 * PI) * 0.5) * 0.15
|
||||
|
||||
try {
|
||||
stand.teleport(location)
|
||||
} catch (_: Exception) {
|
||||
|
||||
if (location.world != null) {
|
||||
try {
|
||||
stand.teleport(location)
|
||||
} catch (_: Throwable) {
|
||||
/*
|
||||
For anyone reading - I KNOW TO NEVER CATCH THROWABLE
|
||||
but NMS is really stupid and does this sometimes:
|
||||
java.lang.Throwable: null
|
||||
at net.minecraft.world.entity.Entity.teleportTo(Entity.java:3336) ~[paper-1.19.2.jar:git-Paper-186]
|
||||
so I guess that's what has to be done. Not sure what the actual cause is.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if (!pet.entityTexture.contains(":")) {
|
||||
|
||||
@@ -142,7 +142,7 @@ class PetLevelGUI(
|
||||
if (newPage == 0) {
|
||||
PetsGUI.open(player)
|
||||
} else {
|
||||
menu.addState(player, pageKey, newPage)
|
||||
menu.setState(player, pageKey, newPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class PetLevelGUI(
|
||||
|
||||
val newPage = min(pages, page + 1)
|
||||
|
||||
menu.addState(player, pageKey, newPage)
|
||||
menu.setState(player, pageKey, newPage)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.libreforge.conditions.ConfiguredCondition
|
||||
import com.willfp.libreforge.events.TriggerPreProcessEvent
|
||||
import com.willfp.libreforge.filters.Filter
|
||||
import com.willfp.libreforge.filters.Filters
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
@@ -31,7 +32,7 @@ object PetTriggerXPGainListener : Listener {
|
||||
return
|
||||
}
|
||||
|
||||
if (!Filter.matches(data, xpGain.filters)) {
|
||||
if (!Filters.passes(data, xpGain.filters)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.google.common.collect.BiMap
|
||||
import com.google.common.collect.HashBiMap
|
||||
import com.google.common.collect.ImmutableList
|
||||
import com.willfp.eco.core.config.ConfigType
|
||||
import com.willfp.eco.core.config.TransientConfig
|
||||
import com.willfp.eco.core.config.readConfig
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import com.willfp.ecopets.EcoPetsPlugin
|
||||
import java.io.File
|
||||
@@ -45,7 +45,7 @@ object Pets {
|
||||
removePet(set)
|
||||
}
|
||||
|
||||
val petsYml = TransientConfig(File(plugin.dataFolder, "pets.yml"), ConfigType.YAML)
|
||||
val petsYml = File(plugin.dataFolder, "pets.yml").readConfig(ConfigType.YAML)
|
||||
|
||||
for ((id, petConfig) in plugin.fetchConfigs("pets")) {
|
||||
addNewPet(Pet(id, petConfig, plugin))
|
||||
|
||||
@@ -148,7 +148,7 @@ object PetsGUI {
|
||||
|
||||
val newPage = max(1, page - 1)
|
||||
|
||||
menu.addState(player, pageKey, newPage)
|
||||
menu.setState(player, pageKey, newPage)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -172,7 +172,7 @@ object PetsGUI {
|
||||
|
||||
val newPage = min(pages, page + 1)
|
||||
|
||||
menu.addState(player, pageKey, newPage)
|
||||
menu.setState(player, pageKey, newPage)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -258,6 +258,13 @@ cannot-afford-type:
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
|
||||
cannot-afford-price:
|
||||
in-actionbar: true
|
||||
sound:
|
||||
enabled: true
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
|
||||
point-names: # If you have point names that look ugly (eg g_souls) then you can map them to nice names to be shown to players.
|
||||
example_point: "Nicely Formatted Point"
|
||||
|
||||
@@ -274,5 +281,3 @@ potions:
|
||||
particles:
|
||||
permanent: false
|
||||
triggered: true
|
||||
|
||||
share-configs: true # If your configs are allowed to be used to gather data and improve the plugin. Nothing identifying (IP, Name, etc) is shared.
|
||||
@@ -6,8 +6,17 @@ messages:
|
||||
reloaded: "Reloaded!"
|
||||
cannot-afford: "&cYou can't afford to do this! &fCost: &a$$%cost%"
|
||||
cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%"
|
||||
cannot-afford-price: "&cYou can't afford to do this! &fPrice: %price%"
|
||||
on-cooldown: "&cThis effect is on cooldown! &fTime left: &a%seconds% seconds"
|
||||
cannot-transmit: "&cYou can't transmit here!"
|
||||
must-specify-lrcdb-id: "&cYou must specify the ID of the config to download! Not sure what this means? Go to &alrcdb.auxilor.io"
|
||||
lrcdb-import-error: "&cError importing config: &f%message%"
|
||||
lrcdb-import-success: "&fImported &a%name%&f! Reload the plugin to install it"
|
||||
must-specify-config-name: "&cYou must specify the config name!"
|
||||
invalid-config-name: "&cInvalid config name!"
|
||||
lrcdb-export-error: "&cError exporting config: &f%message%"
|
||||
lrcdb-export-success: "&fExported &a%name%&f! View it on &alrcdb.auxilor.io&f, or share your config ID: &f%id%"
|
||||
|
||||
needs-player: "&cYou must specify a player!"
|
||||
gave-xp: "&fYou have given &a%xp% &fXP to %player%&f's %pet%&f!"
|
||||
reset-xp: "&fYou have reset %player%&f's %pet%&f XP!"
|
||||
|
||||
19
eco-core/core-plugin/src/main/resources/lrcdb.yml
Normal file
19
eco-core/core-plugin/src/main/resources/lrcdb.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
# Options for lrcdb (https://lrcdb.auxilor.io), a website to share configs
|
||||
# with other server owners, so you can get more configs without making them
|
||||
# yourself!
|
||||
|
||||
author: "Unknown Author" # The name attached to configs you export
|
||||
|
||||
# Options about automatically sharing configs you create
|
||||
share-configs:
|
||||
# If you want all your configs to automatically be publicly available,
|
||||
# set this to true. This really helps out other users!
|
||||
publicly: false
|
||||
|
||||
# If you don't want your configs to be usable to gather information about
|
||||
# plugin usage or to improve the plugins in the future, disable this.
|
||||
# Nothing identifying is shared.
|
||||
enabled: true
|
||||
|
||||
# If you disable share-configs, you can still share select configs publicly
|
||||
# with /ecopets export <config>.
|
||||
@@ -54,6 +54,8 @@ permissions:
|
||||
ecopets.command.reset: true
|
||||
ecopets.command.activate: true
|
||||
ecopets.command.deactivate: true
|
||||
ecopets.command.import: true
|
||||
ecopets.command.export: true
|
||||
|
||||
ecopets.command.reload:
|
||||
description: Allows reloading the config
|
||||
@@ -76,6 +78,12 @@ permissions:
|
||||
ecopets.command.reset:
|
||||
description: Allows the use of /ecopets reset.
|
||||
default: op
|
||||
ecopets.command.import:
|
||||
description: Allows the use of /ecopets import.
|
||||
default: op
|
||||
ecopets.command.export:
|
||||
description: Allows the use of /ecopets export.
|
||||
default: op
|
||||
ecopets.command.activate:
|
||||
description: Allows the use of /pets activate.
|
||||
default: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#libreforge-updater
|
||||
#Fri Oct 07 19:52:35 BST 2022
|
||||
version=1.49.0
|
||||
#Fri Oct 28 11:36:22 BST 2022
|
||||
version=1.55.0
|
||||
plugin-name=EcoPets
|
||||
|
||||
Reference in New Issue
Block a user