diff --git a/SpigotCore_10/build.gradle b/SpigotCore_10/build.gradle
index 5ce5602..bd21efa 100644
--- a/SpigotCore_10/build.gradle
+++ b/SpigotCore_10/build.gradle
@@ -43,8 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_9")
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
@@ -52,5 +51,4 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
compileOnly files("${project.rootDir}/lib/Spigot-1.10.jar")
- compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar")
}
diff --git a/SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java b/SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java
similarity index 74%
rename from SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java
rename to SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java
index 4f59621..8916735 100644
--- a/SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java
+++ b/SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,24 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_10_R1.MinecraftServer;
import net.minecraft.server.v1_10_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_10_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_10 {
- private Chunk_10(){}
+public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535));
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java b/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java
deleted file mode 100644
index 2cc2d26..0000000
--- a/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_10_R1.MinecraftServer;
-
-public class SpigotTPS_10 {
-
- private SpigotTPS_10(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_12/build.gradle b/SpigotCore_12/build.gradle
index a455a07..48c917b 100644
--- a/SpigotCore_12/build.gradle
+++ b/SpigotCore_12/build.gradle
@@ -43,8 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_8")
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
@@ -52,5 +51,4 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
compileOnly files("${project.rootDir}/lib/Spigot-1.12.jar")
- compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar")
}
diff --git a/SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java b/SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java
similarity index 74%
rename from SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java
rename to SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java
index 8944a1f..3d084b3 100644
--- a/SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java
+++ b/SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,24 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_12_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_12 {
- private Chunk_12(){}
+public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535));
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java b/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java
deleted file mode 100644
index 17541c7..0000000
--- a/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_12_R1.MinecraftServer;
-
-public class SpigotTPS_12 {
-
- private SpigotTPS_12(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_12/src/de/steamwar/message/Message_12.java b/SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java
similarity index 84%
rename from SpigotCore_12/src/de/steamwar/message/Message_12.java
rename to SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java
index a228394..f6c5050 100644
--- a/SpigotCore_12/src/de/steamwar/message/Message_12.java
+++ b/SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java
@@ -17,16 +17,16 @@
along with this program. If not, see .
*/
-package de.steamwar.message;
+package de.steamwar.core;
import org.bukkit.entity.Player;
import java.util.Locale;
-class Message_12 {
- private Message_12(){}
+public class WorldOfColorWrapper12 implements WorldOfColorWrapper.IWorldOfColorWrapper {
- static Locale getLocale(Player player){
+ @Override
+ public Locale getLocale(Player player){
return Locale.forLanguageTag(player.getLocale());
}
}
diff --git a/SpigotCore_14/build.gradle b/SpigotCore_14/build.gradle
index 522e351..5ed491e 100644
--- a/SpigotCore_14/build.gradle
+++ b/SpigotCore_14/build.gradle
@@ -43,7 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
diff --git a/SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java b/SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java
similarity index 74%
rename from SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java
rename to SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java
index fa5a2ca..bc27af3 100644
--- a/SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java
+++ b/SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,24 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_14_R1.MinecraftServer;
import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_14 {
- private Chunk_14(){}
+public class CraftbukkitWrapper14 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535));
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
similarity index 62%
rename from SpigotCore_14/src/de/steamwar/sql/Schematic_14.java
rename to SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
index 255530f..af35928 100644
--- a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java
+++ b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,9 @@
along with this program. If not, see .
*/
-package de.steamwar.sql;
+package de.steamwar.core;
+import com.comphenix.tinyprotocol.Reflection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.sk89q.jnbt.*;
@@ -46,8 +47,13 @@ import com.sk89q.worldedit.world.DataFixer;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
+import de.steamwar.scoreboard.SWScoreboard;
+import de.steamwar.sql.NoClipboardException;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.SkullMeta;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -57,13 +63,280 @@ import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
-class Schematic_14 {
- private Schematic_14(){}
+public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper {
+
+ private static final Map renamedLegacy = new HashMap<>();
+
+ static{
+ renamedLegacy.put("WOOD", Material.OAK_WOOD);
+ renamedLegacy.put("SAPLING", Material.OAK_SAPLING);
+ renamedLegacy.put("STATIONARY_WATER", Material.WATER);
+ renamedLegacy.put("STATIONARY_LAVA", Material.LAVA);
+ renamedLegacy.put("LOG", Material.OAK_LOG);
+ renamedLegacy.put("LEAVES", Material.OAK_LEAVES);
+ renamedLegacy.put("BED_BLOCK", Material.RED_BED);
+ renamedLegacy.put("BED", Material.RED_BED);
+ renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON);
+ renamedLegacy.put("WEB", Material.COBWEB);
+ renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS);
+ renamedLegacy.put("PISTON_BASE", Material.PISTON);
+ renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD);
+ renamedLegacy.put("WOOL", Material.WHITE_WOOL);
+ renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON);
+ renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION);
+ renamedLegacy.put("RED_ROSE", Material.POPPY);
+ renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE);
+ renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB);
+ renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER);
+ renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS);
+ renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE);
+ renamedLegacy.put("CROPS", Material.WHEAT_SEEDS);
+ renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS);
+ renamedLegacy.put("SOIL", Material.FARMLAND);
+ renamedLegacy.put("BURNING_FURNACE", Material.FURNACE);
+ renamedLegacy.put("SIGN_POST", Material.OAK_SIGN);
+ renamedLegacy.put("SIGN", Material.OAK_SIGN);
+ renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR);
+ renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR);
+ renamedLegacy.put("RAILS", Material.RAIL);
+ renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN);
+ renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE);
+ renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE);
+ renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE);
+ renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH);
+ renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH);
+ renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR);
+ renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE);
+ renamedLegacy.put("CAKE_BLOCK", Material.CAKE);
+ renamedLegacy.put("MELON_BLOCK", Material.MELON);
+ renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT);
+ renamedLegacy.put("FENCE", Material.OAK_FENCE);
+ renamedLegacy.put("PORTAL", Material.NETHER_PORTAL);
+ renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER);
+ renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER);
+ renamedLegacy.put("DIODE", Material.REPEATER);
+ renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS);
+ renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR);
+ renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG);
+ renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG);
+ renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS);
+ renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM);
+ renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM);
+ renamedLegacy.put("IRON_FENCE", Material.IRON_BARS);
+ renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE);
+ renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE);
+ renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS);
+ renamedLegacy.put("MYCEL", Material.MYCELIUM);
+ renamedLegacy.put("WATER_LILY", Material.LILY_PAD);
+ renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE);
+ renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART);
+ renamedLegacy.put("NETHER_STALK", Material.NETHER_WART);
+ renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE);
+ renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL);
+ renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME);
+ renamedLegacy.put("ENDER_STONE", Material.END_STONE);
+ renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP);
+ renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP);
+ renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB);
+ renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB);
+ renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS);
+ renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS);
+ renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS);
+ renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK);
+ renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL);
+ renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON);
+ renamedLegacy.put("SKULL", Material.SKELETON_SKULL);
+ renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL);
+ renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
+ renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
+ renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR);
+ renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR);
+ renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR);
+ renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ);
+ renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA);
+ renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE);
+ renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES);
+ renamedLegacy.put("LOG_2", Material.ACACIA_LOG);
+ renamedLegacy.put("CARPET", Material.WHITE_CARPET);
+ renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA);
+ renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER);
+ renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER);
+ renamedLegacy.put("BANNER", Material.WHITE_BANNER);
+ renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER);
+ renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR);
+ renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB);
+ renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB);
+ renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB);
+ renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS);
+ renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK);
+ renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK);
+ renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK);
+ renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS);
+ renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX);
+ renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA);
+ renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE);
+ renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER);
+ renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL);
+ renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD);
+ renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL);
+ renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE);
+ renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE);
+ renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL);
+ renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL);
+ renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW);
+ renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD);
+ renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL);
+ renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE);
+ renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE);
+ renamedLegacy.put("SULPHUR", Material.GUNPOWDER);
+ renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE);
+ renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE);
+ renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET);
+ renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE);
+ renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS);
+ renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS);
+ renamedLegacy.put("PORK", Material.PORKCHOP);
+ renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP);
+ renamedLegacy.put("SNOW_BALL", Material.SNOWBALL);
+ renamedLegacy.put("BOAT", Material.OAK_BOAT);
+ renamedLegacy.put("CLAY_BRICK", Material.BRICKS);
+ renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART);
+ renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART);
+ renamedLegacy.put("WATCH", Material.CLOCK);
+ renamedLegacy.put("RAW_FISH", Material.SALMON);
+ renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON);
+ renamedLegacy.put("INK_SACK", Material.INK_SAC);
+ renamedLegacy.put("RAW_BEEF", Material.BEEF);
+ renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN);
+ renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE);
+ renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE);
+ renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE);
+ renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE);
+ renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK);
+ renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT);
+ renamedLegacy.put("EMPTY_MAP", Material.MAP);
+ renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND);
+ renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON);
+ renamedLegacy.put("CARROT_ITEM", Material.CARROT);
+ renamedLegacy.put("POTATO_ITEM", Material.POTATO);
+ renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR);
+ renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR);
+ renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR);
+ renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR);
+ renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR);
+ renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK);
+ renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET);
+ renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR);
+ renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS);
+ renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART);
+ renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR);
+ renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR);
+ renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR);
+ renamedLegacy.put("LEASH", Material.LEAD);
+ renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART);
+ renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT);
+ renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH);
+ renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT);
+ renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT);
+ renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT);
+ renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT);
+ renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT);
+ renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING);
+ renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13);
+ renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT);
+ renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS);
+ renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP);
+ renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR);
+ renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL);
+ renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI);
+ renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL);
+ renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD);
+ renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD);
+ renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11);
+ renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT);
+ }
+
+ private static final Reflection.FieldAccessor> scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, Reflection.getClass("{nms}.IChatBaseComponent"), 0);
+ private static final Reflection.ConstructorInvoker chatComponentConstructor = Reflection.getConstructor(Reflection.getClass("{nms}.ChatComponentText"), String.class);
+
+ @Override
+ public void setScoreboardTitle(Object packet, String title) {
+ scoreboardName.set(packet, chatComponentConstructor.invoke(title));
+ }
+
+ private static final Class> scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action");
+ private static final Reflection.FieldAccessor> scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0);
+ private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
+
+ @Override
+ public void setScoreAction(Object packet) {
+ scoreAction.set(packet, scoreActionChange);
+ }
+
+ @Override
+ public Material getMaterial(String material) {
+ try{
+ return Material.valueOf(material);
+ }catch(IllegalArgumentException e){
+ return renamedLegacy.get(material);
+ }
+ }
+
+ @Override
+ public Material getDye(int colorCode) {
+ switch(colorCode){
+ case 1:
+ return Material.RED_DYE;
+ case 2:
+ return Material.GREEN_DYE;
+ case 3:
+ return Material.BROWN_DYE;
+ case 4:
+ return Material.LAPIS_LAZULI;
+ case 5:
+ return Material.PURPLE_DYE;
+ case 6:
+ return Material.CYAN_DYE;
+ case 7:
+ return Material.LIGHT_GRAY_DYE;
+ case 8:
+ return Material.GRAY_DYE;
+ case 9:
+ return Material.PINK_DYE;
+ case 10:
+ return Material.LIME_DYE;
+ case 11:
+ return Material.YELLOW_DYE;
+ case 12:
+ return Material.LIGHT_BLUE_DYE;
+ case 13:
+ return Material.MAGENTA_DYE;
+ case 14:
+ return Material.ORANGE_DYE;
+ case 15:
+ return Material.WHITE_DYE;
+ default:
+ return Material.BLACK_DYE;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public ItemStack setSkullOwner(String player) {
+ ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
+ SkullMeta headmeta = (SkullMeta) head.getItemMeta();
+ assert headmeta != null;
+ headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player));
+ headmeta.setDisplayName(player);
+ head.setItemMeta(headmeta);
+ return head;
+ }
private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC;
private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC;
- static byte[] getPlayerClipboard(Player player, boolean schemFormat) {
+ @Override
+ public byte[] getPlayerClipboard(Player player, boolean schemFormat) {
ClipboardHolder clipboardHolder;
try {
clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard();
@@ -92,7 +365,8 @@ class Schematic_14 {
return outputStream.toByteArray();
}
- static void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
+ @Override
+ public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
Clipboard clipboard = null;
try {
clipboard = getClipboard(is, schemFormat);
@@ -107,7 +381,8 @@ class Schematic_14 {
getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard));
}
- static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
+ @Override
+ public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
try {
if(schemFormat){
return new SpongeSchematicReader(new NBTInputStream(is)).read();
@@ -419,7 +694,7 @@ class Schematic_14 {
return readVersion1(schematicTag);
} else if (schematicVersion == 2) {
dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue();
- if (dataVersion < liveDataVersion) {
+ if (dataVersion < liveDataVersion) {
fixer = platform.getDataFixer();
}
diff --git a/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java b/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java
deleted file mode 100644
index d00aba8..0000000
--- a/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_14_R1.MinecraftServer;
-
-public class SpigotTPS_14 {
-
- private SpigotTPS_14(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java
deleted file mode 100644
index 623dd20..0000000
--- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.inventory;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.SkullMeta;
-
-import java.util.HashMap;
-import java.util.Map;
-
-class SWItem_14 {
- private SWItem_14(){}
-
- private static final Map renamedLegacy = new HashMap<>();
-
- static{
- renamedLegacy.put("WOOD", Material.OAK_WOOD);
- renamedLegacy.put("SAPLING", Material.OAK_SAPLING);
- renamedLegacy.put("STATIONARY_WATER", Material.WATER);
- renamedLegacy.put("STATIONARY_LAVA", Material.LAVA);
- renamedLegacy.put("LOG", Material.OAK_LOG);
- renamedLegacy.put("LEAVES", Material.OAK_LEAVES);
- renamedLegacy.put("BED_BLOCK", Material.RED_BED);
- renamedLegacy.put("BED", Material.RED_BED);
- renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON);
- renamedLegacy.put("WEB", Material.COBWEB);
- renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS);
- renamedLegacy.put("PISTON_BASE", Material.PISTON);
- renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD);
- renamedLegacy.put("WOOL", Material.WHITE_WOOL);
- renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON);
- renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION);
- renamedLegacy.put("RED_ROSE", Material.POPPY);
- renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE);
- renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB);
- renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER);
- renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS);
- renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE);
- renamedLegacy.put("CROPS", Material.WHEAT_SEEDS);
- renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS);
- renamedLegacy.put("SOIL", Material.FARMLAND);
- renamedLegacy.put("BURNING_FURNACE", Material.FURNACE);
- renamedLegacy.put("SIGN_POST", Material.OAK_SIGN);
- renamedLegacy.put("SIGN", Material.OAK_SIGN);
- renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR);
- renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR);
- renamedLegacy.put("RAILS", Material.RAIL);
- renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN);
- renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE);
- renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE);
- renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE);
- renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH);
- renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH);
- renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR);
- renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE);
- renamedLegacy.put("CAKE_BLOCK", Material.CAKE);
- renamedLegacy.put("MELON_BLOCK", Material.MELON);
- renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT);
- renamedLegacy.put("FENCE", Material.OAK_FENCE);
- renamedLegacy.put("PORTAL", Material.NETHER_PORTAL);
- renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER);
- renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER);
- renamedLegacy.put("DIODE", Material.REPEATER);
- renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS);
- renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR);
- renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG);
- renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG);
- renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS);
- renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM);
- renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM);
- renamedLegacy.put("IRON_FENCE", Material.IRON_BARS);
- renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE);
- renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE);
- renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS);
- renamedLegacy.put("MYCEL", Material.MYCELIUM);
- renamedLegacy.put("WATER_LILY", Material.LILY_PAD);
- renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE);
- renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART);
- renamedLegacy.put("NETHER_STALK", Material.NETHER_WART);
- renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE);
- renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL);
- renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME);
- renamedLegacy.put("ENDER_STONE", Material.END_STONE);
- renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP);
- renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP);
- renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB);
- renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB);
- renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS);
- renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS);
- renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS);
- renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK);
- renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL);
- renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON);
- renamedLegacy.put("SKULL", Material.SKELETON_SKULL);
- renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL);
- renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
- renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
- renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR);
- renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR);
- renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR);
- renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ);
- renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA);
- renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE);
- renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES);
- renamedLegacy.put("LOG_2", Material.ACACIA_LOG);
- renamedLegacy.put("CARPET", Material.WHITE_CARPET);
- renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA);
- renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER);
- renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER);
- renamedLegacy.put("BANNER", Material.WHITE_BANNER);
- renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER);
- renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR);
- renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB);
- renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB);
- renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB);
- renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS);
- renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK);
- renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK);
- renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK);
- renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS);
- renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX);
- renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA);
- renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE);
- renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER);
- renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL);
- renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD);
- renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL);
- renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE);
- renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE);
- renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL);
- renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL);
- renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW);
- renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD);
- renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL);
- renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE);
- renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE);
- renamedLegacy.put("SULPHUR", Material.GUNPOWDER);
- renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE);
- renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE);
- renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET);
- renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE);
- renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS);
- renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS);
- renamedLegacy.put("PORK", Material.PORKCHOP);
- renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP);
- renamedLegacy.put("SNOW_BALL", Material.SNOWBALL);
- renamedLegacy.put("BOAT", Material.OAK_BOAT);
- renamedLegacy.put("CLAY_BRICK", Material.BRICKS);
- renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART);
- renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART);
- renamedLegacy.put("WATCH", Material.CLOCK);
- renamedLegacy.put("RAW_FISH", Material.SALMON);
- renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON);
- renamedLegacy.put("INK_SACK", Material.INK_SAC);
- renamedLegacy.put("RAW_BEEF", Material.BEEF);
- renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN);
- renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE);
- renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE);
- renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE);
- renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE);
- renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK);
- renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT);
- renamedLegacy.put("EMPTY_MAP", Material.MAP);
- renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND);
- renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON);
- renamedLegacy.put("CARROT_ITEM", Material.CARROT);
- renamedLegacy.put("POTATO_ITEM", Material.POTATO);
- renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR);
- renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR);
- renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR);
- renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR);
- renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR);
- renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK);
- renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET);
- renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR);
- renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS);
- renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART);
- renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR);
- renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR);
- renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR);
- renamedLegacy.put("LEASH", Material.LEAD);
- renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART);
- renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT);
- renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH);
- renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT);
- renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT);
- renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT);
- renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT);
- renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT);
- renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING);
- renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13);
- renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT);
- renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS);
- renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP);
- renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR);
- renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL);
- renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI);
- renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL);
- renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD);
- renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD);
- renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11);
- renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT);
- }
-
- static Material getMaterial(String material) {
- try{
- return Material.valueOf(material);
- }catch(IllegalArgumentException e){
- return renamedLegacy.get(material);
- }
- }
-
- static Material getDye(int colorCode){
- switch(colorCode){
- case 1:
- return Material.RED_DYE;
- case 2:
- return Material.GREEN_DYE;
- case 3:
- return Material.BROWN_DYE;
- case 4:
- return Material.LAPIS_LAZULI;
- case 5:
- return Material.PURPLE_DYE;
- case 6:
- return Material.CYAN_DYE;
- case 7:
- return Material.LIGHT_GRAY_DYE;
- case 8:
- return Material.GRAY_DYE;
- case 9:
- return Material.PINK_DYE;
- case 10:
- return Material.LIME_DYE;
- case 11:
- return Material.YELLOW_DYE;
- case 12:
- return Material.LIGHT_BLUE_DYE;
- case 13:
- return Material.MAGENTA_DYE;
- case 14:
- return Material.ORANGE_DYE;
- case 15:
- return Material.WHITE_DYE;
- default:
- return Material.BLACK_DYE;
- }
- }
-
- static ItemStack setSkullOwner(String player){
- ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
- SkullMeta headmeta = (SkullMeta) head.getItemMeta();
- assert headmeta != null;
- headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player));
- headmeta.setDisplayName(player);
- head.setItemMeta(headmeta);
- return head;
- }
-}
diff --git a/SpigotCore_15/build.gradle b/SpigotCore_15/build.gradle
index 7cf4806..31149fe 100644
--- a/SpigotCore_15/build.gradle
+++ b/SpigotCore_15/build.gradle
@@ -43,8 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_14")
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
@@ -52,5 +51,4 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar")
- compileOnly files("${project.rootDir}/lib/WorldEdit-1.15.jar")
}
diff --git a/SpigotCore_15/src/de/steamwar/authlib/AuthlibInjector_15.java b/SpigotCore_15/src/de/steamwar/authlib/AuthlibInjector_15.java
deleted file mode 100644
index 9864a31..0000000
--- a/SpigotCore_15/src/de/steamwar/authlib/AuthlibInjector_15.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 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 .
- */
-
-package de.steamwar.authlib;
-
-import net.minecraft.server.v1_15_R1.MinecraftServer;
-
-public class AuthlibInjector_15 {
-
- static Class getMinecraftClass() {
- return MinecraftServer.class;
- }
-
- static Object getMinecraftServerInstance() {
- return MinecraftServer.getServer();
- }
-}
diff --git a/SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java b/SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java
similarity index 74%
rename from SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java
rename to SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java
index 8a8b636..d5b908f 100644
--- a/SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java
+++ b/SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,24 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_15_R1.MinecraftServer;
import net.minecraft.server.v1_15_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_15 {
- private Chunk_15(){}
+public class CraftbukkitWrapper15 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535));
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java b/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java
deleted file mode 100644
index 46c1186..0000000
--- a/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_15_R1.MinecraftServer;
-
-public class SpigotTPS_15 {
-
- private SpigotTPS_15(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_8/build.gradle b/SpigotCore_8/build.gradle
index cb5ff47..f5207ab 100644
--- a/SpigotCore_8/build.gradle
+++ b/SpigotCore_8/build.gradle
@@ -43,7 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
diff --git a/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java
new file mode 100644
index 0000000..8c08082
--- /dev/null
+++ b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java
@@ -0,0 +1,41 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2020 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 .
+ */
+
+package de.steamwar.core;
+
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.minecraft.server.v1_8_R3.ChatComponentText;
+import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
+
+ @Override
+ public void playPling(Player player) {
+ player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1);
+ }
+
+ @Override
+ public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) {
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(msg)), (byte)type.ordinal()));
+ }
+}
diff --git a/SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java b/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java
similarity index 76%
rename from SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java
rename to SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java
index 404c158..149664c 100644
--- a/SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java
+++ b/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,23 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_8 {
- private Chunk_8(){}
+public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), true, 65535));
}
+
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
similarity index 84%
rename from SpigotCore_8/src/de/steamwar/sql/Schematic_8.java
rename to SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
index 29974ab..720d73f 100644
--- a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java
+++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,9 @@
along with this program. If not, see .
*/
-package de.steamwar.sql;
+package de.steamwar.core;
+import com.comphenix.tinyprotocol.Reflection;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.sk89q.jnbt.*;
@@ -36,8 +37,13 @@ import com.sk89q.worldedit.extent.clipboard.io.SchematicReader;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.registry.WorldData;
+import de.steamwar.scoreboard.SWScoreboard;
+import de.steamwar.sql.NoClipboardException;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.SkullMeta;
import javax.annotation.Nullable;
import java.io.ByteArrayOutputStream;
@@ -49,10 +55,49 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-class Schematic_8 {
- private Schematic_8(){}
+public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
- static byte[] getPlayerClipboard(Player player) {
+ private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, String.class, 1);
+ private static final Class> scoreActionEnum = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore$EnumScoreboardAction");
+ private static final Reflection.FieldAccessor> scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0);
+ private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
+
+ @Override
+ public void setScoreboardTitle(Object packet, String title) {
+ scoreboardName.set(packet, title);
+ }
+
+ @Override
+ public void setScoreAction(Object packet) {
+ scoreAction.set(packet, scoreActionChange);
+ }
+
+ @Override
+ public Material getMaterial(String material) {
+ try{
+ return Material.valueOf(material);
+ }catch(IllegalArgumentException e){
+ return Material.STONE;
+ }
+ }
+
+ @Override
+ public Material getDye(int colorCode) {
+ return Material.INK_SACK;
+ }
+
+ @Override
+ public ItemStack setSkullOwner(String player) {
+ ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
+ SkullMeta headmeta = (SkullMeta) head.getItemMeta();
+ headmeta.setOwner(player);
+ headmeta.setDisplayName(player);
+ head.setItemMeta(headmeta);
+ return head;
+ }
+
+ @Override
+ public byte[] getPlayerClipboard(Player player, boolean schemFormat) {
ClipboardHolder clipboardHolder;
try {
clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard();
@@ -73,7 +118,8 @@ class Schematic_8 {
return outputStream.toByteArray();
}
- static void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
+ @Override
+ public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
WorldData world = new BukkitWorld(player.getWorld()).getWorldData();
Clipboard clipboard;
try {
@@ -86,7 +132,8 @@ class Schematic_8 {
getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, world));
}
- static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
+ @Override
+ public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
if(schemFormat)
return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData());
else
@@ -97,7 +144,7 @@ class Schematic_8 {
return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
}
- public static class SpongeSchematicReader implements ClipboardReader {
+ private static class SpongeSchematicReader implements ClipboardReader {
private final NBTInputStream inputStream;
private int schematicVersion = -1;
@@ -132,7 +179,7 @@ class Schematic_8 {
}
private BlockArrayClipboard readSchematic(CompoundTag schematicTag) throws IOException {
- final Map ids = IDConverter.getMap();
+ final Map ids = IDConverter8.getMap();
Map schematic = schematicTag.getValue();
int width = (requireTag(schematic, "Width", ShortTag.class)).getValue();
@@ -181,7 +228,7 @@ class Schematic_8 {
String palettePart = iterator.next();
id = requireTag(paletteObject, palettePart, IntTag.class).getValue();
- IDConverter.BlockTypeID blockID = ids.get(palettePart);
+ IDConverter8.BlockTypeID blockID = ids.get(palettePart);
if(blockID == null){
blockID = ids.get(palettePart.split("\\[")[0]);
}
diff --git a/SpigotCore_8/src/de/steamwar/sql/IDConverter.java b/SpigotCore_8/src/de/steamwar/core/IDConverter8.java
similarity index 90%
rename from SpigotCore_8/src/de/steamwar/sql/IDConverter.java
rename to SpigotCore_8/src/de/steamwar/core/IDConverter8.java
index b503bde..fdbf70b 100644
--- a/SpigotCore_8/src/de/steamwar/sql/IDConverter.java
+++ b/SpigotCore_8/src/de/steamwar/core/IDConverter8.java
@@ -17,7 +17,7 @@
along with this program. If not, see .
*/
-package de.steamwar.sql;
+package de.steamwar.core;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -26,12 +26,12 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-class IDConverter {
- private IDConverter(){}
+class IDConverter8 {
+ private IDConverter8(){}
static Map getMap(){
Map ids = new HashMap<>();
- YamlConfiguration legacy = YamlConfiguration.loadConfiguration(new InputStreamReader(Objects.requireNonNull(IDConverter.class.getClassLoader().getResourceAsStream("legacy.yml"))));
+ YamlConfiguration legacy = YamlConfiguration.loadConfiguration(new InputStreamReader(Objects.requireNonNull(IDConverter8.class.getClassLoader().getResourceAsStream("legacy.yml"))));
for(String blockString : legacy.getKeys(false)){
String blockNum = legacy.getString(blockString);
String[] block = blockNum.split(":");
diff --git a/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java b/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java
deleted file mode 100644
index aeb94d1..0000000
--- a/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_8_R3.MinecraftServer;
-
-public class SpigotTPS_8 {
-
- private SpigotTPS_8(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_8/src/de/steamwar/message/Message_8.java b/SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java
similarity index 84%
rename from SpigotCore_8/src/de/steamwar/message/Message_8.java
rename to SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java
index 61b897b..73cf7fd 100644
--- a/SpigotCore_8/src/de/steamwar/message/Message_8.java
+++ b/SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java
@@ -17,16 +17,16 @@
along with this program. If not, see .
*/
-package de.steamwar.message;
+package de.steamwar.core;
import org.bukkit.entity.Player;
import java.util.Locale;
-class Message_8 {
- private Message_8(){}
+public class WorldOfColorWrapper8 implements WorldOfColorWrapper.IWorldOfColorWrapper {
- static Locale getLocale(Player player){
+ @Override
+ public Locale getLocale(Player player){
return Locale.forLanguageTag(player.spigot().getLocale());
}
}
diff --git a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java b/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java
deleted file mode 100644
index 746134f..0000000
--- a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.inventory;
-
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.SkullMeta;
-
-class SWItem_8 {
- private SWItem_8(){}
-
- static Material getMaterial(String material){
- try{
- return Material.valueOf(material);
- }catch(IllegalArgumentException e){
- return Material.STONE;
- }
- }
-
- static Material getDye(){
- return Material.INK_SACK;
- }
-
- static ItemStack setSkullOwner(String player){
- ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta headmeta = (SkullMeta) head.getItemMeta();
- headmeta.setOwner(player);
- headmeta.setDisplayName(player);
- head.setItemMeta(headmeta);
- return head;
- }
-}
diff --git a/SpigotCore_9/build.gradle b/SpigotCore_9/build.gradle
index a6ea4c5..e0e40ad 100644
--- a/SpigotCore_9/build.gradle
+++ b/SpigotCore_9/build.gradle
@@ -43,8 +43,7 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_8")
- implementation project(":SpigotCore_API")
+ implementation project(":SpigotCore_Main")
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
@@ -52,5 +51,4 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
compileOnly files("${project.rootDir}/lib/Spigot-1.9.jar")
- compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar")
}
diff --git a/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java
similarity index 69%
rename from SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java
rename to SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java
index 685b65a..d12a37d 100644
--- a/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java
+++ b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java
@@ -17,14 +17,22 @@
along with this program. If not, see .
*/
-package de.steamwar.comms;
+package de.steamwar.core;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
-public class BungeeReceiver_9 {
+public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
- public static void playpling(Player player) {
+ @Override
+ public void playPling(Player player) {
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
}
+
+ @Override
+ public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) {
+ player.spigot().sendMessage(type, msg);
+ }
}
diff --git a/SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java b/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java
similarity index 74%
rename from SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java
rename to SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java
index b4792fa..6cce09e 100644
--- a/SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java
+++ b/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java
@@ -1,6 +1,6 @@
-/*
+/*
This file is a part of the SteamWar software.
-
+
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
@@ -17,17 +17,24 @@
along with this program. If not, see .
*/
-package de.steamwar.chunk;
+package de.steamwar.core;
+import net.minecraft.server.v1_9_R2.MinecraftServer;
import net.minecraft.server.v1_9_R2.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_9_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
-public class Chunk_9 {
- private Chunk_9(){}
+public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapper {
- public static void sendChunk(Player p, int chunkX, int chunkZ){
+ @Override
+ public void sendChunk(Player p, int chunkX, int chunkZ) {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535));
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public double[] getSpigotTPS() {
+ return MinecraftServer.getServer().recentTps;
+ }
}
diff --git a/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java b/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java
deleted file mode 100644
index 6a0ba28..0000000
--- a/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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 .
-*/
-
-package de.steamwar.core;
-
-import net.minecraft.server.v1_9_R2.MinecraftServer;
-
-public class SpigotTPS_9 {
-
- private SpigotTPS_9(){}
-
- static double[] getTps(){
- return MinecraftServer.getServer().recentTps;
- }
-
-}
diff --git a/SpigotCore_API/build.gradle b/SpigotCore_API/build.gradle
deleted file mode 100644
index f2bf8a1..0000000
--- a/SpigotCore_API/build.gradle
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 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 .
- */
-
-plugins {
- id 'base'
- id 'java'
-}
-
-group 'steamwar'
-version '1.0'
-
-compileJava.options.encoding = 'UTF-8'
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
-sourceSets {
- main {
- java {
- srcDirs = ['src/']
- }
- resources {
- srcDirs = ['src/']
- exclude '**/*.java', '**/*.kt'
- }
- }
-}
-
-dependencies {
- compileOnly 'org.projectlombok:lombok:1.18.6'
- testCompileOnly 'org.projectlombok:lombok:1.18.6'
- annotationProcessor 'org.projectlombok:lombok:1.18.6'
- testAnnotationProcessor 'org.projectlombok:lombok:1.18.6'
-
- compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar")
-}
\ No newline at end of file
diff --git a/SpigotCore_API/settings.gradle b/SpigotCore_API/settings.gradle
deleted file mode 100644
index ada3e44..0000000
--- a/SpigotCore_API/settings.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 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 .
- */
-
-rootProject.name = 'SpigotCore_API'
\ No newline at end of file
diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle
index 61c121f..a14ad0e 100644
--- a/SpigotCore_Main/build.gradle
+++ b/SpigotCore_Main/build.gradle
@@ -43,14 +43,6 @@ sourceSets {
}
dependencies {
- implementation project(":SpigotCore_8")
- implementation project(":SpigotCore_9")
- implementation project(":SpigotCore_10")
- implementation project(":SpigotCore_12")
- implementation project(":SpigotCore_14")
- implementation project(":SpigotCore_15")
- implementation project(":SpigotCore_API")
-
compileOnly 'org.projectlombok:lombok:1.18.6'
testCompileOnly 'org.projectlombok:lombok:1.18.6'
annotationProcessor 'org.projectlombok:lombok:1.18.6'
@@ -58,7 +50,6 @@ dependencies {
compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar")
compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar")
- compileOnly files("${project.rootDir}/lib/ProtocolLib.jar")
implementation 'net.wesjd:anvilgui:1.4.0-SNAPSHOT'
}
diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java
new file mode 100644
index 0000000..1e18232
--- /dev/null
+++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java
@@ -0,0 +1,411 @@
+package com.comphenix.tinyprotocol;
+
+import org.bukkit.Bukkit;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * An utility class that simplifies reflection in Bukkit plugins.
+ *
+ * @author Kristian
+ */
+public final class Reflection {
+ /**
+ * An interface for invoking a specific constructor.
+ */
+ public interface ConstructorInvoker {
+ /**
+ * Invoke a constructor for a specific class.
+ *
+ * @param arguments - the arguments to pass to the constructor.
+ * @return The constructed object.
+ */
+ public Object invoke(Object... arguments);
+ }
+
+ /**
+ * An interface for invoking a specific method.
+ */
+ public interface MethodInvoker {
+ /**
+ * Invoke a method on a specific target object.
+ *
+ * @param target - the target object, or NULL for a static method.
+ * @param arguments - the arguments to pass to the method.
+ * @return The return value, or NULL if is void.
+ */
+ public Object invoke(Object target, Object... arguments);
+ }
+
+ /**
+ * An interface for retrieving the field content.
+ *
+ * @param - field type.
+ */
+ public interface FieldAccessor {
+ /**
+ * Retrieve the content of a field.
+ *
+ * @param target - the target object, or NULL for a static field.
+ * @return The value of the field.
+ */
+ public T get(Object target);
+
+ /**
+ * Set the content of a field.
+ *
+ * @param target - the target object, or NULL for a static field.
+ * @param value - the new value of the field.
+ */
+ public void set(Object target, Object value);
+
+ /**
+ * Determine if the given object has this field.
+ *
+ * @param target - the object to test.
+ * @return TRUE if it does, FALSE otherwise.
+ */
+ public boolean hasField(Object target);
+ }
+
+ // Deduce the net.minecraft.server.v* package
+ private static String OBC_PREFIX = Bukkit.getServer().getClass().getPackage().getName();
+ private static String NMS_PREFIX = OBC_PREFIX.replace("org.bukkit.craftbukkit", "net.minecraft.server");
+ private static String VERSION = OBC_PREFIX.replace("org.bukkit.craftbukkit", "").replace(".", "");
+
+ // Variable replacement
+ private static Pattern MATCH_VARIABLE = Pattern.compile("\\{([^\\}]+)\\}");
+
+ private Reflection() {
+ // Seal class
+ }
+
+ /**
+ * Retrieve a field accessor for a specific field type and name.
+ *
+ * @param target - the target type.
+ * @param name - the name of the field, or NULL to ignore.
+ * @param fieldType - a compatible field type.
+ * @return The field accessor.
+ */
+ public static FieldAccessor getField(Class> target, String name, Class fieldType) {
+ return getField(target, name, fieldType, 0);
+ }
+
+ /**
+ * Retrieve a field accessor for a specific field type and name.
+ *
+ * @param className - lookup name of the class, see {@link #getClass(String)}.
+ * @param name - the name of the field, or NULL to ignore.
+ * @param fieldType - a compatible field type.
+ * @return The field accessor.
+ */
+ public static FieldAccessor getField(String className, String name, Class fieldType) {
+ return getField(getClass(className), name, fieldType, 0);
+ }
+
+ /**
+ * Retrieve a field accessor for a specific field type and name.
+ *
+ * @param target - the target type.
+ * @param fieldType - a compatible field type.
+ * @param index - the number of compatible fields to skip.
+ * @return The field accessor.
+ */
+ public static FieldAccessor getField(Class> target, Class fieldType, int index) {
+ return getField(target, null, fieldType, index);
+ }
+
+ /**
+ * Retrieve a field accessor for a specific field type and name.
+ *
+ * @param className - lookup name of the class, see {@link #getClass(String)}.
+ * @param fieldType - a compatible field type.
+ * @param index - the number of compatible fields to skip.
+ * @return The field accessor.
+ */
+ public static FieldAccessor getField(String className, Class fieldType, int index) {
+ return getField(getClass(className), fieldType, index);
+ }
+
+ // Common method
+ private static FieldAccessor getField(Class> target, String name, Class fieldType, int index) {
+ for (final Field field : target.getDeclaredFields()) {
+ if ((name == null || field.getName().equals(name)) && fieldType.isAssignableFrom(field.getType()) && index-- <= 0) {
+ field.setAccessible(true);
+
+ // A function for retrieving a specific field value
+ return new FieldAccessor() {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T get(Object target) {
+ try {
+ return (T) field.get(target);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("Cannot access reflection.", e);
+ }
+ }
+
+ @Override
+ public void set(Object target, Object value) {
+ try {
+ field.set(target, value);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("Cannot access reflection.", e);
+ }
+ }
+
+ @Override
+ public boolean hasField(Object target) {
+ // target instanceof DeclaringClass
+ return field.getDeclaringClass().isAssignableFrom(target.getClass());
+ }
+ };
+ }
+ }
+
+ // Search in parent classes
+ if (target.getSuperclass() != null)
+ return getField(target.getSuperclass(), name, fieldType, index);
+
+ throw new IllegalArgumentException("Cannot find field with type " + fieldType);
+ }
+
+ /**
+ * Search for the first publicly and privately defined method of the given name and parameter count.
+ *
+ * @param className - lookup name of the class, see {@link #getClass(String)}.
+ * @param methodName - the method name, or NULL to skip.
+ * @param params - the expected parameters.
+ * @return An object that invokes this specific method.
+ * @throws IllegalStateException If we cannot find this method.
+ */
+ public static MethodInvoker getMethod(String className, String methodName, Class>... params) {
+ return getTypedMethod(getClass(className), methodName, null, params);
+ }
+
+ /**
+ * Search for the first publicly and privately defined method of the given name and parameter count.
+ *
+ * @param clazz - a class to start with.
+ * @param methodName - the method name, or NULL to skip.
+ * @param params - the expected parameters.
+ * @return An object that invokes this specific method.
+ * @throws IllegalStateException If we cannot find this method.
+ */
+ public static MethodInvoker getMethod(Class> clazz, String methodName, Class>... params) {
+ return getTypedMethod(clazz, methodName, null, params);
+ }
+
+ /**
+ * Search for the first publicly and privately defined method of the given name and parameter count.
+ *
+ * @param clazz - a class to start with.
+ * @param methodName - the method name, or NULL to skip.
+ * @param returnType - the expected return type, or NULL to ignore.
+ * @param params - the expected parameters.
+ * @return An object that invokes this specific method.
+ * @throws IllegalStateException If we cannot find this method.
+ */
+ public static MethodInvoker getTypedMethod(Class> clazz, String methodName, Class> returnType, Class>... params) {
+ for (final Method method : clazz.getDeclaredMethods()) {
+ if ((methodName == null || method.getName().equals(methodName))
+ && (returnType == null || method.getReturnType().equals(returnType))
+ && Arrays.equals(method.getParameterTypes(), params)) {
+ method.setAccessible(true);
+
+ return new MethodInvoker() {
+
+ @Override
+ public Object invoke(Object target, Object... arguments) {
+ try {
+ return method.invoke(target, arguments);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot invoke method " + method, e);
+ }
+ }
+
+ };
+ }
+ }
+
+ // Search in every superclass
+ if (clazz.getSuperclass() != null)
+ return getMethod(clazz.getSuperclass(), methodName, params);
+
+ throw new IllegalStateException(String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params)));
+ }
+
+ /**
+ * Search for the first publically and privately defined constructor of the given name and parameter count.
+ *
+ * @param className - lookup name of the class, see {@link #getClass(String)}.
+ * @param params - the expected parameters.
+ * @return An object that invokes this constructor.
+ * @throws IllegalStateException If we cannot find this method.
+ */
+ public static ConstructorInvoker getConstructor(String className, Class>... params) {
+ return getConstructor(getClass(className), params);
+ }
+
+ /**
+ * Search for the first publically and privately defined constructor of the given name and parameter count.
+ *
+ * @param clazz - a class to start with.
+ * @param params - the expected parameters.
+ * @return An object that invokes this constructor.
+ * @throws IllegalStateException If we cannot find this method.
+ */
+ public static ConstructorInvoker getConstructor(Class> clazz, Class>... params) {
+ for (final Constructor> constructor : clazz.getDeclaredConstructors()) {
+ if (Arrays.equals(constructor.getParameterTypes(), params)) {
+ constructor.setAccessible(true);
+
+ return new ConstructorInvoker() {
+
+ @Override
+ public Object invoke(Object... arguments) {
+ try {
+ return constructor.newInstance(arguments);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot invoke constructor " + constructor, e);
+ }
+ }
+
+ };
+ }
+ }
+
+ throw new IllegalStateException(String.format("Unable to find constructor for %s (%s).", clazz, Arrays.asList(params)));
+ }
+
+ /**
+ * Retrieve a class from its full name, without knowing its type on compile time.
+ *
+ * This is useful when looking up fields by a NMS or OBC type.
+ *
+ *
+ * @see {@link #getClass()} for more information.
+ * @param lookupName - the class name with variables.
+ * @return The class.
+ */
+ public static Class