Tweaks and bug testing

This commit is contained in:
rockyhawk64 2025-03-30 22:55:20 +11:00
parent a13da8a4a0
commit 2f5a2c68f8
6 changed files with 10 additions and 15 deletions

View File

@ -31,7 +31,6 @@ config:
disabled: '&cThis feature is disabled in your plugin config.'
input:
input-cancel: cancel
input-cancelled: '&cCancelled!'
max-input-length: -1
input-message:
- '&aEnter Input for Command'

View File

@ -74,7 +74,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;

View File

@ -146,8 +146,8 @@ public class Utils implements Listener {
//Check for cancel player input events.
List<String> cancelCommands = null;
if(panel.getConfig().contains("item." + foundSlot + section + ".player-canceled-input")){
cancelCommands = panel.getConfig().getStringList("item." + foundSlot + section + ".player-canceled-input");
if(panel.getConfig().contains("item." + foundSlot + section + ".player-input-cancel")){
cancelCommands = panel.getConfig().getStringList("item." + foundSlot + section + ".player-input-cancel");
}
// Check for valid click types in player inputs
@ -165,7 +165,7 @@ public class Utils implements Listener {
// Only process player input if we have valid inputs for this click type
if(validClickFound) {
plugin.inputUtils.playerInput.put(p, new PlayerInput(panel, filteredPlayerInputs, cancelCommands, click));
plugin.inputUtils.sendMessage(panel, position, p);
plugin.inputUtils.sendInputMessage(panel, position, p);
}
}

View File

@ -290,15 +290,12 @@ public class ItemCreation {
if(enchantment.equalsIgnoreCase("true")) {
EnchantMeta.addEnchant(Enchantment.KNOCKBACK, 1, false);
EnchantMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
continue;
break;
}
String enchant = enchantment.split("\\s")[0];
NamespacedKey key;
if (enchant.contains(":")) {
key = NamespacedKey.fromString(enchant);
} else {
key = NamespacedKey.minecraft(enchant);
}
NamespacedKey key = enchant.contains(":") ?
NamespacedKey.fromString(enchant) :
NamespacedKey.minecraft(enchant);
EnchantMeta.addEnchant(Objects.requireNonNull(EnchantmentWrapper.getByKey(key)), Integer.parseInt(enchantment.split("\\s")[1]), true);
}
s.setItemMeta(EnchantMeta);

View File

@ -157,7 +157,6 @@ public class SpecialTags implements Listener {
final int delayTicks = Integer.parseInt(e.args[0]);
final String staticValue = e.raw[1];
final String parsedValue = plugin.tex.placeholders(e.panel, e.pos, e.p, e.args[1].trim());
e.p.sendMessage(staticValue + " " + parsedValue);
String finalCommand = String.join(" ",e.args).replaceFirst(e.args[0],"").replaceFirst(e.args[1],"").trim();
new BukkitRunnable() {
@Override

View File

@ -27,7 +27,6 @@ public class UserInputUtils implements Listener {
if(playerInput.containsKey(e.getPlayer())){
e.setCancelled(true);
if(e.getMessage().equalsIgnoreCase(plugin.config.getString("input.input-cancel"))){
e.getPlayer().sendMessage(plugin.tex.colour( Objects.requireNonNull(plugin.config.getString("input.input-cancelled"))));
if(playerInput.get(e.getPlayer()).cancelCommands != null){
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
@ -75,11 +74,13 @@ public class UserInputUtils implements Listener {
playerInput.remove(e.getPlayer());
}
public void sendMessage(Panel panel, PanelPosition pos, Player p){
public void sendInputMessage(Panel panel, PanelPosition pos, Player p){
List<String> inputMessages;
if(panel.getConfig().contains("custom-messages.input-message")){
//For input-message custom from in the panel
inputMessages = new ArrayList<>(panel.getConfig().getStringList("custom-messages.input-message"));
}else{
//For input-message from the config
inputMessages = new ArrayList<>(plugin.config.getStringList("input.input-message"));
}
for (String temp : inputMessages) {