Merge branch 'master' into jman13378-patch-1

This commit is contained in:
RockyHawk 2023-07-13 07:38:15 +10:00 committed by GitHub
commit 394b27604c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 52 deletions

View File

@ -117,7 +117,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,6 +1,6 @@
# |------------------------------------------------------------------------
# | CommandPanels Example File
# | By RockyHawk v3.1
# | By RockyHawk v3.1, Fixed by Minecraft ICT (ajh123)
# | https://www.spigotmc.org/resources/command-panels-custom-guis.67788/
# |------------------------------------------------------------------------
panels:
@ -23,127 +23,127 @@ panels:
- add-data= nextpage 1
item:
'10':
material: 'cps= $cp-player-online-%math_1+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_1+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_1+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_1+14*{cp-data-onlinepage}%$'
has0:
compare0: '$cp-player-online-%math_1+14*{cp-data-onlinepage}%$'
compare0: '$cp-player-online-%math_0:_1+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'11':
material: 'cps= $cp-player-online-%math_2+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_2+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_2+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_2+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_2+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_2+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'12':
material: 'cps= $cp-player-online-%math_3+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_3+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_3+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_3+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_3+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_3+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'13':
material: 'cps= $cp-player-online-%math_4+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_4+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_4+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_4+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_4+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_4+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'14':
material: 'cps= $cp-player-online-%math_5+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_5+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_5+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_5+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_5+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_5+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'15':
material: 'cps= $cp-player-online-%math_6+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_6+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_6+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_6+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_6+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_6+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'16':
material: 'cps= $cp-player-online-%math_7+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_7+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_7+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_7+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_7+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_7+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'19':
material: 'cps= $cp-player-online-%math_8+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_8+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_8+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_8+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_8+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_8+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'20':
material: 'cps= $cp-player-online-%math_9+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_9+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_9+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_9+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_9+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_9+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'21':
material: 'cps= $cp-player-online-%math_10+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_10+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_10+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_10+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_10+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_10+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'22':
material: 'cps= $cp-player-online-%math_11+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_11+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_11+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_11+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_11+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_11+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'23':
material: 'cps= $cp-player-online-%math_12+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_12+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_12+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_12+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_12+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_12+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'24':
material: 'cps= $cp-player-online-%math_13+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_13+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_13+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_13+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_13+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_13+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
name: '&7&l????'
'25':
material: 'cps= $cp-player-online-%math_14+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_14+14*{cp-data-onlinepage}%$'
material: 'cps= $cp-player-online-%math_0:_14+14*{cp-data-onlinepage}%$'
name: '&e$cp-player-online-%math_0:_14+14*{cp-data-onlinepage}%$'
has0:
compare0: '&e$cp-player-online-%math_14+14*{cp-data-onlinepage}%$'
compare0: '&e$cp-player-online-%math_0:_14+14*{cp-data-onlinepage}%$'
value0: 'Offline'
material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0=
stack: 1
@ -160,7 +160,7 @@ panels:
commands:
- math-data= onlinepage -1
- math-data= nextpage -1
- refresh
- open= example_middle_two
'6':
material: ARROW
stack: 1
@ -168,7 +168,7 @@ panels:
commands:
- 'math-data= onlinepage +1'
- 'math-data= nextpage +1'
- 'refresh'
- open= example_middle_two
'4':
material: OAK_SIGN
name: '&e&lOnline Players'
@ -177,4 +177,5 @@ panels:
- ''
- '&8Player Browser made by:'
- '&8TinyTank800'
- '&8MinecraftICT (ajh123)'

View File

@ -14,12 +14,16 @@ import org.bukkit.block.banner.PatternType;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.enchantments.EnchantmentWrapper;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.*;
import org.bukkit.inventory.meta.trim.ArmorTrim;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.map.MapCanvas;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
@ -28,10 +32,7 @@ import org.bukkit.potion.PotionType;
import javax.swing.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
public class ItemCreation {
@ -343,6 +344,29 @@ public class ItemCreation {
s = plugin.nbt.setNBT(s,key,itemSection.getString("nbt." + key));
}
}
// 1.20 Trim Feature for Player Armor
if(plugin.legacy.LOCAL_VERSION.greaterThanOrEqualTo(MinecraftVersions.v1_20) && itemSection.contains("trim")){
// trim: <Material> <Pattern>
String trim = itemSection.getString("trim");
String[] trimList = trim.split("\\s");
if(trimList.length == 2){
String trimMaterialString = trimList[0].toLowerCase();
String trimPatternString = trimList[1].toLowerCase();
// Check if Material and Pattern are valid and the itemstack is an armor piece
if(isTrimMaterial(trimMaterialString) && isTrimPattern(trimPatternString) && isArmor(s)){
// Getting the correct Pattern and Material - Seems to be experimental this way
// Material and Pattern don't have a valueOf-function to get them the easier way.
TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(Objects.requireNonNull(NamespacedKey.fromString("minecraft:" + trimMaterialString)));
TrimPattern trimPattern = Registry.TRIM_PATTERN.get(Objects.requireNonNull(NamespacedKey.fromString("minecraft:" + trimPatternString)));
ArmorMeta armorMeta = (ArmorMeta) s.getItemMeta();
armorMeta.setTrim(new ArmorTrim(trimMaterial, trimPattern));
s.setItemMeta(armorMeta);
}
}
}
if (itemSection.contains("stack")) {
//change the stack amount (placeholders accepted)
s.setAmount((int)Double.parseDouble(Objects.requireNonNull(plugin.tex.placeholders(panel,position,p,itemSection.getString("stack")))));
@ -513,4 +537,20 @@ public class ItemCreation {
}
return true;
}
private boolean isTrimMaterial(String material){
List<String> availableMaterial = Arrays.asList("AMETHYST",
"COPPER", "DIAMOND", "EMERALD", "GOLD", "IRON","LAPIS", "NETHERITE", "QUARTZ", "REDSTONE");
return availableMaterial.contains(material.toUpperCase());
}
private boolean isTrimPattern(String pattern){
List<String> availablePattern = Arrays.asList("COAST",
"DUNE", "EYE", "HOST", "RAISER", "RIB","SENTRY", "SHAPER", "SILENCE", "SNOUT", "SPIRE", "TIDE","VEX", "WARD", "WAYFINDER", "WILD");
return availablePattern.contains(pattern.toUpperCase());
}
private boolean isArmor(ItemStack stack){
return EnchantmentTarget.ARMOR.includes(stack);
}
}

View File

@ -1,6 +1,6 @@
package me.rockyhawk.commandpanels.classresources.placeholders;
import com.bencodez.votingplugin.VotingPluginHooks;
import com.earth2me.essentials.Essentials;
import me.realized.tokenmanager.api.TokenManager;
import me.rockyhawk.commandpanels.CommandPanels;
@ -377,7 +377,7 @@ public class Placeholders {
}
if (plugin.getServer().getPluginManager().isPluginEnabled("VotingPlugin")) {
if(identifier.equals("votingplugin-points")) {
return String.valueOf(plugin.votingPlugin.getUserManager().getVotingPluginUser(p).getPoints());
return String.valueOf(VotingPluginHooks.getInstance().getUserManager().getVotingPluginUser(p).getPoints());
}
}
//end nodes with PlaceHolders