mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-28 19:39:22 +00:00
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa0ba538ba | ||
|
|
1f4b7159ed | ||
|
|
29ba89deeb | ||
|
|
76025bc881 | ||
|
|
25aff21177 | ||
|
|
79c4270737 | ||
|
|
ccc9837c51 | ||
|
|
5d86b4161b | ||
|
|
b1604bcb32 | ||
|
|
86a6e73a8f | ||
|
|
62c5555eb0 | ||
|
|
16b2d2eb28 | ||
|
|
4d2ab8d59b | ||
|
|
bdf297a6cb | ||
|
|
8835ffbed2 | ||
|
|
5a74db19d1 | ||
|
|
f86fb4fd9d | ||
|
|
b794bc9fa0 | ||
|
|
7667c6b992 | ||
|
|
e469b725bc | ||
|
|
07fcfdf375 | ||
|
|
79e55173ac | ||
|
|
b27ebd78b9 | ||
|
|
df23fcf4dd | ||
|
|
07f5cd1d71 | ||
|
|
2245d9e50e | ||
|
|
9f2913e0a2 | ||
|
|
f16fcb6220 | ||
|
|
f99d05017d | ||
|
|
eb65569c78 | ||
|
|
374aba5da6 | ||
|
|
ad40b2fc45 | ||
|
|
9827c839eb | ||
|
|
1cd9169ffc | ||
|
|
a9ce849c78 | ||
|
|
8840944711 | ||
|
|
37c6ad2cf9 | ||
|
|
7368b7a204 | ||
|
|
e96e5ca5c7 | ||
|
|
aaa1513219 | ||
|
|
c2f1ba06b5 | ||
|
|
349b4fb7bd | ||
|
|
bfd5736781 | ||
|
|
82e6f61469 | ||
|
|
208689f5db | ||
|
|
e504b53c8b | ||
|
|
816ae80f45 | ||
|
|
ea575d7dab | ||
|
|
2e9878dfd0 | ||
|
|
ffbe0d4e6c | ||
|
|
e73c3feb29 | ||
|
|
8f63e4b09e | ||
|
|
10b3b5c40c | ||
|
|
107a67dcab | ||
|
|
efd0b0d46d | ||
|
|
54f62474ec | ||
|
|
cec260b708 | ||
|
|
f8b508a7df | ||
|
|
daaf8c7170 | ||
|
|
e13a7531b2 | ||
|
|
ef5b811f22 | ||
|
|
ac2d4c61c2 | ||
|
|
ac6fe76559 | ||
|
|
2f9f08e182 | ||
|
|
97e1dbefed | ||
|
|
49dfaaa893 | ||
|
|
a03d0c8e4c | ||
|
|
866be27aef | ||
|
|
bdf0963120 | ||
|
|
f2cf0b5361 | ||
|
|
a79a05ba08 | ||
|
|
b6e90e4927 | ||
|
|
2f8e81d984 | ||
|
|
48ebf3e42a | ||
|
|
840e4cce83 | ||
|
|
05750f9187 | ||
|
|
f99f6a7855 | ||
|
|
77ce758092 | ||
|
|
58b4f8c4a9 | ||
|
|
82067662b4 | ||
|
|
55313e2879 | ||
|
|
e21a4c7d9c | ||
|
|
7e4489c6af | ||
|
|
06e8448aa6 | ||
|
|
6a7933e8d2 | ||
|
|
b36091008e | ||
|
|
04f7a746b8 | ||
|
|
232e19ad8c | ||
|
|
d9f19aaf9c | ||
|
|
ad9b1573c2 | ||
|
|
f53f11d0c9 | ||
|
|
68934afd9b | ||
|
|
691b3d6006 | ||
|
|
0b1952f098 | ||
|
|
55ffe61298 | ||
|
|
cf56dca01a | ||
|
|
5902c7da8d | ||
|
|
a83b07807e | ||
|
|
1f05ce50e2 | ||
|
|
303b52ff07 | ||
|
|
43744fc3dd | ||
|
|
d1deb7322d | ||
|
|
f60f6bf707 | ||
|
|
d254268e17 | ||
|
|
ca73d813f4 |
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Auxilor Community Discord
|
||||
url: https://discord.gg/ZcwpSsE/
|
||||
about: Join the Auxilor discord to get help from support staff and the general community!
|
||||
- name: The most common issues people have
|
||||
url: https://github.com/Auxilor/eco/issues/78
|
||||
about: Check the list of known common issues to see if your issue has already been solved
|
||||
31
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: Report a Bug
|
||||
about: Report an issue with the plugin
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Server Information (please complete the following information):**
|
||||
- Version: (output of `/ver` command)
|
||||
- Version of plugin and eco (`/ver eco`, `/ver <plugin>`)
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/request-a-feature.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/request-a-feature.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Request a Feature
|
||||
about: Suggest an idea for this plugin
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,6 +1,6 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<img src="https://i.imgur.com/co0zeyJ.png" alt="Reforges logo" width="256">
|
||||
<img src="https://i.imgur.com/wMgkc0e.png" alt="Reforges logo" width="256">
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
|
||||
20
build.gradle
20
build.gradle
@@ -4,7 +4,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.18.1'
|
||||
implementation 'com.willfp:libreforge:3.0.0'
|
||||
compileOnly 'com.willfp:eco:6.34.0'
|
||||
implementation 'com.willfp:libreforge:3.34.1'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
|
||||
@@ -54,7 +54,7 @@ allprojects {
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.20'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
|
||||
|
||||
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
|
||||
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.21'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
@@ -104,3 +104,15 @@ archivesBaseName = project.name
|
||||
version = findProperty("version")
|
||||
|
||||
build.dependsOn shadowJar
|
||||
|
||||
task buyThePlugins {
|
||||
dependsOn subprojects.build
|
||||
|
||||
doLast {
|
||||
println 'If you like the plugin, please consider buying it on Spigot or Polymart!'
|
||||
println 'Spigot: https://www.spigotmc.org/resources/authors/auxilor.507394/'
|
||||
println 'Polymart: https://polymart.org/user/auxilor.1107/'
|
||||
println 'Buying gives you access to support and the plugin auto-updater, and it allows me to keep developing plugins.'
|
||||
}
|
||||
}
|
||||
build.finalizedBy buyThePlugins
|
||||
@@ -6,7 +6,7 @@ dependencies {
|
||||
compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
|
||||
compileOnly 'com.willfp:EcoSkills:1.4.0'
|
||||
compileOnly 'com.willfp:Talismans:4.6.0'
|
||||
compileOnly 'com.willfp:Talismans:5.28.2'
|
||||
compileOnly 'com.github.Archy-X:AureliumSkills:Beta1.2.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,9 @@ public class ReforgesPlugin extends LibReforgePlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getMinimumEcoVersion() {
|
||||
return "6.19.0";
|
||||
return "6.33.0";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.willfp.eco.core.config.interfaces.Config;
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||
import com.willfp.libreforge.chains.EffectChains;
|
||||
import com.willfp.reforges.ReforgesPlugin;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -55,6 +56,10 @@ public class Reforges {
|
||||
*/
|
||||
@ConfigUpdater
|
||||
public static void update(@NotNull final ReforgesPlugin plugin) {
|
||||
for (Config config : plugin.getReforgesYml().getSubsections("chains")) {
|
||||
EffectChains.compile(config, "Chains");
|
||||
}
|
||||
|
||||
for (Reforge reforge : values()) {
|
||||
removeReforge(reforge);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.gui.menu.Menu;
|
||||
import com.willfp.eco.core.gui.slot.Slot;
|
||||
import com.willfp.eco.core.integrations.economy.EconomyManager;
|
||||
import com.willfp.reforges.reforges.PriceMultipliers;
|
||||
import com.willfp.reforges.reforges.Reforge;
|
||||
import com.willfp.reforges.reforges.meta.ReforgeTarget;
|
||||
import org.bukkit.Sound;
|
||||
@@ -72,16 +73,19 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
if (reforge.getRequiresStone() && reforge.getStonePrice() != -1) {
|
||||
cost = reforge.getStonePrice();
|
||||
}
|
||||
cost *= PriceMultipliers.getForPlayer(player).getMultiplier();
|
||||
|
||||
if (!EconomyManager.hasAmount(player, cost)) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.insufficient-money-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -90,15 +94,17 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
int xpCost = this.getPlugin().getConfigYml().getInt("reforge.xp-cost");
|
||||
int reforges = ReforgeUtils.getReforges(toReforge);
|
||||
xpCost *= Math.pow(this.getPlugin().getConfigYml().getDouble("reforge.cost-exponent"), reforges);
|
||||
xpCost *= PriceMultipliers.getForPlayer(player).getMultiplier();
|
||||
if (player.getLevel() < xpCost) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-xp"));
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.insufficient-money-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -120,19 +126,25 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
stone.setItemMeta(null);
|
||||
stone.setAmount(0);
|
||||
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.stone-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.stone-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.stone-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.stone-sound.id").toUpperCase()),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.stone-sound.pitch")
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.sound.pitch")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,10 +133,12 @@ public class ReforgeLookup {
|
||||
player.getInventory().getItemInMainHand(),
|
||||
ReforgeTarget.Slot.HANDS
|
||||
));
|
||||
registerProvider(player -> Map.of(
|
||||
player.getInventory().getItemInOffHand(),
|
||||
ReforgeTarget.Slot.HANDS
|
||||
));
|
||||
if (!PLUGIN.getConfigYml().getBool("no-offhand")) {
|
||||
registerProvider(player -> Map.of(
|
||||
player.getInventory().getItemInOffHand(),
|
||||
ReforgeTarget.Slot.HANDS
|
||||
));
|
||||
}
|
||||
registerProvider(player -> {
|
||||
Map<ItemStack, ReforgeTarget.Slot> items = new HashMap<>();
|
||||
for (ItemStack stack : player.getInventory().getArmorContents()) {
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.willfp.reforges.commands
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.command.impl.Subcommand
|
||||
import com.willfp.reforges.reforges.Reforges
|
||||
import com.willfp.reforges.reforges.util.ReforgeUtils
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.util.StringUtil
|
||||
|
||||
class CommandApply(
|
||||
plugin: EcoPlugin
|
||||
) : Subcommand(plugin, "apply", "reforges.command.apply", false) {
|
||||
override fun onExecute(sender: CommandSender, args: MutableList<String>) {
|
||||
if (args.isEmpty()) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("needs-reforge"))
|
||||
return
|
||||
}
|
||||
|
||||
val reforge = Reforges.getByKey(args[0].lowercase())
|
||||
|
||||
if (reforge == null) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-reforge"))
|
||||
return
|
||||
}
|
||||
|
||||
if (sender is Player) {
|
||||
val item = sender.inventory.itemInMainHand
|
||||
ReforgeUtils.setReforge(item, reforge)
|
||||
sender.sendMessage(
|
||||
plugin.langYml.getMessage("applied-reforge")
|
||||
.replace("%reforge%", reforge.name)
|
||||
)
|
||||
} else {
|
||||
if (args.size < 2) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("needs-player"))
|
||||
return
|
||||
}
|
||||
|
||||
val player = Bukkit.getPlayer(args[1])
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
||||
return
|
||||
}
|
||||
|
||||
ReforgeUtils.setReforge(player.inventory.itemInMainHand, reforge)
|
||||
sender.sendMessage(
|
||||
plugin.langYml.getMessage("applied-reforge")
|
||||
.replace("%reforge%", reforge.name)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||
val completions = mutableListOf<String>()
|
||||
if (args.isEmpty()) {
|
||||
// Currently, this case is not ever reached
|
||||
return Reforges.values().map { it.id }
|
||||
}
|
||||
if (args.size == 1) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[0],
|
||||
Reforges.values().map { it.id },
|
||||
completions
|
||||
)
|
||||
completions.sort()
|
||||
return completions
|
||||
}
|
||||
if (args.size == 2) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
Bukkit.getOnlinePlayers().map { it.name },
|
||||
completions
|
||||
)
|
||||
completions.sort()
|
||||
return completions
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,14 @@ class CommandOpen(
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
||||
return
|
||||
}
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
if (plugin.configYml.getBool("gui.open-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
}
|
||||
menu.open(player)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@ class CommandReforge(
|
||||
) : PluginCommand(plugin, "reforge", "reforges.command.reforge", true) {
|
||||
override fun onExecute(player: CommandSender, args: List<String>) {
|
||||
player as Player
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
if (plugin.configYml.getBool("gui.open-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
}
|
||||
menu.open(player)
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ class CommandReforges(plugin: EcoPlugin) : PluginCommand(plugin, "reforges", "re
|
||||
addSubcommand(CommandReload(plugin))
|
||||
.addSubcommand(CommandGive(plugin))
|
||||
.addSubcommand(CommandOpen(plugin))
|
||||
.addSubcommand(CommandApply(plugin))
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.willfp.reforges.display
|
||||
|
||||
import com.willfp.eco.core.Prerequisite
|
||||
import com.willfp.eco.core.display.Display
|
||||
import com.willfp.eco.core.display.DisplayModule
|
||||
import com.willfp.eco.core.display.DisplayPriority
|
||||
@@ -10,7 +9,6 @@ import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.reforges.ReforgesPlugin
|
||||
import com.willfp.reforges.reforges.meta.ReforgeTarget
|
||||
import com.willfp.reforges.reforges.util.ReforgeUtils
|
||||
import net.kyori.adventure.text.Component
|
||||
import net.kyori.adventure.text.TextReplacementConfig
|
||||
import net.kyori.adventure.text.format.TextDecoration
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
|
||||
@@ -19,7 +17,7 @@ import org.bukkit.inventory.meta.SkullMeta
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin, DisplayPriority.HIGHEST) {
|
||||
class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin, DisplayPriority.HIGH) {
|
||||
/**
|
||||
* Deprecated
|
||||
*/
|
||||
@@ -82,43 +80,46 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
|
||||
}.toList()
|
||||
lore.addAll(0, stoneLore)
|
||||
}
|
||||
|
||||
if (reforge != null) {
|
||||
if (plugin.configYml.getBool("reforge.display-in-lore")) {
|
||||
val addLore: MutableList<String> = ArrayList()
|
||||
addLore.add(" ")
|
||||
addLore.add(reforge.name)
|
||||
for (string in plugin.configYml.getFormattedStrings("reforge.reforged-prefix")) {
|
||||
addLore.add(Display.PREFIX + string.replace("%reforge%", reforge.name))
|
||||
}
|
||||
addLore.addAll(reforge.description)
|
||||
addLore.replaceAll { "${Display.PREFIX}$it" }
|
||||
lore.addAll(addLore)
|
||||
}
|
||||
if (plugin.configYml.getBool("reforge.display-in-name") && Prerequisite.HAS_PAPER.isMet) {
|
||||
val displayName = (meta.displayName() ?: Component.translatable(itemStack)).replaceText(replacement)
|
||||
meta.persistentDataContainer.set(
|
||||
if (plugin.configYml.getBool("reforge.display-in-name")) {
|
||||
val displayName = fastItemStack.displayNameComponent.replaceText(replacement)
|
||||
|
||||
val newName = StringUtils.toComponent("${reforge.name} ")
|
||||
.decoration(TextDecoration.ITALIC, false).append(displayName)
|
||||
|
||||
fastItemStack.setDisplayName(newName)
|
||||
|
||||
fastItemStack.persistentDataContainer.set(
|
||||
originalComponentKey,
|
||||
PersistentDataType.STRING,
|
||||
serializer.serialize(displayName)
|
||||
)
|
||||
val newName = StringUtils.toComponent("${reforge.name} ")
|
||||
.decoration(TextDecoration.ITALIC, false).append(displayName)
|
||||
meta.displayName(newName)
|
||||
}
|
||||
}
|
||||
itemStack.itemMeta = meta
|
||||
|
||||
fastItemStack.lore = lore
|
||||
}
|
||||
|
||||
override fun revert(itemStack: ItemStack) {
|
||||
ReforgeTarget.getForItem(itemStack) ?: return
|
||||
|
||||
val meta = itemStack.itemMeta ?: return
|
||||
val fis = FastItemStack.wrap(itemStack)
|
||||
|
||||
if (plugin.configYml.getBool("reforge.display-in-name") && Prerequisite.HAS_PAPER.isMet) {
|
||||
if (plugin.configYml.getBool("reforge.display-in-name")) {
|
||||
val originalName =
|
||||
meta.persistentDataContainer.get(originalComponentKey, PersistentDataType.STRING) ?: return
|
||||
meta.persistentDataContainer.remove(originalComponentKey)
|
||||
meta.displayName(serializer.deserialize(originalName).replaceText(replacement))
|
||||
fis.persistentDataContainer.get(originalComponentKey, PersistentDataType.STRING) ?: return
|
||||
fis.persistentDataContainer.remove(originalComponentKey)
|
||||
fis.setDisplayName(serializer.deserialize(originalName).replaceText(replacement))
|
||||
}
|
||||
|
||||
itemStack.itemMeta = meta
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@ package com.willfp.reforges.gui
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import com.willfp.eco.core.drops.DropQueue
|
||||
import com.willfp.eco.core.gui.menu
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.slot
|
||||
import com.willfp.eco.core.gui.slot.FillerMask
|
||||
import com.willfp.eco.core.gui.slot.MaskMaterials
|
||||
import com.willfp.eco.core.gui.slot.MaskItems
|
||||
import com.willfp.eco.core.gui.slot.Slot
|
||||
import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.core.items.builder.ItemStackBuilder
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.reforges.ReforgesPlugin
|
||||
import com.willfp.reforges.reforges.PriceMultipliers
|
||||
import com.willfp.reforges.reforges.util.ReforgeHandler
|
||||
import com.willfp.reforges.reforges.util.ReforgeStatus
|
||||
import com.willfp.reforges.reforges.util.ReforgeUtils
|
||||
@@ -32,9 +36,7 @@ object ReforgeGUI {
|
||||
fun update(plugin: EcoPlugin) {
|
||||
val handler = ReforgeHandler(plugin)
|
||||
|
||||
val activatorSlot = Slot.builder(
|
||||
ItemStack(Material.ANVIL)
|
||||
).apply {
|
||||
val activatorSlot = slot(ItemStack(Material.ANVIL)) {
|
||||
setModifier { player, menu, previous ->
|
||||
val meta = previous.itemMeta ?: return@setModifier
|
||||
|
||||
@@ -44,7 +46,8 @@ object ReforgeGUI {
|
||||
status == ReforgeStatus.ALLOW || (status == ReforgeStatus.ALLOW_STONE && specialCost < 0) -> {
|
||||
val amountOfReforges = ReforgeUtils.getReforges(menu.getCaptiveItems(player)[0])
|
||||
plugin.configYml.getDouble("reforge.cost") *
|
||||
plugin.configYml.getDouble("reforge.cost-exponent").pow(amountOfReforges)
|
||||
plugin.configYml.getDouble("reforge.cost-exponent").pow(amountOfReforges) *
|
||||
PriceMultipliers.getForPlayer(player).multiplier
|
||||
}
|
||||
status == ReforgeStatus.ALLOW_STONE -> {
|
||||
specialCost
|
||||
@@ -56,6 +59,7 @@ object ReforgeGUI {
|
||||
if (status == ReforgeStatus.ALLOW) {
|
||||
val item = menu.getCaptiveItems(player)[0]
|
||||
val reforges = ReforgeUtils.getReforges(item)
|
||||
xpCost *= PriceMultipliers.getForPlayer(player).multiplier.toInt()
|
||||
xpCost *= plugin.configYml.getDouble("reforge.cost-exponent").pow(reforges.toDouble()).toInt()
|
||||
}
|
||||
|
||||
@@ -106,24 +110,21 @@ object ReforgeGUI {
|
||||
previous.itemMeta = meta
|
||||
}
|
||||
onLeftClick(handler::handleReforgeClick)
|
||||
}.build()
|
||||
}
|
||||
|
||||
val maskPattern = plugin.configYml.getStrings("gui.mask.pattern", false).toTypedArray()
|
||||
val maskPattern = plugin.configYml.getStrings("gui.mask.pattern").toTypedArray()
|
||||
|
||||
val maskMaterials = plugin.configYml.getStrings("gui.mask.materials", false)
|
||||
.mapNotNull { Material.getMaterial(it.uppercase()) }
|
||||
val maskItems = plugin.configYml.getStrings("gui.mask.materials")
|
||||
.mapNotNull { Items.lookup(it) }
|
||||
.toTypedArray()
|
||||
|
||||
val allowMaterial =
|
||||
Material.getMaterial(plugin.configYml.getString("gui.show-allowed.allow-material", false).uppercase())!!
|
||||
val denyMaterial =
|
||||
Material.getMaterial(plugin.configYml.getString("gui.show-allowed.deny-material", false).uppercase())!!
|
||||
val closeMaterial =
|
||||
Material.getMaterial(plugin.configYml.getString("gui.close.material", false).toUpperCase())!!
|
||||
val allowItem = Items.lookup(plugin.configYml.getString("gui.show-allowed.allow-material")).item
|
||||
val denyItem = Items.lookup(plugin.configYml.getString("gui.show-allowed.deny-material")).item
|
||||
val closeItem = Items.lookup(plugin.configYml.getString("gui.close.material")).item
|
||||
|
||||
menu = Menu.builder(plugin.configYml.getInt("gui.rows")).apply {
|
||||
menu = menu(plugin.configYml.getInt("gui.rows")) {
|
||||
setTitle(plugin.langYml.getFormattedString("menu.title"))
|
||||
setMask(FillerMask(MaskMaterials(*maskMaterials), *maskPattern))
|
||||
setMask(FillerMask(MaskItems(*maskItems), *maskPattern))
|
||||
modfiy { builder ->
|
||||
val slot = Slot.builder(
|
||||
ItemStackBuilder(Material.BLACK_STAINED_GLASS_PANE)
|
||||
@@ -136,9 +137,11 @@ object ReforgeGUI {
|
||||
).status
|
||||
|
||||
if (status == ReforgeStatus.ALLOW || status == ReforgeStatus.ALLOW_STONE) {
|
||||
previous.type = allowMaterial
|
||||
previous.type = allowItem.type
|
||||
previous.itemMeta = allowItem.itemMeta
|
||||
} else {
|
||||
previous.type = denyMaterial
|
||||
previous.type = denyItem.type
|
||||
previous.itemMeta = denyItem.itemMeta
|
||||
}
|
||||
}
|
||||
}.build()
|
||||
@@ -172,7 +175,7 @@ object ReforgeGUI {
|
||||
plugin.configYml.getInt("gui.close.location.row"),
|
||||
plugin.configYml.getInt("gui.close.location.column"),
|
||||
Slot.builder(
|
||||
ItemStackBuilder(closeMaterial)
|
||||
ItemStackBuilder(closeItem)
|
||||
.setDisplayName(plugin.langYml.getFormattedString("menu.close"))
|
||||
.build()
|
||||
).onLeftClick { event, _, _ ->
|
||||
@@ -183,8 +186,9 @@ object ReforgeGUI {
|
||||
DropQueue(event.player as Player)
|
||||
.addItems(menu.getCaptiveItems(event.player as Player))
|
||||
.setLocation(event.player.eyeLocation)
|
||||
.forceTelekinesis()
|
||||
.push()
|
||||
}
|
||||
}.build()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ object TalismansIntegration : Integration {
|
||||
fun registerProvider() {
|
||||
ReforgeLookup.registerProvider { player ->
|
||||
val provided = mutableMapOf<ItemStack, ReforgeTarget.Slot>()
|
||||
for (itemStack in TalismanChecks.getTalismanItemsOnPlayer(player, true)) {
|
||||
for (itemStack in TalismanChecks.getTalismanItemsOnPlayer(player)) {
|
||||
provided[itemStack] = ReforgeTarget.Slot.ANY
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.willfp.reforges.reforges
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.permissions.Permission
|
||||
import org.bukkit.permissions.PermissionDefault
|
||||
|
||||
data class PriceMultiplier(
|
||||
val permission: String,
|
||||
val multiplier: Double,
|
||||
val priority: Int
|
||||
) {
|
||||
init {
|
||||
if (Bukkit.getPluginManager().getPermission(permission) == null) {
|
||||
Bukkit.getPluginManager().addPermission(
|
||||
Permission(
|
||||
permission,
|
||||
"Gives a ${multiplier}x price multiplier when reforging",
|
||||
PermissionDefault.FALSE
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.willfp.reforges.reforges
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
@Suppress("UNUSED")
|
||||
object PriceMultipliers {
|
||||
private val REGISTRY = mutableListOf<PriceMultiplier>()
|
||||
private val NO_MULTIPLIER = PriceMultiplier("none", 1.0, 0)
|
||||
|
||||
/**
|
||||
* Get the permission multiplier for a given player.
|
||||
*
|
||||
* @param player The player.
|
||||
* @return The multiplier.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getForPlayer(player: Player): PriceMultiplier {
|
||||
var current = NO_MULTIPLIER
|
||||
|
||||
for (multiplier in REGISTRY) {
|
||||
if (multiplier.priority < current.priority) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (!player.hasPermission(multiplier.permission)) {
|
||||
continue
|
||||
}
|
||||
|
||||
current = multiplier
|
||||
}
|
||||
|
||||
return current
|
||||
}
|
||||
|
||||
/**
|
||||
* List of all registered multipliers.
|
||||
*
|
||||
* @return The multipliers.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun values(): List<PriceMultiplier> {
|
||||
return REGISTRY.toList()
|
||||
}
|
||||
|
||||
@ConfigUpdater
|
||||
@JvmStatic
|
||||
fun update(plugin: EcoPlugin) {
|
||||
REGISTRY.clear()
|
||||
|
||||
for (config in plugin.configYml.getSubsections("price-multipliers")) {
|
||||
val multiplier = PriceMultiplier(
|
||||
config.getString("permission"),
|
||||
config.getDouble("multiplier"),
|
||||
config.getInt("priority")
|
||||
)
|
||||
REGISTRY.add(multiplier)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import com.willfp.reforges.ReforgesPlugin
|
||||
import com.willfp.reforges.reforges.meta.ReforgeTarget
|
||||
import com.willfp.reforges.reforges.util.ReforgeUtils
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import java.util.*
|
||||
import java.util.Objects
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class Reforge(
|
||||
@@ -67,7 +67,7 @@ class Reforge(
|
||||
plugin,
|
||||
"stone_" + this.id,
|
||||
stone,
|
||||
config.getStrings("stone.recipe", false)
|
||||
config.getStrings("stone.recipe")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,10 @@ class ReforgeArgParser : LookupArgParser {
|
||||
reforge == ReforgeUtils.getReforge(testMeta)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun serializeBack(meta: ItemMeta): String? {
|
||||
val reforge = ReforgeUtils.getReforge(meta) ?: return null
|
||||
|
||||
return "reforge:${reforge.id}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,19 @@
|
||||
#
|
||||
|
||||
discover-recipes: true
|
||||
no-offhand: false # Restart your server after this option, doesn't work with /reforges reload
|
||||
|
||||
# If a reward allows permission multipliers, the weights
|
||||
# will be multiplied by highest-priority multiplier that a player
|
||||
# has permission for - i.e. if a player has both vip and mvp permissions,
|
||||
# than they'll have the mvp one applied as it has a higher priority.
|
||||
price-multipliers:
|
||||
- permission: reforges.mutliplier.vip
|
||||
multiplier: 0.8
|
||||
priority: 1
|
||||
- permission: reforges.mutliplier.mvp
|
||||
multiplier: 0.7
|
||||
priority: 2
|
||||
|
||||
gui:
|
||||
rows: 6
|
||||
@@ -105,18 +118,22 @@ gui:
|
||||
- '&7You cannot reforge this item!'
|
||||
|
||||
sound:
|
||||
enabled: true
|
||||
id: BLOCK_ANVIL_USE
|
||||
pitch: 1
|
||||
|
||||
open-sound:
|
||||
enabled: true
|
||||
id: BLOCK_ANVIL_PLACE
|
||||
pitch: 0.8
|
||||
|
||||
stone-sound:
|
||||
enabled: true
|
||||
id: ENTITY_ENDER_DRAGON_HURT
|
||||
pitch: 0.5
|
||||
|
||||
insufficient-money-sound:
|
||||
enabled: true
|
||||
id: ENTITY_VILLAGER_NO
|
||||
pitch: 0.8
|
||||
|
||||
@@ -133,7 +150,11 @@ reforge:
|
||||
- "&8This item can be reforged!"
|
||||
|
||||
display-in-lore: true
|
||||
display-in-name: true # Requires paper to be installed on the server
|
||||
display-in-name: true
|
||||
|
||||
reforged-prefix:
|
||||
- ""
|
||||
- "%reforge%"
|
||||
|
||||
cooldown:
|
||||
in-actionbar: true
|
||||
@@ -147,4 +168,29 @@ cannot-afford:
|
||||
sound:
|
||||
enabled: true
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
pitch: 0.5
|
||||
|
||||
cannot-afford-type:
|
||||
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"
|
||||
|
||||
use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements
|
||||
raytrace-distance: 80 # The distance that alt_click should check for a location
|
||||
block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes)
|
||||
|
||||
potions:
|
||||
icon:
|
||||
permanent: true
|
||||
triggered: true
|
||||
ambient:
|
||||
permanent: false
|
||||
triggered: true
|
||||
particles:
|
||||
permanent: false
|
||||
triggered: true
|
||||
@@ -14,6 +14,10 @@ messages:
|
||||
give-success: "Gave &a%reforge%&r reforge stone to &a%recipient%"
|
||||
on-cooldown: "&cThis reforge is on cooldown! &fTime left: &a%seconds% seconds"
|
||||
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%"
|
||||
invalid-reforge: "&cInvalid reforge!"
|
||||
needs-reforge: "&cYou must specify a reforge"
|
||||
cannot-transmit: "&cYou can't transmit here!"
|
||||
|
||||
menu:
|
||||
title: "Reforge Item"
|
||||
|
||||
@@ -15,8 +15,6 @@ softdepend:
|
||||
- AureliumSkills
|
||||
- PlayerPoints
|
||||
- Jobs
|
||||
libraries:
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
|
||||
|
||||
commands:
|
||||
reforges:
|
||||
@@ -40,6 +38,7 @@ permissions:
|
||||
reforges.command.reforges: true
|
||||
reforges.command.reforge: true
|
||||
reforges.command.give: true
|
||||
reforges.command.apply: true
|
||||
reforges.command.open: true
|
||||
|
||||
reforges.command.reload:
|
||||
@@ -57,3 +56,6 @@ permissions:
|
||||
reforges.command.open:
|
||||
description: Allows the user of /reforges open.
|
||||
default: op
|
||||
reforges.command.apply:
|
||||
description: Allows the user of /reforges apply.
|
||||
default: op
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
chains:
|
||||
- id: example_chain
|
||||
effects:
|
||||
- id: teleport
|
||||
- id: potion_effect
|
||||
args:
|
||||
effect: blindness
|
||||
level: 3
|
||||
duration: 30
|
||||
apply_to_player: true
|
||||
- id: send_message
|
||||
args:
|
||||
message: "&fYou have been teleported!"
|
||||
action_bar: true
|
||||
- id: play_sound
|
||||
args:
|
||||
sound: entity_dragon_fireball_explode
|
||||
pitch: 1.5
|
||||
volume: 4
|
||||
|
||||
reforges:
|
||||
- id: acute
|
||||
name: "<gradient:#4776E6>Acute</gradient:#8E54E9>"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 4.26.0
|
||||
version = 4.62.0
|
||||
plugin-name = Reforges
|
||||
Reference in New Issue
Block a user