forked from SteamWar/SteamWar
send help ._.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public interface TrickyTrialsWrapper {
|
||||
TrickyTrialsWrapper impl = VersionDependent.getVersionImpl(Core.getInstance());
|
||||
|
||||
EntityType getTntEntityType();
|
||||
|
||||
Enchantment getUnbreakingEnchantment();
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.FlatteningWrapper;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -33,12 +34,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
public class SWItem {
|
||||
|
||||
private static final ISWItem impl = VersionDependent.getVersionImpl(Core.getInstance());
|
||||
|
||||
private ItemStack itemStack;
|
||||
private ItemMeta itemMeta;
|
||||
private InvCallback callback;
|
||||
@@ -112,7 +112,7 @@ public class SWItem {
|
||||
|
||||
itemMeta.setDisplayName(name);
|
||||
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
|
||||
if (enchanted) itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
|
||||
if (enchanted) itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment(), 10, true);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
callback = c;
|
||||
@@ -149,7 +149,7 @@ public class SWItem {
|
||||
|
||||
private void hideAttributes() {
|
||||
if (itemMeta == null) return;
|
||||
for (ItemFlag flag : impl.getHideFlags()) {
|
||||
for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) {
|
||||
itemMeta.addItemFlags(flag);
|
||||
}
|
||||
}
|
||||
@@ -194,16 +194,10 @@ public class SWItem {
|
||||
|
||||
public void setEnchanted(boolean enchanted) {
|
||||
if (enchanted){
|
||||
itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
|
||||
itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
|
||||
} else {
|
||||
itemMeta.removeEnchant(impl.getDurabilityEnchantment());
|
||||
itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
|
||||
}
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
public interface ISWItem {
|
||||
Collection<ItemFlag> getHideFlags();
|
||||
|
||||
Enchantment getDurabilityEnchantment();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user