forked from SteamWar/SteamWar
First 1.21.3 drafts
This commit is contained in:
+1
-1
@@ -146,7 +146,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (event.getEntityType() != EntityType.PRIMED_TNT) {
|
if (event.getEntityType().name().equals("tnt")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.inventory;
|
||||||
|
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
public class SWItem21 implements SWItem.ISWItem {
|
||||||
|
@Override
|
||||||
|
public Collection<ItemFlag> getHideFlags() {
|
||||||
|
return EnumSet.allOf(ItemFlag.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enchantment getDurabilityEnchantment() {
|
||||||
|
return Enchantment.UNBREAKING;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.inventory;
|
||||||
|
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
public class SWItem8 implements SWItem.ISWItem {
|
||||||
|
@Override
|
||||||
|
public Collection<ItemFlag> getHideFlags() {
|
||||||
|
return EnumSet.of(
|
||||||
|
ItemFlag.HIDE_ATTRIBUTES,
|
||||||
|
ItemFlag.HIDE_DESTROYS,
|
||||||
|
ItemFlag.HIDE_UNBREAKABLE,
|
||||||
|
ItemFlag.HIDE_ENCHANTS,
|
||||||
|
ItemFlag.HIDE_PLACED_ON,
|
||||||
|
ItemFlag.HIDE_POTION_EFFECTS
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enchantment getDurabilityEnchantment() {
|
||||||
|
return Enchantment.DURABILITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,12 @@ dependencies {
|
|||||||
|
|
||||||
compileOnly(libs.worldedit12)
|
compileOnly(libs.worldedit12)
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.paperapi21) {
|
||||||
|
attributes {
|
||||||
|
// Very Hacky, but it works
|
||||||
|
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
||||||
|
}
|
||||||
|
}
|
||||||
compileOnly(libs.netty)
|
compileOnly(libs.netty)
|
||||||
compileOnly(libs.authlib)
|
compileOnly(libs.authlib)
|
||||||
compileOnly(libs.viaapi)
|
compileOnly(libs.viaapi)
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ package de.steamwar.inventory;
|
|||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.FlatteningWrapper;
|
import de.steamwar.core.FlatteningWrapper;
|
||||||
|
import de.steamwar.core.VersionDependent;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@@ -30,10 +32,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SWItem {
|
public class SWItem {
|
||||||
|
|
||||||
|
private static final ISWItem impl = VersionDependent.getVersionImpl(Core.getInstance());
|
||||||
|
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
private ItemMeta itemMeta;
|
private ItemMeta itemMeta;
|
||||||
private InvCallback callback;
|
private InvCallback callback;
|
||||||
@@ -107,7 +112,7 @@ public class SWItem {
|
|||||||
|
|
||||||
itemMeta.setDisplayName(name);
|
itemMeta.setDisplayName(name);
|
||||||
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
|
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
|
||||||
if (enchanted) itemMeta.addEnchant(Enchantment.DURABILITY , 10, true);
|
if (enchanted) itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
callback = c;
|
callback = c;
|
||||||
@@ -144,12 +149,9 @@ public class SWItem {
|
|||||||
|
|
||||||
private void hideAttributes() {
|
private void hideAttributes() {
|
||||||
if (itemMeta == null) return;
|
if (itemMeta == null) return;
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
for (ItemFlag flag : impl.getHideFlags()) {
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_DESTROYS);
|
itemMeta.addItemFlags(flag);
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
|
}
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_PLACED_ON);
|
|
||||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
@@ -192,10 +194,16 @@ public class SWItem {
|
|||||||
|
|
||||||
public void setEnchanted(boolean enchanted) {
|
public void setEnchanted(boolean enchanted) {
|
||||||
if (enchanted){
|
if (enchanted){
|
||||||
itemMeta.addEnchant(Enchantment.DURABILITY , 10, true);
|
itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
|
||||||
} else {
|
} else {
|
||||||
itemMeta.removeEnchant(Enchantment.DURABILITY);
|
itemMeta.removeEnchant(impl.getDurabilityEnchantment());
|
||||||
}
|
}
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ISWItem {
|
||||||
|
Collection<ItemFlag> getHideFlags();
|
||||||
|
|
||||||
|
Enchantment getDurabilityEnchantment();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user