9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-21 16:09:24 +00:00

Legacy base64 system has been removed in favour of the eco items system

This commit is contained in:
Auxilor
2021-09-02 10:24:30 +01:00
parent de675b49be
commit af72bfbbb6
8 changed files with 10 additions and 61 deletions

View File

@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent; import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.config.interfaces.Config; import com.willfp.eco.core.config.interfaces.Config;
import com.willfp.eco.core.items.Items;
import com.willfp.eco.core.items.builder.ItemBuilder; import com.willfp.eco.core.items.builder.ItemBuilder;
import com.willfp.eco.core.items.builder.ItemStackBuilder; import com.willfp.eco.core.items.builder.ItemStackBuilder;
import com.willfp.eco.core.recipe.Recipes; import com.willfp.eco.core.recipe.Recipes;
@@ -329,13 +330,12 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
chance = Double.parseDouble(split[0]); chance = Double.parseDouble(split[0]);
string = split[1]; string = split[1];
} }
String tempConfigString = new String(Base64.getDecoder().decode(string));
try { ItemStack itemStack = Items.lookup(string).getItem();
tempConfig.loadFromString(tempConfigString); if (itemStack.getType() == Material.AIR) {
} catch (InvalidConfigurationException e) { Bukkit.getLogger().warning(this.getName() + " has an invalid drop configured! (" + string + ")");
e.printStackTrace(); continue;
} }
ItemStack itemStack = tempConfig.getItemStack("drop-key");
this.drops.put(itemStack, chance); this.drops.put(itemStack, chance);
} }

View File

@@ -1,41 +0,0 @@
package com.willfp.ecobosses.commands;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.impl.Subcommand;
import com.willfp.ecobosses.EcoBossesPlugin;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.Base64;
public class CommandBase64 extends Subcommand {
/**
* Instantiate a new executor for /ebdrop.
*
* @param plugin The plugin to manage the execution for.
*/
public CommandBase64(@NotNull final EcoBossesPlugin plugin) {
super(plugin, "base64", "ecobosses.command.base64", true);
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
Player player = (Player) sender;
ItemStack itemStack = player.getInventory().getItemInMainHand();
String key = "drop-key";
YamlConfiguration jank = new YamlConfiguration();
jank.set(key, itemStack);
String configString = jank.saveToString();
String dropString = Base64.getEncoder().encodeToString(configString.getBytes());
Bukkit.getLogger().info("Copy this into the drops section of your boss yml!");
Bukkit.getLogger().info("\n" + dropString);
player.sendMessage(this.getPlugin().getLangYml().getMessage("sent-drop"));
};
}
}

View File

@@ -16,7 +16,6 @@ public class CommandEcobosses extends PluginCommand {
this.addSubcommand(new CommandReload(plugin)) this.addSubcommand(new CommandReload(plugin))
.addSubcommand(new CommandKillall(plugin)) .addSubcommand(new CommandKillall(plugin))
.addSubcommand(new CommandSpawn(plugin)) .addSubcommand(new CommandSpawn(plugin))
.addSubcommand(new CommandBase64(plugin))
.addSubcommand(new CommandGive(plugin)); .addSubcommand(new CommandGive(plugin));
} }

View File

@@ -60,8 +60,7 @@ rewards:
# Use %player% as the placeholder for the player name # Use %player% as the placeholder for the player name
commands: [] commands: []
# Get items to add here by copying the console output for /ecobosses base64 # To set the chance for a drop, put <chance>::item
# To set the chance for a drop, put <chance>::<base64>
drops: [] drops: []
broadcast: broadcast:

View File

@@ -60,8 +60,7 @@ rewards:
# Use %player% as the placeholder for the player name # Use %player% as the placeholder for the player name
commands: [] commands: []
# Get items to add here by copying the console output for /ecobosses base64 # To set the chance for a drop, put <chance>::item
# To set the chance for a drop, put <chance>::<base64>
drops: [] drops: []
broadcast: broadcast:

View File

@@ -60,8 +60,7 @@ rewards:
# Use %player% as the placeholder for the player name # Use %player% as the placeholder for the player name
commands: [] commands: []
# Get items to add here by copying the console output for /ecobosses base64 # To set the chance for a drop, put <chance>::item
# To set the chance for a drop, put <chance>::<base64>
drops: [] drops: []
broadcast: broadcast:

View File

@@ -60,8 +60,7 @@ rewards:
# Use %player% as the placeholder for the player name # Use %player% as the placeholder for the player name
commands: [] commands: []
# Get items to add here by copying the console output for /ecobosses base64 # To set the chance for a drop, put <chance>::item
# To set the chance for a drop, put <chance>::<base64>
drops: [] drops: []
broadcast: broadcast:

View File

@@ -26,17 +26,12 @@ permissions:
ecobosses.command.ecobosses: true ecobosses.command.ecobosses: true
ecobosses.command.reload: true ecobosses.command.reload: true
ecobosses.command.spawn: true ecobosses.command.spawn: true
ecobosses.command.base64: true
ecobosses.command.give: true ecobosses.command.give: true
ecobosses.command.ecobosses: ecobosses.command.ecobosses:
description: Allows the use of /ecobosses description: Allows the use of /ecobosses
default: true default: true
ecobosses.command.base64:
description: Allows the use of /ecobosses base64
default: op
ecobosses.command.give: ecobosses.command.give:
description: Allows the use of /ecobosses give description: Allows the use of /ecobosses give
default: op default: op