9
0
mirror of https://github.com/Auxilor/Reforges.git synced 2025-12-28 19:39:22 +00:00

Compare commits

...

105 Commits

Author SHA1 Message Date
Auxilor
fa0ba538ba Updated eco/kotlin/libreforge 2022-04-20 11:47:29 +01:00
Auxilor
1f4b7159ed Updated libreforge 2022-04-16 15:48:33 +01:00
Auxilor
29ba89deeb Improved performance with new FIS API 2022-04-13 13:38:08 +01:00
Auxilor
76025bc881 Updated to 4.61.1 2022-04-12 11:34:24 +01:00
Auxilor
25aff21177 Updated to 4.61.1 2022-04-09 14:41:50 +01:00
Auxilor
79c4270737 Updated to 4.61.1 2022-04-06 14:20:12 +01:00
Auxilor
ccc9837c51 Updated to 4.61.1 2022-04-05 16:35:36 +01:00
Auxilor
5d86b4161b Fixed closing the GUI dropping items on ground 2022-04-05 16:35:25 +01:00
Auxilor
b1604bcb32 Updated libreforge 2022-04-04 10:25:18 +01:00
Auxilor
86a6e73a8f Fixed maskmaterials 2022-04-02 14:07:12 +01:00
Auxilor
62c5555eb0 Updated libreforge 2022-04-02 14:06:20 +01:00
Auxilor
16b2d2eb28 Updated libreforge 2022-03-31 20:53:37 +01:00
Auxilor
4d2ab8d59b Updated libreforge 2022-03-30 20:39:45 +01:00
Auxilor
bdf297a6cb Updated libreforge 2022-03-28 19:08:05 +01:00
Auxilor
8835ffbed2 Updated to 4.56.1 2022-03-27 13:29:17 +01:00
Auxilor
5a74db19d1 Added serializeBack to reforge arg parser 2022-03-27 13:28:59 +01:00
Auxilor
f86fb4fd9d Merge remote-tracking branch 'origin/master'
# Conflicts:
#	build.gradle
#	gradle.properties
2022-03-27 13:27:56 +01:00
Auxilor
b794bc9fa0 Updated libreforge 2022-03-25 09:34:54 +00:00
Auxilor
7667c6b992 Updated to 4.55.2 2022-03-22 16:37:01 +00:00
Auxilor
e469b725bc Fixed another deprecated method 2022-03-22 16:36:52 +00:00
Auxilor
07fcfdf375 Updated to 4.55.1 2022-03-22 16:34:38 +00:00
Auxilor
79e55173ac Fixed deprecated method use breaking eco compatibility 2022-03-22 16:34:29 +00:00
Auxilor
b27ebd78b9 Updated to 4.55.0 2022-03-21 10:49:35 +00:00
Auxilor
df23fcf4dd Updated libreforge to 3.27.1 2022-03-21 10:49:25 +00:00
Auxilor
07f5cd1d71 Added price multipliers 2022-03-21 10:48:51 +00:00
Auxilor
2245d9e50e Updated libreforge 2022-03-19 16:42:35 +00:00
Auxilor
9f2913e0a2 Updated libreforge 2022-03-17 09:00:24 +00:00
Auxilor
f16fcb6220 Updated libreforge 2022-03-15 22:37:54 +00:00
Auxilor
f99d05017d Updated to 4.52.2 2022-03-14 10:04:37 +00:00
Auxilor
eb65569c78 Reduced display priority 2022-03-14 10:04:14 +00:00
Auxilor
374aba5da6 Updated libreforge 2022-03-13 12:02:18 +00:00
Auxilor
ad40b2fc45 Updated libreforge 2022-03-12 12:30:07 +00:00
Auxilor
9827c839eb Updated libreforge 2022-03-10 19:53:03 +00:00
Auxilor
1cd9169ffc Updated libreforge 2022-03-09 12:51:55 +00:00
Will FP
a9ce849c78 Update README.md 2022-03-09 12:46:16 +00:00
Auxilor
8840944711 Updated libreforge 2022-03-08 20:27:30 +00:00
Auxilor
37c6ad2cf9 Updated libreforge 2022-03-07 14:03:00 +00:00
Auxilor
7368b7a204 Updated to 4.48.1 2022-03-06 20:53:10 +00:00
Auxilor
e96e5ca5c7 Updated talismans integration 2022-03-06 20:50:55 +00:00
Auxilor
aaa1513219 Updated talismans integration 2022-03-06 20:49:35 +00:00
Auxilor
c2f1ba06b5 Updated to 4.48.0 2022-03-06 12:43:10 +00:00
Auxilor
349b4fb7bd Added /reforges apply 2022-03-06 12:42:58 +00:00
Auxilor
bfd5736781 Updated libreforge 2022-03-04 13:33:33 +00:00
Auxilor
82e6f61469 Updated libreforge 2022-03-01 16:20:05 +00:00
Auxilor
208689f5db Updated libreforge 2022-02-28 10:32:54 +00:00
Auxilor
e504b53c8b Added no-offhand option 2022-02-25 11:48:12 +00:00
Auxilor
816ae80f45 Updated libreforge 2022-02-25 11:46:36 +00:00
Auxilor
ea575d7dab Updated libreforge 2022-02-20 17:24:40 +00:00
Auxilor
2e9878dfd0 Updated libreforge 2022-02-19 16:06:05 +00:00
Auxilor
ffbe0d4e6c Added messages to build.gradle 2022-02-18 15:09:33 +00:00
Auxilor
e73c3feb29 Updated libreforge 2022-02-18 14:34:54 +00:00
Auxilor
8f63e4b09e Updated libreforge 2022-02-15 16:47:24 +00:00
Auxilor
10b3b5c40c Updated libreforge 2022-02-14 17:16:10 +00:00
Auxilor
107a67dcab Updated libreforge 2022-02-13 15:39:35 +00:00
Auxilor
efd0b0d46d Updated libreforge 2022-02-12 10:50:55 +00:00
Auxilor
54f62474ec Updated libreforge 2022-02-10 11:01:19 +00:00
Auxilor
cec260b708 Updated libreforge 2022-02-09 20:26:30 +00:00
Auxilor
f8b508a7df Updated libreforge 2022-02-08 20:45:25 +00:00
Auxilor
daaf8c7170 Updated libreforge 2022-02-08 14:02:42 +00:00
Auxilor
e13a7531b2 Fixed dumbassery 2022-02-07 11:52:52 +00:00
Auxilor
ef5b811f22 Updated libreforge 2022-02-07 11:34:30 +00:00
Auxilor
ac2d4c61c2 Updated libreforge 2022-02-07 11:30:44 +00:00
Auxilor
ac6fe76559 Updated libreforge 2022-02-06 17:41:12 +00:00
Auxilor
2f9f08e182 Updated libreforge 2022-02-06 14:51:22 +00:00
Auxilor
97e1dbefed Updated libreforge 2022-02-05 14:16:47 +00:00
Auxilor
49dfaaa893 Updated libreforge 2022-02-05 13:40:01 +00:00
Auxilor
a03d0c8e4c Updated libreforge 2022-02-05 11:20:44 +00:00
Auxilor
866be27aef Updated libreforge 2022-02-04 18:47:28 +00:00
Auxilor
bdf0963120 Updated libreforge 2022-02-04 10:31:16 +00:00
Auxilor
f2cf0b5361 Updated to 4.38.1 2022-02-03 19:07:25 +00:00
Auxilor
a79a05ba08 Updated libreforge 2022-02-03 09:22:34 +00:00
Auxilor
b6e90e4927 Updated eco 2022-02-02 16:59:22 +00:00
Auxilor
2f8e81d984 Updated libreforge 2022-02-01 18:48:43 +00:00
Auxilor
48ebf3e42a Updated libreforge 2022-01-31 19:12:06 +00:00
Auxilor
840e4cce83 Updated libreforge 2022-01-31 17:53:46 +00:00
Auxilor
05750f9187 Updated libreforge 2022-01-30 18:10:21 +00:00
Auxilor
f99f6a7855 Updated libreforge 2022-01-29 21:50:37 +00:00
Auxilor
77ce758092 Updated libreforge 2022-01-29 11:23:14 +00:00
Auxilor
58b4f8c4a9 Updated libreforge 2022-01-28 19:01:46 +00:00
Auxilor
82067662b4 Updated libreforge 2022-01-28 11:09:12 +00:00
Auxilor
55313e2879 Updated libreforge 2022-01-27 18:48:17 +00:00
Auxilor
e21a4c7d9c Updated libreforge 2022-01-26 21:28:57 +00:00
Auxilor
7e4489c6af Updated libreforge 2022-01-26 11:46:30 +00:00
Will FP
06e8448aa6 Merge pull request #12
Item lookup system support and sound disabling options
2022-01-26 11:46:07 +00:00
Auxilor
6a7933e8d2 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	build.gradle
#	gradle.properties
2022-01-26 11:21:44 +00:00
Auxilor
b36091008e Added issue templates 2022-01-26 11:21:35 +00:00
_OfTeN_
04f7a746b8 Fixed open command broken from previous commit 2022-01-25 20:26:15 +03:00
Auxilor
232e19ad8c Updated libreforge 2022-01-24 19:38:47 +00:00
_OfTeN_
d9f19aaf9c Added item lookup system support to all GUI items (except mask materials) 2022-01-23 22:56:21 +03:00
_OfTeN_
ad9b1573c2 Added enabled: true/false option to every sound in the config 2022-01-23 21:52:17 +03:00
Auxilor
f53f11d0c9 Updated libreforge 2022-01-23 16:59:51 +00:00
Auxilor
68934afd9b Updated libreforge 2022-01-22 17:27:07 +00:00
Auxilor
691b3d6006 Updated libreforge 2022-01-22 12:04:50 +00:00
Auxilor
0b1952f098 Updated libreforge 2022-01-21 18:58:01 +00:00
Auxilor
55ffe61298 Updated libreforge 2022-01-21 09:05:31 +00:00
Will FP
cf56dca01a Merge pull request #11
Some people don't like hardcode values.
2022-01-19 19:10:49 +00:00
Auxilor
5902c7da8d Updated libreforge 2022-01-19 19:09:20 +00:00
Auxilor
a83b07807e Updated libreforge 2022-01-18 16:38:24 +00:00
Auxilor
1f05ce50e2 Updated libreforge 2022-01-18 08:30:28 +00:00
Auxilor
303b52ff07 Updated libreforge 2022-01-17 19:22:45 +00:00
Auxilor
43744fc3dd Updated libreforge 2022-01-17 10:05:28 +00:00
NicoNekoDev
d1deb7322d Some people don't like hardcode values. 2022-01-15 19:51:08 +02:00
Auxilor
f60f6bf707 Updated libreforge 2022-01-15 14:34:18 +00:00
Auxilor
d254268e17 Updated libreforge 2022-01-14 17:50:42 +00:00
Auxilor
ca73d813f4 Updated to 4.27.0 2022-01-13 21:25:08 +00:00
26 changed files with 439 additions and 94 deletions

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View 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
View 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.

View 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.

View File

@@ -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>

View File

@@ -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

View File

@@ -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'
}

View File

@@ -97,8 +97,9 @@ public class ReforgesPlugin extends LibReforgePlugin {
}
@Override
@NotNull
public String getMinimumEcoVersion() {
return "6.19.0";
return "6.33.0";
}
/**

View File

@@ -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);
}

View File

@@ -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")
);
}
}

View File

@@ -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()) {

View File

@@ -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()
}
}

View File

@@ -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)
}

View File

@@ -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)
}
}

View File

@@ -15,5 +15,6 @@ class CommandReforges(plugin: EcoPlugin) : PluginCommand(plugin, "reforges", "re
addSubcommand(CommandReload(plugin))
.addSubcommand(CommandGive(plugin))
.addSubcommand(CommandOpen(plugin))
.addSubcommand(CommandApply(plugin))
}
}

View File

@@ -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
}
}
}

View File

@@ -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()
}
}
}

View File

@@ -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
}

View File

@@ -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
)
)
}
}
}

View File

@@ -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)
}
}
}

View File

@@ -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")
)
}
}

View File

@@ -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}"
}
}

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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>"

View File

@@ -1,2 +1,2 @@
version = 4.26.0
version = 4.62.0
plugin-name = Reforges