mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 14:38:56 +00:00
refactor: wip update 8
This commit is contained in:
8 files changed
+133
-121
No files matched your search
@@ -1,63 +0,0 @@
|
|||||||
package com.github.alathra.AlathranWars;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class AlathranWarsLogger {
|
|
||||||
|
|
||||||
final @NotNull File logsFolder;
|
|
||||||
final @NotNull File log;
|
|
||||||
@Nullable PrintWriter output = null;
|
|
||||||
|
|
||||||
public AlathranWarsLogger() {
|
|
||||||
logsFolder = new File("plugins" + File.separator + "AlathranWars" + File.separator + "logs");
|
|
||||||
log = new File(
|
|
||||||
"plugins" + File.separator + "AlathranWars" + File.separator + "logs" + File.separator + "log.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkFiles() {
|
|
||||||
if (!logsFolder.exists()) {
|
|
||||||
Bukkit.getLogger().warning("[AlathranWars] Error in AlathranWarsLogger - could not find logs directory");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!log.exists()) {
|
|
||||||
Bukkit.getLogger().warning("[AlathranWars] Error in AlathranWarsLogger - could not find log.txt");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initFileWriter() {
|
|
||||||
// init file writer
|
|
||||||
try {
|
|
||||||
@NotNull FileWriter fw = new FileWriter(
|
|
||||||
"plugins" + File.separator + "AlathranWars" + File.separator + "logs" + File.separator + "log.txt",
|
|
||||||
true);
|
|
||||||
@NotNull BufferedWriter bw = new BufferedWriter(fw);
|
|
||||||
output = new PrintWriter(bw);
|
|
||||||
} catch (IOException e1) {
|
|
||||||
Bukkit.getLogger().warning("[AlathranWars] Error in AlathranWarsLogger - could not initialize file writer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void log(String msg) {
|
|
||||||
// check for null files
|
|
||||||
if (!checkFiles()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
initFileWriter();
|
|
||||||
@NotNull Date date = new Date();
|
|
||||||
@NotNull SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
|
|
||||||
@NotNull String logMsg = "[" + format.format(date) + "] " + msg;
|
|
||||||
output.println(logMsg);
|
|
||||||
output.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,8 +16,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public class Main extends JavaPlugin {
|
public class Main extends JavaPlugin {
|
||||||
public static @Nullable Economy econ;
|
public static @Nullable Economy econ;
|
||||||
public static AlathranWarsLogger warLogger;
|
private static Main instance;
|
||||||
private static @Nullable Main instance;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
instance = null;
|
instance = null;
|
||||||
@@ -35,34 +34,6 @@ public class Main extends JavaPlugin {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dangerous if done at the wrong time!
|
|
||||||
*/
|
|
||||||
/*public static void initData() {
|
|
||||||
File userDataFolder = new File("plugins" + File.separator + "AlathranWars" + File.separator + "userdata");
|
|
||||||
if (!userDataFolder.exists()) {
|
|
||||||
userDataFolder.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
WarData.setWars(WarData.createWars());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initLogs() {
|
|
||||||
File logsFolder = new File("plugins" + File.separator + "AlathranWars" + File.separator + "logs");
|
|
||||||
if (!logsFolder.exists()) {
|
|
||||||
logsFolder.mkdirs();
|
|
||||||
}
|
|
||||||
File log = new File(
|
|
||||||
"plugins" + File.separator + "AlathranWars" + File.separator + "logs" + File.separator + "log.txt");
|
|
||||||
if (!log.exists()) {
|
|
||||||
try {
|
|
||||||
log.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Bukkit.getLogger().warning("[AlathranWars] Encountered error when creating log file!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
warLogger = new AlathranWarsLogger();
|
|
||||||
}*/
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
|
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||||
@@ -97,19 +68,8 @@ public class Main extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
// initLogs();
|
|
||||||
|
|
||||||
//new WarData(this);
|
|
||||||
// new TimeoutData(this);
|
|
||||||
|
|
||||||
// //run first
|
|
||||||
new WarItemRegistry();
|
new WarItemRegistry();
|
||||||
// //run second
|
|
||||||
// new WarRecipeRegistry();
|
|
||||||
|
|
||||||
// initData();
|
|
||||||
setupEconomy();
|
setupEconomy();
|
||||||
// initLogs();
|
|
||||||
|
|
||||||
configManager.onEnable();
|
configManager.onEnable();
|
||||||
dataManager.onEnable();
|
dataManager.onEnable();
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.github.alathra.AlathranWars.commands;
|
||||||
|
|
||||||
|
import com.github.alathra.AlathranWars.Main;
|
||||||
|
import com.github.alathra.AlathranWars.items.WarItemRegistry;
|
||||||
|
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
||||||
|
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||||
|
import dev.jorel.commandapi.CommandAPIBukkit;
|
||||||
|
import dev.jorel.commandapi.CommandAPICommand;
|
||||||
|
import dev.jorel.commandapi.arguments.ArgumentSuggestions;
|
||||||
|
import dev.jorel.commandapi.arguments.IntegerArgument;
|
||||||
|
import dev.jorel.commandapi.arguments.PlayerArgument;
|
||||||
|
import dev.jorel.commandapi.arguments.StringArgument;
|
||||||
|
import dev.jorel.commandapi.executors.CommandArguments;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class AdminCommands {
|
||||||
|
public AdminCommands() {
|
||||||
|
new CommandAPICommand("alathranwarsadmin")
|
||||||
|
.withAliases("awa", "wa", "waradmin")
|
||||||
|
.withPermission("AlathranWars.admin")
|
||||||
|
.withSubcommands(
|
||||||
|
commandItem(),
|
||||||
|
commandWar(),
|
||||||
|
commandSiege()
|
||||||
|
)
|
||||||
|
.executes((sender, args) -> {
|
||||||
|
if (args.count() == 0)
|
||||||
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "Invalid Arguments.").build());
|
||||||
|
})
|
||||||
|
.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandAPICommand commandItem() {
|
||||||
|
return new CommandAPICommand("item")
|
||||||
|
.withArguments(
|
||||||
|
new StringArgument("item")
|
||||||
|
.replaceSuggestions(
|
||||||
|
ArgumentSuggestions.strings(
|
||||||
|
CommandUtil.getWarItems()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
new IntegerArgument("amount").setOptional(true),
|
||||||
|
new PlayerArgument("player").setOptional(true)
|
||||||
|
)
|
||||||
|
.executesPlayer((Player sender, CommandArguments args) -> {
|
||||||
|
// Parse item
|
||||||
|
if (!(args.get("item") instanceof String argItem))
|
||||||
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "<red>Invalid item argument.").build());
|
||||||
|
|
||||||
|
@Nullable ItemStack stack;
|
||||||
|
if (argItem.contains(Main.getInstance().getName().toLowerCase())) {
|
||||||
|
stack = WarItemRegistry.getInstance().getOrNullNamespace(argItem);
|
||||||
|
} else {
|
||||||
|
stack = WarItemRegistry.getInstance().getOrNull(argItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack == null)
|
||||||
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "<red>The item is not an AlathranWars item.").build());
|
||||||
|
|
||||||
|
// Parse amount
|
||||||
|
int argAmount = (int) args.getOptional("amount").orElse(1);
|
||||||
|
|
||||||
|
if (argAmount > 64)
|
||||||
|
argAmount = 64;
|
||||||
|
else if (argAmount < 1) {
|
||||||
|
argAmount = 1;
|
||||||
|
}
|
||||||
|
stack.setAmount(argAmount);
|
||||||
|
|
||||||
|
// Determine who gets the item
|
||||||
|
Player argPlayer = (Player) args.getOptional("player").orElse(sender);
|
||||||
|
|
||||||
|
// Give
|
||||||
|
argPlayer.getInventory().addItem(stack);
|
||||||
|
|
||||||
|
final @Nullable Component itemName = stack.getItemMeta() == null ? ColorParser.of(stack.toString()).build() : stack.getItemMeta().displayName();
|
||||||
|
sender.sendMessage(
|
||||||
|
ColorParser.of(
|
||||||
|
"<prefix>Gave <amount>x <item> to <player>."
|
||||||
|
)
|
||||||
|
.parseMinimessagePlaceholder("prefix", UtilsChat.getPrefix())
|
||||||
|
.parseMinimessagePlaceholder("amount", String.valueOf(stack.getAmount()))
|
||||||
|
.parseMinimessagePlaceholder("item", itemName)
|
||||||
|
.parseMinimessagePlaceholder("player", argPlayer.getName())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandAPICommand commandWar() {
|
||||||
|
return new CommandAPICommand("war")
|
||||||
|
.withSubcommands(
|
||||||
|
WarCommands.commandCreate(true),
|
||||||
|
WarCommands.commandDelete(true),
|
||||||
|
WarCommands.commandJoin(true),
|
||||||
|
WarCommands.commandSurrender(true),
|
||||||
|
WarCommands.commandList(),
|
||||||
|
WarCommands.commandInfo()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandAPICommand commandSiege() {
|
||||||
|
return new CommandAPICommand("siege")
|
||||||
|
.withSubcommands(
|
||||||
|
SiegeCommands.commandStart(true),
|
||||||
|
SiegeCommands.commandStop(true),
|
||||||
|
SiegeCommands.commandAbandon(true),
|
||||||
|
SiegeCommands.commandSurrender(true),
|
||||||
|
SiegeCommands.commandList()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,8 +21,7 @@ public class CommandManager {
|
|||||||
// Register commands
|
// Register commands
|
||||||
new WarCommands();
|
new WarCommands();
|
||||||
new SiegeCommands();
|
new SiegeCommands();
|
||||||
// new RaidCommand();
|
new AdminCommands();
|
||||||
// new AdminCommand();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class SiegeCommands {
|
|||||||
.executesPlayer(SiegeCommands::siegeList);
|
.executesPlayer(SiegeCommands::siegeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void siegeStart(@NotNull Player sender, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
protected static void siegeStart(@NotNull Player sender, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
if (!(args.get("war") instanceof final @NotNull War war))
|
if (!(args.get("war") instanceof final @NotNull War war))
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "<red>You need to specify a war.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "<red>You need to specify a war.").build());
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ public class SiegeCommands {
|
|||||||
|
|
||||||
// Attacking own side
|
// Attacking own side
|
||||||
if (side.isTownOnSide(town)) {
|
if (side.isTownOnSide(town)) {
|
||||||
if (admin)
|
if (asAdmin)
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "You cannot attack your own side.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "You cannot attack your own side.").build());
|
||||||
else
|
else
|
||||||
siegeLeader.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You cannot attack your own towns.").build());
|
siegeLeader.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You cannot attack your own towns.").build());
|
||||||
@@ -142,19 +142,19 @@ public class SiegeCommands {
|
|||||||
siege.start();
|
siege.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void siegeStop(@NotNull Player sender, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
private static void siegeStop(@NotNull Player sender, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
||||||
|
|
||||||
siege.noWinner();
|
siege.noWinner();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void siegeAbandon(Player p, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
private static void siegeAbandon(Player p, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
||||||
|
|
||||||
@NotNull OfflinePlayer siegeLeader = siege.getSiegeLeader();
|
@NotNull OfflinePlayer siegeLeader = siege.getSiegeLeader();
|
||||||
if (siegeLeader != p && !admin)
|
if (siegeLeader != p && !asAdmin)
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>You are not the leader of this siege.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>You are not the leader of this siege.").build());
|
||||||
|
|
||||||
Bukkit.broadcast(
|
Bukkit.broadcast(
|
||||||
@@ -166,7 +166,7 @@ public class SiegeCommands {
|
|||||||
siege.defendersWin();
|
siege.defendersWin();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void siegeSurrender(Player p, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
private static void siegeSurrender(Player p, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
if (!(args.get("siege") instanceof final @NotNull Siege siege))
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>Invalid siege.").build());
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ public class SiegeCommands {
|
|||||||
final boolean canKingSurrender = (res.hasNation() && town.hasNation() && res.getNationOrNull().equals(town.getNationOrNull()) && res.isKing());
|
final boolean canKingSurrender = (res.hasNation() && town.hasNation() && res.getNationOrNull().equals(town.getNationOrNull()) && res.isKing());
|
||||||
final boolean canMayorSurrender = (res.hasTown() && res.getTownOrNull().equals(town) && res.isMayor());
|
final boolean canMayorSurrender = (res.hasTown() && res.getTownOrNull().equals(town) && res.isMayor());
|
||||||
|
|
||||||
if (!admin && (!canKingSurrender || !canMayorSurrender))
|
if (!asAdmin && (!canKingSurrender || !canMayorSurrender))
|
||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>You cannot surrender this town.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("<red>You cannot surrender this town.").build());
|
||||||
|
|
||||||
Bukkit.broadcast(
|
Bukkit.broadcast(
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class WarCommands {
|
|||||||
war.draw();
|
war.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void warJoinPlayer(Player p, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
protected static void warJoinPlayer(Player p, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
War war = (War) args.get("war");
|
War war = (War) args.get("war");
|
||||||
if (war == null) return;
|
if (war == null) return;
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ public class WarCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void warSurrender(@NotNull Player p, @NotNull CommandArguments args, boolean admin) throws WrapperCommandSyntaxException {
|
protected static void warSurrender(@NotNull Player p, @NotNull CommandArguments args, boolean asAdmin) throws WrapperCommandSyntaxException {
|
||||||
War war = (War) args.get("war");
|
War war = (War) args.get("war");
|
||||||
if (war == null) return;
|
if (war == null) return;
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ public class WarCommands {
|
|||||||
|
|
||||||
// TODO Test if resTown is reached
|
// TODO Test if resTown is reached
|
||||||
if (resNation != null) {
|
if (resNation != null) {
|
||||||
if (p.hasPermission("AlathranWars.nationsurrender") || res.isKing() || admin) {
|
if (p.hasPermission("AlathranWars.nationsurrender") || res.isKing() || asAdmin) {
|
||||||
// Has nation surrender permission
|
// Has nation surrender permission
|
||||||
argPlayer.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You have surrendered the war for " + resNation.getName() + ".").build());
|
argPlayer.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You have surrendered the war for " + resNation.getName() + ".").build());
|
||||||
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The nation of " + resNation.getName() + " has surrendered!").build());
|
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The nation of " + resNation.getName() + " has surrendered!").build());
|
||||||
@@ -231,7 +231,7 @@ public class WarCommands {
|
|||||||
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "You cannot surrender for your nation.").build());
|
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of(UtilsChat.getPrefix() + "You cannot surrender for your nation.").build());
|
||||||
}
|
}
|
||||||
} else if (resTown != null) {
|
} else if (resTown != null) {
|
||||||
if (p.hasPermission("AlathranWars.townsurrender") || res.isMayor() || admin) {
|
if (p.hasPermission("AlathranWars.townsurrender") || res.isMayor() || asAdmin) {
|
||||||
// Is in indepdenent town & has surrender perms
|
// Is in indepdenent town & has surrender perms
|
||||||
argPlayer.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You have surrendered the war for " + resTown.getName() + ".").build());
|
argPlayer.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "You have surrendered the war for " + resTown.getName() + ".").build());
|
||||||
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The town of " + resTown.getName() + " has surrendered!").build());
|
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The town of " + resTown.getName() + " has surrendered!").build());
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.github.alathra.AlathranWars.items.item;
|
|||||||
import com.github.alathra.AlathranWars.Main;
|
import com.github.alathra.AlathranWars.Main;
|
||||||
import com.github.alathra.AlathranWars.items.IWarItem;
|
import com.github.alathra.AlathranWars.items.IWarItem;
|
||||||
import com.github.alathra.AlathranWars.items.WarItemRegistry;
|
import com.github.alathra.AlathranWars.items.WarItemRegistry;
|
||||||
|
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
@@ -23,9 +25,9 @@ public class RamItem implements IWarItem {
|
|||||||
@NotNull ItemStack ram = new ItemStack(Material.WOODEN_HOE);
|
@NotNull ItemStack ram = new ItemStack(Material.WOODEN_HOE);
|
||||||
ItemMeta meta = ram.getItemMeta();
|
ItemMeta meta = ram.getItemMeta();
|
||||||
|
|
||||||
meta.setDisplayName("Door Ram");
|
meta.displayName(ColorParser.of("Door Ram").build());
|
||||||
@NotNull ArrayList<String> lore = new ArrayList<>();
|
@NotNull ArrayList<Component> lore = new ArrayList<>();
|
||||||
meta.setLore(lore);
|
meta.lore(lore);
|
||||||
meta.setCustomModelData(14700);
|
meta.setCustomModelData(14700);
|
||||||
|
|
||||||
ram.setItemMeta(meta);
|
ram.setItemMeta(meta);
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ public class PlayerInteractListener implements Listener {
|
|||||||
door.setOpen(!door.isOpen());
|
door.setOpen(!door.isOpen());
|
||||||
clicked.setBlockData(door);
|
clicked.setBlockData(door);
|
||||||
player.getInventory().getItemInMainHand().setAmount(player.getInventory().getItemInMainHand().getAmount() - 1);
|
player.getInventory().getItemInMainHand().setAmount(player.getInventory().getItemInMainHand().getAmount() - 1);
|
||||||
Main.warLogger.log("User " + player.getName() + " has broken down door" + clicked.getLocation());
|
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "<red>This item can only be used in a siege or raid!").parseLegacy().build());
|
player.sendMessage(ColorParser.of(UtilsChat.getPrefix() + "<red>This item can only be used in a siege or raid!").parseLegacy().build());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user