mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-02-17 03:41:20 +01:00
Added support for 1.16
This commit is contained in:
parent
6ea2f89501
commit
8e361ff2c3
2
pom.xml
2
pom.xml
@ -110,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.15</version>
|
||||
<version>1.16.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -13,8 +13,6 @@ import com.songoda.core.database.SQLiteConnector;
|
||||
import com.songoda.core.gui.GuiManager;
|
||||
import com.songoda.core.hooks.HologramManager;
|
||||
import com.songoda.core.hooks.WorldGuardHook;
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.ultimatestacker.commands.*;
|
||||
import com.songoda.ultimatestacker.database.DataManager;
|
||||
@ -44,7 +42,6 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@ -108,14 +105,15 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
|
||||
// Setup plugin commands
|
||||
this.commandManager = new CommandManager(this);
|
||||
this.commandManager.addCommand(new CommandUltimateStacker())
|
||||
.addSubCommand(new CommandSettings(guiManager))
|
||||
.addSubCommand(new CommandRemoveAll())
|
||||
.addSubCommand(new CommandReload())
|
||||
.addSubCommand(new CommandGiveSpawner())
|
||||
.addSubCommand(new CommandSpawn())
|
||||
.addSubCommand(new CommandLootables())
|
||||
.addSubCommand(new CommandConvert(guiManager));
|
||||
this.commandManager.addMainCommand("us")
|
||||
.addSubCommands(new CommandSettings(guiManager),
|
||||
new CommandRemoveAll(),
|
||||
new CommandReload(),
|
||||
new CommandGiveSpawner(),
|
||||
new CommandSpawn(),
|
||||
new CommandLootables(),
|
||||
new CommandConvert(guiManager)
|
||||
);
|
||||
|
||||
this.entityUtils = new EntityUtils();
|
||||
|
||||
@ -381,7 +379,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
/**
|
||||
* Change the stacked amount for this item
|
||||
*
|
||||
* @param item item entity to update
|
||||
* @param item item entity to update
|
||||
* @param itemStack ItemStack that will represent this item
|
||||
* @param newAmount number of items this item represents
|
||||
*/
|
||||
@ -400,7 +398,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
}
|
||||
// If amount is 0, Minecraft change the type to AIR
|
||||
if (itemStack.getType() == Material.AIR)
|
||||
return;
|
||||
return;
|
||||
item.setItemStack(itemStack);
|
||||
|
||||
if ((blacklisted && !Settings.ITEM_HOLOGRAM_BLACKLIST.getBoolean())
|
||||
|
@ -46,7 +46,7 @@ public class CommandConvert extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us convert";
|
||||
return "convert";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +95,7 @@ public class CommandGiveSpawner extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us givespawner <player/all> <type> [size]";
|
||||
return "givespawner <player/all> <type> [size]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class CommandLootables extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us lootables";
|
||||
return "lootables";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,7 @@ public class CommandReload extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us reload";
|
||||
return "reload";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,7 +85,7 @@ public class CommandRemoveAll extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us removeall <entities/items> [all]";
|
||||
return "removeall <entities/items> [all]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandSettings extends AbstractCommand {
|
||||
@ -15,7 +16,7 @@ public class CommandSettings extends AbstractCommand {
|
||||
GuiManager guiManager;
|
||||
|
||||
public CommandSettings(GuiManager guiManager) {
|
||||
super(true, "Settings");
|
||||
super(CommandType.PLAYER_ONLY, "Settings");
|
||||
this.guiManager = guiManager;
|
||||
instance = UltimateStacker.getInstance();
|
||||
}
|
||||
@ -28,7 +29,7 @@ public class CommandSettings extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender sender, String... args) {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,7 +39,7 @@ public class CommandSettings extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us settings";
|
||||
return "settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class CommandSpawn extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/us spawn <entity> <amount>";
|
||||
return "spawn <entity> <amount>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,54 +0,0 @@
|
||||
package com.songoda.ultimatestacker.commands;
|
||||
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandUltimateStacker extends AbstractCommand {
|
||||
|
||||
UltimateStacker instance;
|
||||
|
||||
public CommandUltimateStacker() {
|
||||
super(false, "UltimateStacker");
|
||||
instance = UltimateStacker.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
sender.sendMessage("");
|
||||
instance.getLocale().newMessage("&7Version " + instance.getDescription().getVersion()
|
||||
+ " Created with <3 by &5&l&oSongoda").sendPrefixedMessage(sender);
|
||||
|
||||
for (AbstractCommand command : instance.getCommandManager().getAllCommands()) {
|
||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||
sender.sendMessage(Methods.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
|
||||
}
|
||||
}
|
||||
sender.sendMessage("");
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender cs, String... strings) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/UltimateStacker";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Displays this page.";
|
||||
}
|
||||
}
|
@ -151,9 +151,11 @@ public class EntityStack {
|
||||
|
||||
newEntity.getEquipment().clear();
|
||||
|
||||
if (killed.getType() == EntityType.PIG_ZOMBIE)
|
||||
if (killed.getType().name().equals("PIG_ZOMBIE"))
|
||||
newEntity.getEquipment().setItemInHand(CompatibleMaterial.GOLDEN_SWORD.getItem());
|
||||
|
||||
|
||||
|
||||
if (Settings.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
|
||||
for (Map.Entry<String, MetadataValue> entry : getMetadata(killed).entrySet())
|
||||
newEntity.setMetadata(entry.getKey(), entry.getValue());
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.songoda.ultimatestacker.listeners;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
|
@ -681,19 +681,40 @@ public class LootablesManager {
|
||||
.setMax(2).build()));
|
||||
|
||||
// Add Zombie Pigman
|
||||
lootManager.addLootable(new Lootable("PIG_ZOMBIE",
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.ROTTEN_FLESH)
|
||||
.setMin(0)
|
||||
.setMax(1).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.GOLD_NUGGET)
|
||||
.setMin(0)
|
||||
.setMax(1).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.GOLD_INGOT)
|
||||
.setChance(2.5)
|
||||
.addOnlyDropFors(EntityType.PLAYER).build()));
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_16))
|
||||
lootManager.addLootable(new Lootable("PIG_ZOMBIE",
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.ROTTEN_FLESH)
|
||||
.setMin(0)
|
||||
.setMax(1).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.GOLD_NUGGET)
|
||||
.setMin(0)
|
||||
.setMax(1).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.GOLD_INGOT)
|
||||
.setChance(2.5)
|
||||
.addOnlyDropFors(EntityType.PLAYER).build()));
|
||||
else {
|
||||
// Add Strider
|
||||
lootManager.addLootable(new Lootable("STRIDER",
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.PORKCHOP)
|
||||
.setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP)
|
||||
.setMin(2)
|
||||
.setMax(4).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.LEATHER)
|
||||
.setMin(0)
|
||||
.setMax(2).build()));
|
||||
|
||||
// Add Hoglin
|
||||
lootManager.addLootable(new Lootable("HOGLIN",
|
||||
new LootBuilder()
|
||||
.setMaterial(CompatibleMaterial.STRING)
|
||||
.setMin(0)
|
||||
.setMax(5).build()));
|
||||
}
|
||||
|
||||
// Add Wither.
|
||||
lootManager.addLootable(new Lootable("WITHER",
|
||||
|
@ -7,10 +7,10 @@ main: com.songoda.ultimatestacker.UltimateStacker
|
||||
author: songoda
|
||||
api-version: 1.13
|
||||
commands:
|
||||
UltimateStacker:
|
||||
us:
|
||||
description: Reloads the configuration file
|
||||
default: true
|
||||
aliases: [us]
|
||||
aliases: [UltimateStacker]
|
||||
usage: /ultimatestacker reload
|
||||
permissions:
|
||||
ultimatestacker.*:
|
||||
|
Loading…
Reference in New Issue
Block a user