mirror of
https://github.com/plexusorg/ItemizerX.git
synced 2024-11-22 04:05:01 +00:00
Reformat and add missing attribute
This commit is contained in:
parent
a07c68e4b3
commit
57be14698f
@ -5,17 +5,18 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Attributes {
|
public enum Attributes
|
||||||
|
{
|
||||||
MAX_HEALTH("generic.max_health", 0),
|
MAX_HEALTH("generic.max_health", 0),
|
||||||
FOLLOW_RANGE("generic.follow_range", 1),
|
FOLLOW_RANGE("generic.follow_range", 1),
|
||||||
KNOCKBACK_RESISTANCE("generic.knockback_resistance", 1),
|
KNOCKBACK_RESISTANCE("generic.knockback_resistance", 1),
|
||||||
MOVEMENT_SPEED("generic.movement_speed", 1),
|
MOVEMENT_SPEED("generic.movement_speed", 1),
|
||||||
|
FLYING_SPEED("generic.flying_speed", 1),
|
||||||
DAMAGE("generic.attack_damage", 0),
|
DAMAGE("generic.attack_damage", 0),
|
||||||
|
ATTACK_KNOCKBACK("generic.attack_knockback", 0),
|
||||||
|
ATTACK_SPEED("generic.attack_speed", 1),
|
||||||
ARMOR("generic.armor", 0),
|
ARMOR("generic.armor", 0),
|
||||||
ARMOR_TOUGHNESS("generic.armor_toughness", 0),
|
ARMOR_TOUGHNESS("generic.armor_toughness", 0),
|
||||||
FLYING_SPEED("generic.flying_speed", 1),
|
|
||||||
ATTACK_SPEED("generic.attack_speed", 1),
|
|
||||||
LUCK("generic.luck", 0),
|
LUCK("generic.luck", 0),
|
||||||
HORSE_JUMP("horse.jump_strength", 1),
|
HORSE_JUMP("horse.jump_strength", 1),
|
||||||
ZOMBIE_REINFORCEMENTS("zombie.spawn_reinforcements", 1);
|
ZOMBIE_REINFORCEMENTS("zombie.spawn_reinforcements", 1);
|
||||||
@ -23,27 +24,34 @@ public enum Attributes {
|
|||||||
public final String mcName;
|
public final String mcName;
|
||||||
public final int op;
|
public final int op;
|
||||||
|
|
||||||
Attributes(String mcName, int op) {
|
Attributes(String mcName, int op)
|
||||||
|
{
|
||||||
this.mcName = mcName;
|
this.mcName = mcName;
|
||||||
this.op = op;
|
this.op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Attributes get(String name) {
|
public static Attributes get(String name)
|
||||||
for (Attributes attr : values()) {
|
{
|
||||||
if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name)) {
|
for (Attributes attr : values())
|
||||||
|
{
|
||||||
|
if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAttributes() {
|
public static String getAttributes()
|
||||||
|
{
|
||||||
return StringUtils.join(values(), ", ");
|
return StringUtils.join(values(), ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getAttributeList() {
|
public static List<String> getAttributeList()
|
||||||
|
{
|
||||||
List<String> attributes = new ArrayList<>();
|
List<String> attributes = new ArrayList<>();
|
||||||
for (Attributes attr : values()) {
|
for (Attributes attr : values())
|
||||||
|
{
|
||||||
attributes.add(attr.name());
|
attributes.add(attr.name());
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
|
@ -5,40 +5,55 @@ import net.coreprotect.CoreProtectAPI;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class CoreProtectBridge {
|
public class CoreProtectBridge
|
||||||
|
{
|
||||||
|
|
||||||
public static CoreProtect cp = null;
|
public static CoreProtect cp = null;
|
||||||
public static CoreProtectAPI api = null;
|
public static CoreProtectAPI api = null;
|
||||||
public static boolean logged = false;
|
public static boolean logged = false;
|
||||||
|
|
||||||
public CoreProtect getCoreProtect() {
|
public CoreProtect getCoreProtect()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
final Plugin pl = Bukkit.getPluginManager().getPlugin("CoreProtect");
|
final Plugin pl = Bukkit.getPluginManager().getPlugin("CoreProtect");
|
||||||
if (pl instanceof CoreProtect) {
|
if (pl instanceof CoreProtect)
|
||||||
|
{
|
||||||
cp = (CoreProtect) pl;
|
cp = (CoreProtect) pl;
|
||||||
} else {
|
}
|
||||||
if (!logged) { // To stop the console log spam - not persistent on server restarts
|
else
|
||||||
|
{
|
||||||
|
if (!logged)
|
||||||
|
{ // To stop the console log spam - not persistent on server restarts
|
||||||
Bukkit.getLogger().info("CoreProtect not detected, some features will not be logged!");
|
Bukkit.getLogger().info("CoreProtect not detected, some features will not be logged!");
|
||||||
logged = true;
|
logged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreProtectAPI getAPI() {
|
public CoreProtectAPI getAPI()
|
||||||
|
{
|
||||||
final CoreProtect cp = getCoreProtect();
|
final CoreProtect cp = getCoreProtect();
|
||||||
|
|
||||||
if (cp != null && api == null) {
|
if (cp != null && api == null)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
api = cp.getAPI();
|
api = cp.getAPI();
|
||||||
if (!cp.isEnabled() || !api.isEnabled()) {
|
if (!cp.isEnabled() || !api.isEnabled())
|
||||||
|
{
|
||||||
Bukkit.getLogger().info("CoreProtect is disabled, some features will not be logged!");
|
Bukkit.getLogger().info("CoreProtect is disabled, some features will not be logged!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package dev.plex.itemizerx;
|
package dev.plex.itemizerx;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -27,6 +23,11 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ItemizerXCommand implements CommandExecutor, ItemizerXBase
|
public class ItemizerXCommand implements CommandExecutor, ItemizerXBase
|
||||||
{
|
{
|
||||||
final List<Material> POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION);
|
final List<Material> POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION);
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package dev.plex.itemizerx;
|
package dev.plex.itemizerx;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@ -28,6 +22,13 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase
|
public class ItemizerXCompatCommand implements CommandExecutor, ItemizerXBase
|
||||||
{
|
{
|
||||||
final List<Material> POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION);
|
final List<Material> POTIONS = Arrays.asList(Material.POTION, Material.LINGERING_POTION, Material.SPLASH_POTION);
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package dev.plex.itemizerx;
|
package dev.plex.itemizerx;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -12,6 +8,11 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemizerXTab implements TabCompleter
|
public class ItemizerXTab implements TabCompleter
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_17_R1;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
@ -14,6 +11,10 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_18_R1;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
@ -14,6 +11,10 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_18_R2;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -14,6 +11,10 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R1;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R2;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_19_R3;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||||
|
@ -2,9 +2,6 @@ package dev.plex.itemizerx.v1_20_R1;
|
|||||||
|
|
||||||
import dev.plex.itemizerx.Attributes;
|
import dev.plex.itemizerx.Attributes;
|
||||||
import dev.plex.itemizerx.IAttributeManager;
|
import dev.plex.itemizerx.IAttributeManager;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -14,6 +11,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AttributeManager implements IAttributeManager
|
public class AttributeManager implements IAttributeManager
|
||||||
{
|
{
|
||||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||||
|
Loading…
Reference in New Issue
Block a user