diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 01227363..5fbb013a 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -27,7 +27,7 @@ jobs:
# Build remapped Spigot versions
- uses: SpraxDev/Action-SpigotMC@v4
with:
- versions: 1.18, 1.18.2, 1.19, 1.19.2, 1.19.3
+ versions: 1.18, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4
remapped: true
# Build project
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
index e8c2d392..cb6ede4e 100644
--- a/.github/workflows/sonarcloud.yml
+++ b/.github/workflows/sonarcloud.yml
@@ -38,7 +38,7 @@ jobs:
# Build remapped Spigot versions
- uses: SpraxDev/Action-SpigotMC@v4
with:
- versions: 1.18, 1.18.2, 1.19, 1.19.2, 1.19.3
+ versions: 1.18, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4
remapped: true
- name: Analyze project
diff --git a/Compatibility/pom.xml b/Compatibility/pom.xml
index 9dbba0e2..3c34e61d 100644
--- a/Compatibility/pom.xml
+++ b/Compatibility/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../pom.xml
diff --git a/Core/pom.xml b/Core/pom.xml
index 857c5316..d62fab4c 100644
--- a/Core/pom.xml
+++ b/Core/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../pom.xml
@@ -128,7 +128,7 @@
de.tr7zwitem-nbt-api
- 2.11.1
+ 2.11.2compile
@@ -267,6 +267,12 @@
${project.version}compile
+
+ ${project.groupId}
+ SongodaCore-NMS-v1_19_R3
+ ${project.version}
+ compile
+
@@ -376,9 +382,9 @@
- me.angeschossen
+ com.github.AngeschossenLandsAPI
- 4.12.20
+ 6.28.11provided
diff --git a/Core/src/main/java/com/songoda/core/SongodaCore.java b/Core/src/main/java/com/songoda/core/SongodaCore.java
index 5d76a5f9..8f8fa62a 100644
--- a/Core/src/main/java/com/songoda/core/SongodaCore.java
+++ b/Core/src/main/java/com/songoda/core/SongodaCore.java
@@ -55,7 +55,7 @@ public class SongodaCore {
/**
* @since coreRevision 6
*/
- private final static String coreVersion = "2.6.18";
+ private final static String coreVersion = "2.6.19-DEV";
/**
* This is specific to the website api
diff --git a/Core/src/main/java/com/songoda/core/SongodaPlugin.java b/Core/src/main/java/com/songoda/core/SongodaPlugin.java
index 2dbf598f..29e5066a 100644
--- a/Core/src/main/java/com/songoda/core/SongodaPlugin.java
+++ b/Core/src/main/java/com/songoda/core/SongodaPlugin.java
@@ -85,34 +85,41 @@ public abstract class SongodaPlugin extends JavaPlugin {
@Override
public final void onEnable() {
- if (emergencyStop) {
+ if (this.emergencyStop) {
setEnabled(false);
return;
}
- //Check plugin access, don't load plugin if user don't have access
+ // Check plugin access, don't load plugin if user don't have access
if (!SongodaAuth.isAuthorized(true)) {
- Thread thread = new Thread(() -> {
- console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
- console.sendMessage(ChatColor.RED + "You do not have access to this plugin.");
- console.sendMessage(ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace");
- console.sendMessage(ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses");
- console.sendMessage(ChatColor.YELLOW + "License setup steps:");
- console.sendMessage(ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License button'");
- console.sendMessage(ChatColor.YELLOW + "Copy the following ip and uuid and click create.");
- console.sendMessage(ChatColor.YELLOW + "IP: " + SongodaAuth.getIP());
- console.sendMessage(ChatColor.YELLOW + "UUID: " + SongodaAuth.getUUID());
- console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
- });
- thread.start();
+ String pluginName = getDescription().getName();
+
+ new Thread(() -> {
+ String externalIP = SongodaAuth.getIP();
+ String serverUuid = SongodaAuth.getUUID().toString();
+
+ String message = "\n" +
+ ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
+ ChatColor.RED + "You do not have access to the " + pluginName + " plugin.\n" +
+ ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace\n" +
+ ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses\n" +
+ ChatColor.YELLOW + "License setup steps:\n" +
+ ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License' button.\n" +
+ ChatColor.YELLOW + "Copy the following IP address and UUID and click create.\n" +
+ ChatColor.YELLOW + "UUID: " + serverUuid + "\n" +
+ ChatColor.YELLOW + "IP: " + externalIP + "\n" +
+ ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
+ this.console.sendMessage(message);
+ }).start();
+
emergencyStop();
return;
}
console.sendMessage(" "); // blank line to separate chatter
console.sendMessage(ChatColor.GREEN + "=============================");
- console.sendMessage(String.format("%s%s %s by %sSongoda <3!", ChatColor.GRAY,
+ console.sendMessage(String.format("%s%s %s by %sCraftaro <3!", ChatColor.GRAY,
getDescription().getName(), getDescription().getVersion(), ChatColor.DARK_PURPLE));
console.sendMessage(String.format("%sAction: %s%s%s...", ChatColor.GRAY,
ChatColor.GREEN, "Enabling", ChatColor.GRAY));
@@ -155,7 +162,7 @@ public abstract class SongodaPlugin extends JavaPlugin {
console.sendMessage(" "); // blank line to separate chatter
console.sendMessage(ChatColor.GREEN + "=============================");
- console.sendMessage(String.format("%s%s %s by %sSongoda <3!", ChatColor.GRAY,
+ console.sendMessage(String.format("%s%s %s by %sCraftaro <3!", ChatColor.GRAY,
getDescription().getName(), getDescription().getVersion(), ChatColor.DARK_PURPLE));
console.sendMessage(String.format("%sAction: %s%s%s...", ChatColor.GRAY,
ChatColor.RED, "Disabling", ChatColor.GRAY));
@@ -229,7 +236,7 @@ public abstract class SongodaPlugin extends JavaPlugin {
if (unfinishedTasks > 0) {
getLogger().log(Level.WARNING,
String.format("A DataManager has been forcefully terminated with %d unfinished tasks - " +
- "This can be a serious problem, please report it to us (Songoda)!", unfinishedTasks));
+ "This can be a serious problem, please report it to us (Craftaro / Songoda)!", unfinishedTasks));
}
}
}
diff --git a/Core/src/main/java/com/songoda/core/commands/CommandManager.java b/Core/src/main/java/com/songoda/core/commands/CommandManager.java
index 7ddc6e98..2a97e2e1 100644
--- a/Core/src/main/java/com/songoda/core/commands/CommandManager.java
+++ b/Core/src/main/java/com/songoda/core/commands/CommandManager.java
@@ -372,6 +372,10 @@ public class CommandManager implements CommandExecutor, TabCompleter {
// Set tab complete
commandObject.setTabCompleter(tabManager);
+ if (command.equalsIgnoreCase("songoda")) {
+ commandObject.setAliases(Collections.singletonList("craftaro"));
+ }
+
// Register the command
Field fieldKnownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
fieldKnownCommands.setAccessible(true);
diff --git a/Core/src/main/java/com/songoda/core/commands/MainCommand.java b/Core/src/main/java/com/songoda/core/commands/MainCommand.java
index 3675a5a3..190fd543 100644
--- a/Core/src/main/java/com/songoda/core/commands/MainCommand.java
+++ b/Core/src/main/java/com/songoda/core/commands/MainCommand.java
@@ -65,7 +65,7 @@ public class MainCommand extends AbstractCommand {
.sendTo(sender);
}
- sender.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.YELLOW + "/songoda" + ChatColor.GRAY + " - Opens the Songoda plugin GUI");
+ sender.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.YELLOW + "/craftaro" + ChatColor.GRAY + " - Opens the Craftaro plugin GUI");
sender.sendMessage("");
if (nestedCommands != null) {
diff --git a/Core/src/main/java/com/songoda/core/core/SongodaCoreCommand.java b/Core/src/main/java/com/songoda/core/core/SongodaCoreCommand.java
index 945c594f..4a4769cf 100644
--- a/Core/src/main/java/com/songoda/core/core/SongodaCoreCommand.java
+++ b/Core/src/main/java/com/songoda/core/core/SongodaCoreCommand.java
@@ -12,7 +12,7 @@ public class SongodaCoreCommand extends AbstractCommand {
protected GuiManager guiManager;
public SongodaCoreCommand() {
- super(false, "songoda");
+ super(CommandType.CONSOLE_OK, "craftaro", "songoda");
}
@Override
@@ -24,7 +24,9 @@ public class SongodaCoreCommand extends AbstractCommand {
guiManager.showGUI((Player) sender, new SongodaCoreOverviewGUI());
} else {
- sender.sendMessage("/songoda diag");
+ sender.sendMessage("/craftaro diag");
+ sender.sendMessage("/craftaro myip");
+ sender.sendMessage("/craftaro uuid");
}
return ReturnType.SUCCESS;
@@ -37,7 +39,7 @@ public class SongodaCoreCommand extends AbstractCommand {
@Override
public String getSyntax() {
- return "/songoda";
+ return "/craftaro";
}
@Override
diff --git a/Core/src/main/java/com/songoda/core/core/SongodaCoreDiagCommand.java b/Core/src/main/java/com/songoda/core/core/SongodaCoreDiagCommand.java
index 04c2a94b..42e4103f 100644
--- a/Core/src/main/java/com/songoda/core/core/SongodaCoreDiagCommand.java
+++ b/Core/src/main/java/com/songoda/core/core/SongodaCoreDiagCommand.java
@@ -9,66 +9,26 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
import java.text.DecimalFormat;
import java.util.List;
public class SongodaCoreDiagCommand extends AbstractCommand {
- private final DecimalFormat format = new DecimalFormat("##.##");
+ private final DecimalFormat decimalFormat = new DecimalFormat("##.##");
- private Object serverInstance;
- private Field tpsField;
+ private Object nmsServerInstance;
+ private Field recentTpsOnNmsServer;
public SongodaCoreDiagCommand() {
super(CommandType.CONSOLE_OK, "diag");
try {
- serverInstance = ClassMapping.MINECRAFT_SERVER.getClazz().getMethod("getServer").invoke(null);
- tpsField = serverInstance.getClass().getField("recentTps");
- } catch (NoSuchFieldException | SecurityException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException | NoSuchMethodException ex) {
+ this.nmsServerInstance = ClassMapping.MINECRAFT_SERVER.getClazz().getMethod("getServer").invoke(null);
+ this.recentTpsOnNmsServer = this.nmsServerInstance.getClass().getField("recentTps");
+ } catch (ReflectiveOperationException | SecurityException | IllegalArgumentException ex) {
ex.printStackTrace();
}
}
- @Override
- protected ReturnType runCommand(CommandSender sender, String... args) {
- sender.sendMessage("");
- sender.sendMessage("Songoda Diagnostics Information");
- sender.sendMessage("");
- sender.sendMessage("Plugins:");
-
- for (PluginInfo plugin : SongodaCore.getPlugins()) {
- sender.sendMessage(plugin.getJavaPlugin().getName()
- + " (" + plugin.getJavaPlugin().getDescription().getVersion() + " Core " + plugin.getCoreLibraryVersion() + ")");
- }
-
- sender.sendMessage("");
- sender.sendMessage("Server Version: " + Bukkit.getVersion());
- sender.sendMessage("NMS: " + ServerProject.getServerVersion() + " " + ServerVersion.getServerVersionString());
- sender.sendMessage("Operating System: " + System.getProperty("os.name"));
- sender.sendMessage("Allocated Memory: " + format.format(Runtime.getRuntime().maxMemory() / (1024 * 1024)) + "Mb");
- sender.sendMessage("Online Players: " + Bukkit.getOnlinePlayers().size());
-
- if (tpsField != null) {
- try {
- double[] tps = ((double[]) tpsField.get(serverInstance));
-
- sender.sendMessage("TPS from last 1m, 5m, 15m: " + format.format(tps[0]) + ", "
- + format.format(tps[1]) + ", " + format.format(tps[2]));
- } catch (IllegalAccessException ex) {
- ex.printStackTrace();
- }
- }
-
- return ReturnType.SUCCESS;
- }
-
- @Override
- protected List onTab(CommandSender sender, String... args) {
- return null;
- }
-
@Override
public String getPermissionNode() {
return "songoda.admin";
@@ -76,11 +36,60 @@ public class SongodaCoreDiagCommand extends AbstractCommand {
@Override
public String getSyntax() {
- return "/songoda diag";
+ return "/craftaro diag";
}
@Override
public String getDescription() {
return "Display diagnostics information.";
}
+
+ @Override
+ protected ReturnType runCommand(CommandSender sender, String... args) {
+ sender.sendMessage("");
+ sender.sendMessage("Craftaro Diagnostics Information");
+ sender.sendMessage("");
+ sender.sendMessage("Plugins:");
+
+ for (PluginInfo plugin : SongodaCore.getPlugins()) {
+ sender.sendMessage(String.format("%s v%s (Core v%s)",
+ plugin.getJavaPlugin().getName(),
+ plugin.getJavaPlugin().getDescription().getVersion(),
+ plugin.getCoreLibraryVersion()));
+ }
+
+ sender.sendMessage("");
+ sender.sendMessage("Server Version: " + Bukkit.getVersion());
+ sender.sendMessage("NMS: " + ServerProject.getServerVersion() + " " + ServerVersion.getServerVersionString());
+ sender.sendMessage("Operating System: " + System.getProperty("os.name"));
+ sender.sendMessage("Allocated Memory: " + getRuntimeMaxMemory());
+ sender.sendMessage("Online Players: " + Bukkit.getOnlinePlayers().size());
+ sendCurrentTps(sender);
+ sender.sendMessage("");
+
+ return ReturnType.SUCCESS;
+ }
+
+ @Override
+ protected List onTab(CommandSender sender, String... args) {
+ return null;
+ }
+
+ private String getRuntimeMaxMemory() {
+ return this.decimalFormat.format(Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " MiB";
+ }
+
+ private void sendCurrentTps(CommandSender receiver) {
+ if (this.recentTpsOnNmsServer == null) {
+ return;
+ }
+
+ try {
+ double[] tps = ((double[]) this.recentTpsOnNmsServer.get(this.nmsServerInstance));
+
+ receiver.sendMessage(String.format("TPS from last 1m, 5m, 15m: %s, %s, %s", this.decimalFormat.format(tps[0]), this.decimalFormat.format(tps[1]), this.decimalFormat.format(tps[2])));
+ } catch (IllegalAccessException ex) {
+ ex.printStackTrace();
+ }
+ }
}
diff --git a/Core/src/main/java/com/songoda/core/core/SongodaCoreIPCommand.java b/Core/src/main/java/com/songoda/core/core/SongodaCoreIPCommand.java
index 6f0e8a8c..62745c64 100644
--- a/Core/src/main/java/com/songoda/core/core/SongodaCoreIPCommand.java
+++ b/Core/src/main/java/com/songoda/core/core/SongodaCoreIPCommand.java
@@ -63,7 +63,7 @@ public class SongodaCoreIPCommand extends AbstractCommand {
@Override
public String getSyntax() {
- return "/songoda myip";
+ return "/craftaro myip";
}
@Override
diff --git a/Core/src/main/java/com/songoda/core/core/SongodaCoreOverviewGUI.java b/Core/src/main/java/com/songoda/core/core/SongodaCoreOverviewGUI.java
index c5b743f3..60aa5b3d 100644
--- a/Core/src/main/java/com/songoda/core/core/SongodaCoreOverviewGUI.java
+++ b/Core/src/main/java/com/songoda/core/core/SongodaCoreOverviewGUI.java
@@ -16,7 +16,7 @@ final class SongodaCoreOverviewGUI extends Gui {
// could do pages, too, but don't think we'll have that many at a time for a while
int max = (int) Math.ceil(plugins.size() / 9.);
setRows(max);
- setTitle("Songoda Plugins");
+ setTitle("Craftaro Plugins");
// TODO: this could use some decorating
diff --git a/Core/src/main/java/com/songoda/core/core/SongodaCoreUUIDCommand.java b/Core/src/main/java/com/songoda/core/core/SongodaCoreUUIDCommand.java
index 0bcb10c6..72f42ccd 100644
--- a/Core/src/main/java/com/songoda/core/core/SongodaCoreUUIDCommand.java
+++ b/Core/src/main/java/com/songoda/core/core/SongodaCoreUUIDCommand.java
@@ -40,12 +40,12 @@ public class SongodaCoreUUIDCommand extends AbstractCommand {
@Override
public String getPermissionNode() {
- return "songodacore.admin";
+ return "songoda.admin";
}
@Override
public String getSyntax() {
- return "/songodacore uuid";
+ return "/craftaro uuid";
}
@Override
diff --git a/Core/src/main/java/com/songoda/core/gui/CustomizableGui.java b/Core/src/main/java/com/songoda/core/gui/CustomizableGui.java
index cc2fb1ac..f41c4d5b 100644
--- a/Core/src/main/java/com/songoda/core/gui/CustomizableGui.java
+++ b/Core/src/main/java/com/songoda/core/gui/CustomizableGui.java
@@ -60,7 +60,7 @@ public class CustomizableGui extends Gui {
"in this GUI.")
.setDefaultComment("overrides",
"For information on how to apply overrides please visit",
- "https://wiki.songoda.com/Gui");
+ "https://wiki.craftaro.com/index.php/Gui");
config.saveChanges();
}
diff --git a/Core/src/main/java/com/songoda/core/hooks/protection/LandsProtection.java b/Core/src/main/java/com/songoda/core/hooks/protection/LandsProtection.java
index cf73e7a6..0112e587 100644
--- a/Core/src/main/java/com/songoda/core/hooks/protection/LandsProtection.java
+++ b/Core/src/main/java/com/songoda/core/hooks/protection/LandsProtection.java
@@ -1,8 +1,9 @@
package com.songoda.core.hooks.protection;
-import me.angeschossen.lands.api.integration.LandsIntegration;
+import me.angeschossen.lands.api.LandsIntegration;
+import me.angeschossen.lands.api.flags.type.Flags;
+import me.angeschossen.lands.api.flags.type.RoleFlag;
import me.angeschossen.lands.api.land.Area;
-import me.angeschossen.lands.api.role.enums.RoleSetting;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -13,32 +14,31 @@ public class LandsProtection extends Protection {
public LandsProtection(Plugin plugin) {
super(plugin);
- this.landsIntegration = new LandsIntegration(plugin);
+ this.landsIntegration = LandsIntegration.of(plugin);
}
@Override
public boolean canPlace(Player player, Location location) {
- return hasPerms(player, location, RoleSetting.BLOCK_PLACE);
+ return hasPerms(player, location, Flags.BLOCK_PLACE);
}
@Override
public boolean canBreak(Player player, Location location) {
- return hasPerms(player, location, RoleSetting.BLOCK_BREAK);
+ return hasPerms(player, location, Flags.BLOCK_BREAK);
}
@Override
public boolean canInteract(Player player, Location location) {
- return hasPerms(player, location, RoleSetting.INTERACT_CONTAINER);
+ return hasPerms(player, location, Flags.INTERACT_CONTAINER);
}
- private boolean hasPerms(Player player, Location location, RoleSetting roleSetting) {
- Area area = landsIntegration.getAreaByLoc(location);
-
+ private boolean hasPerms(Player player, Location location, RoleFlag roleFlag) {
+ Area area = this.landsIntegration.getArea(location);
if (area == null) {
return true;
}
- return area.canSetting(player, roleSetting, false);
+ return area.getRole(player.getUniqueId()).hasFlag(roleFlag);
}
@Override
@@ -48,6 +48,6 @@ public class LandsProtection extends Protection {
@Override
public boolean isEnabled() {
- return landsIntegration != null;
+ return this.landsIntegration != null;
}
}
diff --git a/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java b/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java
index 40f00351..c4abb7e6 100644
--- a/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java
+++ b/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java
@@ -101,7 +101,7 @@ public class DropUtils {
Bukkit.getScheduler().runTask(SongodaCore.getHijackedPlugin(), () -> {
for (String command : commands) {
if (entity.getKiller() != null) {
- command = command.replace("%player%", entity.getKiller().getName());
+ command = command.replace("%player%", entity.getKiller().getName().replace("%x%", String.valueOf((int)entity.getLocation().getX())).replace("%y%", String.valueOf((int)entity.getLocation().getY())).replace("%z%", String.valueOf((int)entity.getLocation().getZ())));
}
if (!command.contains("%player%")) {
diff --git a/Core/src/main/java/com/songoda/core/lootables/loot/Loot.java b/Core/src/main/java/com/songoda/core/lootables/loot/Loot.java
index cb13e30e..d8d900a9 100644
--- a/Core/src/main/java/com/songoda/core/lootables/loot/Loot.java
+++ b/Core/src/main/java/com/songoda/core/lootables/loot/Loot.java
@@ -4,9 +4,11 @@ import com.google.gson.annotations.SerializedName;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.utils.ItemUtils;
import com.songoda.core.utils.TextUtils;
+import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import java.util.ArrayList;
import java.util.Arrays;
@@ -149,6 +151,25 @@ public class Loot {
return null;
}
+ //Create enchantment book
+ if (item.getType().equals(Material.ENCHANTED_BOOK)) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
+ for (Map.Entry entry : this.enchants.entrySet()) {
+ if (entry.getValue() == null) continue;
+
+ //TODO add random enchants
+// if (entry.getKey().equalsIgnoreCase("RANDOM")) {
+// item = ItemUtils.applyRandomEnchants(item, entry.getValue());
+//
+// continue;
+// }
+
+ meta.addStoredEnchant(Enchantment.getByName(entry.getKey()), entry.getValue(), true);
+ }
+ item.setItemMeta(meta);
+ return item;
+ }
+
Map enchants = new HashMap<>();
for (Map.Entry entry : this.enchants.entrySet()) {
if (entry.getValue() == null) continue;
diff --git a/Core/src/main/java/com/songoda/core/nms/NmsManager.java b/Core/src/main/java/com/songoda/core/nms/NmsManager.java
index 24c4939e..6e9faa6f 100644
--- a/Core/src/main/java/com/songoda/core/nms/NmsManager.java
+++ b/Core/src/main/java/com/songoda/core/nms/NmsManager.java
@@ -147,6 +147,12 @@ public class NmsManager {
nbt = new com.songoda.core.nms.v1_19_R2.nbt.NBTCoreImpl();
world = new com.songoda.core.nms.v1_19_R2.world.WorldCoreImpl();
break;
+ case "v1_19_R3":
+ player = new com.songoda.core.nms.v1_19_R3.entity.NMSPlayerImpl();
+ anvil = new com.songoda.core.nms.v1_19_R3.anvil.AnvilCore();
+ nbt = new com.songoda.core.nms.v1_19_R3.nbt.NBTCoreImpl();
+ world = new com.songoda.core.nms.v1_19_R3.world.WorldCoreImpl();
+ break;
default:
Logger.getLogger(NmsManager.class.getName()).log(Level.SEVERE, "Failed to load NMS for this server version: version {0} not found", serverPackageVersion);
diff --git a/Core/src/main/java/com/songoda/core/utils/SongodaAuth.java b/Core/src/main/java/com/songoda/core/utils/SongodaAuth.java
index e486d097..adfed7a0 100644
--- a/Core/src/main/java/com/songoda/core/utils/SongodaAuth.java
+++ b/Core/src/main/java/com/songoda/core/utils/SongodaAuth.java
@@ -1,116 +1,111 @@
package com.songoda.core.utils;
-import com.songoda.core.commands.AbstractCommand;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.impl.client.HttpClients;
import org.bukkit.Bukkit;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.MessageDigest;
import java.util.Properties;
import java.util.UUID;
public class SongodaAuth {
-
public static boolean isAuthorized(boolean allowOffline) {
String productId = "%%__PLUGIN__%%";
- try {
- Integer.parseInt(productId);
- } catch (NumberFormatException e) {
- //Self compiled, return true
+ if (isPluginSelfCompiled(productId)) {
return true;
}
- UUID uuid = getUUID();
+
+ UUID serverUuid = getUUID();
try {
URL url = new URL("https://marketplace.songoda.com/api/v2/products/license/validate");
- HttpURLConnection con = (HttpURLConnection)url.openConnection();
+ HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);
- String jsonInputString = "{\"product_id\":" + productId + ",\"license\":\"" + uuid + "\",\"user_id\":\"%%__USER__%%\"}";
- try(OutputStream os = con.getOutputStream()) {
- byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
- os.write(input, 0, input.length);
+
+ String requestBodyJson = "{\"product_id\":" + productId + ",\"license\":\"" + serverUuid + "\",\"user_id\":\"%%__USER__%%\"}";
+ try (OutputStream os = con.getOutputStream()) {
+ byte[] requestBody = requestBodyJson.getBytes(StandardCharsets.UTF_8);
+ os.write(requestBody, 0, requestBody.length);
}
- try(BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) {
- StringBuilder response = new StringBuilder();
- String responseLine = null;
- while ((responseLine = br.readLine()) != null) {
- response.append(responseLine.trim());
- }
- JSONObject jsonObject = (JSONObject) new JSONParser().parse(response.toString());
- if (jsonObject.get("error") != null) {
- //Got an error, return false and print error
- Bukkit.getLogger().warning("Error validating license: " + jsonObject.get("error"));
- return false;
- } else {
- return (boolean) jsonObject.get("valid");
- }
+ JSONObject jsonResponse = readHttpResponseJson(con);
+ if (jsonResponse.containsKey("error")) {
+ Bukkit.getLogger().warning("Error validating license: " + jsonResponse.get("error"));
+ return false;
}
- } catch (Exception e) {
+
+ return (boolean) jsonResponse.get("valid");
+ } catch (Exception ex) {
return allowOffline;
}
}
public static UUID getUUID() {
- File serverProperties = new File(new File("."),"server.properties");
- Properties prop = new Properties();
+ File serverProperties = new File("./server.properties");
try {
+ Properties prop = new Properties();
prop.load(new FileReader(serverProperties));
+
String uuid = prop.getProperty("uuid");
- if (uuid == null || uuid.isEmpty()) {
- UUID newUUID = UUID.randomUUID();
- prop.setProperty("uuid", newUUID.toString());
- prop.store(new FileWriter(serverProperties), null);
- return newUUID;
- } else {
+ if (uuid != null && !uuid.isEmpty()) {
return UUID.fromString(uuid);
}
+
+ UUID newUUID = UUID.randomUUID();
+ prop.setProperty("uuid", newUUID.toString());
+ prop.store(new FileWriter(serverProperties), null);
+ return newUUID;
} catch (Exception ex) {
- throw new RuntimeException("Could not fetch UUID for server", ex);
+ throw new RuntimeException("Could not determine UUID for server", ex);
}
}
public static String getIP() {
try {
URL url = new URL("https://marketplace.songoda.com/api/v2/products/license/ip");
- HttpURLConnection con = (HttpURLConnection)url.openConnection();
+ HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
- con.setDoOutput(true);
- try(BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) {
- StringBuilder response = new StringBuilder();
- String responseLine = null;
- while ((responseLine = br.readLine()) != null) {
- response.append(responseLine.trim());
- }
- JSONParser parser = new JSONParser();
- JSONObject jsonObject = (JSONObject) parser.parse(response.toString());
- return jsonObject.get("ip").toString();
- }
+
+ JSONObject jsonResponse = readHttpResponseJson(con);
+ return jsonResponse.get("ip").toString();
} catch (Exception ex) {
throw new RuntimeException("Could not fetch IP address", ex);
}
}
+
+ private static JSONObject readHttpResponseJson(HttpURLConnection con) throws IOException, ParseException {
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) {
+ StringBuilder response = new StringBuilder();
+
+ String responseLine;
+ while ((responseLine = br.readLine()) != null) {
+ response.append(responseLine.trim());
+ }
+
+ return (JSONObject) new JSONParser().parse(response.toString());
+ }
+ }
+
+ private static boolean isPluginSelfCompiled(String productId) {
+ try {
+ Integer.parseInt(productId);
+ return false;
+ } catch (NumberFormatException ignore) {
+ }
+
+ return true;
+ }
}
diff --git a/LICENSE b/LICENSE
index f288702d..63286002 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,327 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
+Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
+International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-NonCommercial-NoDerivatives 4.0 International Public
+License ("Public License"). To the extent this Public License may be
+interpreted as a contract, You are granted the Licensed Rights in
+consideration of Your acceptance of these terms and conditions, and the
+Licensor grants You such rights in consideration of benefits the
+Licensor receives from making the Licensed Material available under
+these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ c. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ d. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ e. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ f. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ g. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ h. NonCommercial means not primarily intended for or directed towards
+ commercial advantage or monetary compensation. For purposes of
+ this Public License, the exchange of the Licensed Material for
+ other material subject to Copyright and Similar Rights by digital
+ file-sharing or similar means is NonCommercial provided there is
+ no payment of monetary compensation in connection with the
+ exchange.
+
+ i. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ j. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ k. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part, for NonCommercial purposes only; and
+
+ b. produce and reproduce, but not Share, Adapted Material
+ for NonCommercial purposes only.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties, including when
+ the Licensed Material is used other than for NonCommercial
+ purposes.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material, You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ For the avoidance of doubt, You do not have permission under
+ this Public License to Share Adapted Material.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database for NonCommercial purposes
+ only and provided You do not Share Adapted Material;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material; and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+=======================================================================
diff --git a/NMS/NMS-API/pom.xml b/NMS/NMS-API/pom.xml
index 9f837d2a..54653ced 100644
--- a/NMS/NMS-API/pom.xml
+++ b/NMS/NMS-API/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_10_R1/pom.xml b/NMS/NMS-v1_10_R1/pom.xml
index 236fb363..3eedb030 100644
--- a/NMS/NMS-v1_10_R1/pom.xml
+++ b/NMS/NMS-v1_10_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_11_R1/pom.xml b/NMS/NMS-v1_11_R1/pom.xml
index f59cc539..0c9f6cf1 100644
--- a/NMS/NMS-v1_11_R1/pom.xml
+++ b/NMS/NMS-v1_11_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_12_R1/pom.xml b/NMS/NMS-v1_12_R1/pom.xml
index fcc3fa2c..55f19bb1 100644
--- a/NMS/NMS-v1_12_R1/pom.xml
+++ b/NMS/NMS-v1_12_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_13_R1/pom.xml b/NMS/NMS-v1_13_R1/pom.xml
index c933b9e4..b8275b07 100644
--- a/NMS/NMS-v1_13_R1/pom.xml
+++ b/NMS/NMS-v1_13_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_13_R2/pom.xml b/NMS/NMS-v1_13_R2/pom.xml
index 52d6a1f0..adf4ea90 100644
--- a/NMS/NMS-v1_13_R2/pom.xml
+++ b/NMS/NMS-v1_13_R2/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_14_R1/pom.xml b/NMS/NMS-v1_14_R1/pom.xml
index 2263f18a..e3516501 100644
--- a/NMS/NMS-v1_14_R1/pom.xml
+++ b/NMS/NMS-v1_14_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_15_R1/pom.xml b/NMS/NMS-v1_15_R1/pom.xml
index 5a7e4774..5b2d8e47 100644
--- a/NMS/NMS-v1_15_R1/pom.xml
+++ b/NMS/NMS-v1_15_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_16_R1/pom.xml b/NMS/NMS-v1_16_R1/pom.xml
index a94664ea..5f4ba56d 100644
--- a/NMS/NMS-v1_16_R1/pom.xml
+++ b/NMS/NMS-v1_16_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_16_R2/pom.xml b/NMS/NMS-v1_16_R2/pom.xml
index 99b7080b..1cf5ed06 100644
--- a/NMS/NMS-v1_16_R2/pom.xml
+++ b/NMS/NMS-v1_16_R2/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_16_R3/pom.xml b/NMS/NMS-v1_16_R3/pom.xml
index 3108af55..680b913f 100644
--- a/NMS/NMS-v1_16_R3/pom.xml
+++ b/NMS/NMS-v1_16_R3/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_17_R1/pom.xml b/NMS/NMS-v1_17_R1/pom.xml
index 74182a43..21e00633 100644
--- a/NMS/NMS-v1_17_R1/pom.xml
+++ b/NMS/NMS-v1_17_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_18_R1/pom.xml b/NMS/NMS-v1_18_R1/pom.xml
index c2523f17..5e1dbb91 100644
--- a/NMS/NMS-v1_18_R1/pom.xml
+++ b/NMS/NMS-v1_18_R1/pom.xml
@@ -19,7 +19,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_18_R2/pom.xml b/NMS/NMS-v1_18_R2/pom.xml
index 521397c0..65ce83a2 100644
--- a/NMS/NMS-v1_18_R2/pom.xml
+++ b/NMS/NMS-v1_18_R2/pom.xml
@@ -60,7 +60,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_19_R1/pom.xml b/NMS/NMS-v1_19_R1/pom.xml
index f67d44b6..078319cc 100644
--- a/NMS/NMS-v1_19_R1/pom.xml
+++ b/NMS/NMS-v1_19_R1/pom.xml
@@ -60,7 +60,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_19_R1v2/pom.xml b/NMS/NMS-v1_19_R1v2/pom.xml
index f86f796c..69bab071 100644
--- a/NMS/NMS-v1_19_R1v2/pom.xml
+++ b/NMS/NMS-v1_19_R1v2/pom.xml
@@ -60,7 +60,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_19_R2/pom.xml b/NMS/NMS-v1_19_R2/pom.xml
index 5f72ec24..0773ce86 100644
--- a/NMS/NMS-v1_19_R2/pom.xml
+++ b/NMS/NMS-v1_19_R2/pom.xml
@@ -60,7 +60,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_19_R3/pom.xml b/NMS/NMS-v1_19_R3/pom.xml
new file mode 100644
index 00000000..1b638b7b
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/pom.xml
@@ -0,0 +1,105 @@
+
+
+ 4.0.0
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${java.version}
+ ${java.version}
+
+ ${java.release}
+
+
+
+
+ net.md-5
+ specialsource-maven-plugin
+ 1.2.4
+
+
+
+ remap-obf
+ package
+
+ remap
+
+
+
+ org.spigotmc:minecraft-server:${nms.ver}:txt:maps-mojang
+ true
+ org.spigotmc:spigot:${nms.ver}:jar:remapped-mojang
+ true
+ remapped-obf
+
+
+
+
+ remap-spigot
+ package
+
+ remap
+
+
+
+ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
+ org.spigotmc:minecraft-server:${nms.ver}:csrg:maps-spigot
+ org.spigotmc:spigot:${nms.ver}:jar:remapped-obf
+
+
+
+
+
+
+
+
+ com.songoda
+ SongodaCore-Modules
+ 2.6.19
+ ../../pom.xml
+
+
+
+ 17
+ 17
+
+ 1.19.4-R0.1-SNAPSHOT
+
+
+ SongodaCore-NMS-v1_19_R3
+ jar
+
+
+
+ org.spigotmc
+ spigot-api
+ ${nms.ver}
+ provided
+
+
+
+ org.spigotmc
+ spigot
+ ${nms.ver}
+ provided
+ remapped-mojang
+
+
+
+ ${project.groupId}
+ SongodaCore-NMS-API
+ ${project.version}
+
+
+
+ ${project.groupId}
+ SongodaCore-Compatibility
+ ${project.version}
+
+
+
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilCore.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilCore.java
new file mode 100644
index 00000000..ceb3674f
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilCore.java
@@ -0,0 +1,21 @@
+package com.songoda.core.nms.v1_19_R3.anvil;
+
+import com.songoda.core.nms.anvil.CustomAnvil;
+import net.minecraft.server.level.ServerPlayer;
+import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.InventoryHolder;
+
+public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
+ @Override
+ public CustomAnvil createAnvil(Player player) {
+ ServerPlayer p = ((CraftPlayer) player).getHandle();
+ return new AnvilView(p.nextContainerCounter(), p, null);
+ }
+
+ @Override
+ public CustomAnvil createAnvil(Player player, InventoryHolder holder) {
+ ServerPlayer p = ((CraftPlayer) player).getHandle();
+ return new AnvilView(p.nextContainerCounter(), p, holder);
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilInventoryCustom.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilInventoryCustom.java
new file mode 100644
index 00000000..a24d9583
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilInventoryCustom.java
@@ -0,0 +1,22 @@
+package com.songoda.core.nms.v1_19_R3.anvil;
+
+import net.minecraft.world.Container;
+import net.minecraft.world.inventory.AnvilMenu;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryAnvil;
+import org.bukkit.inventory.InventoryHolder;
+
+public class AnvilInventoryCustom extends CraftInventoryAnvil {
+ final InventoryHolder holder;
+
+ public AnvilInventoryCustom(InventoryHolder holder, Location location, Container inventory, Container resultInventory, AnvilMenu container) {
+ super(location, inventory, resultInventory, container);
+
+ this.holder = holder;
+ }
+
+ @Override
+ public InventoryHolder getHolder() {
+ return holder;
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilView.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilView.java
new file mode 100644
index 00000000..b9b1ea5a
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/anvil/AnvilView.java
@@ -0,0 +1,216 @@
+package com.songoda.core.nms.v1_19_R3.anvil;
+
+import com.songoda.core.nms.anvil.CustomAnvil;
+import com.songoda.core.nms.anvil.methods.AnvilTextChange;
+import net.md_5.bungee.api.chat.TranslatableComponent;
+import net.minecraft.core.BlockPos;
+import net.minecraft.network.chat.MutableComponent;
+import net.minecraft.network.chat.contents.TranslatableContents;
+import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.Container;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.inventory.AnvilMenu;
+import net.minecraft.world.inventory.ContainerLevelAccess;
+import net.minecraft.world.inventory.ItemCombinerMenu;
+import net.minecraft.world.inventory.MenuType;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryView;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemStack;
+
+import java.lang.reflect.Field;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class AnvilView extends AnvilMenu implements CustomAnvil {
+ private final ServerPlayer entity;
+ private final Inventory inventory;
+ private String customTitle = "Repairing";
+ private int cost = -1;
+ private boolean canUse = true;
+ private AnvilTextChange textChange;
+
+ // used for setting custom inventory
+ static Field mc_ContainerAnvil_repairInventory; // subcontainer with only the result
+ static Field mc_ContainerAnvil_resultInventory; // full inventory
+ static Field mc_ContainerAnvil_bukkitEntity;
+
+ static {
+ try {
+ mc_ContainerAnvil_repairInventory = ItemCombinerMenu.class.getDeclaredField("q");
+ mc_ContainerAnvil_repairInventory.setAccessible(true);
+
+ mc_ContainerAnvil_resultInventory = ItemCombinerMenu.class.getDeclaredField("r");
+ mc_ContainerAnvil_resultInventory.setAccessible(true);
+
+ mc_ContainerAnvil_bukkitEntity = AnvilMenu.class.getDeclaredField("bukkitEntity");
+ mc_ContainerAnvil_bukkitEntity.setAccessible(true);
+ } catch (Exception ex) {
+ Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
+ }
+ }
+
+ // 1.14 also introduced a title field, also private, which can only be set once and can't be checked
+ static Field mc_Container_title;
+
+ static {
+ try {
+ mc_Container_title = AbstractContainerMenu.class.getDeclaredField("title");
+ mc_Container_title.setAccessible(true);
+ } catch (Exception ex) {
+ Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
+ }
+ }
+
+ public AnvilView(int id, ServerPlayer entity, InventoryHolder holder) {
+ super(entity.nextContainerCounter(), entity.getInventory(), ContainerLevelAccess.create(entity.level, new BlockPos(0, 0, 0)));
+
+ this.setTitle(MutableComponent.create(new TranslatableContents(this.customTitle != null ? this.customTitle : "", this.customTitle != null ? this.customTitle : "", new Object[0])));
+ this.checkReachable = false;
+ this.entity = entity;
+
+ if (holder != null) {
+ this.inventory = getBukkitView(entity, holder).getTopInventory();
+ } else {
+ this.inventory = getBukkitView().getTopInventory();
+ }
+ }
+
+ public CraftInventoryView getBukkitView(Player player, InventoryHolder holder) {
+ try {
+ AnvilInventoryCustom craftInventory = new AnvilInventoryCustom(holder,
+ new Location(entity.level.getWorld(), 0, 0, 0),
+ (Container) mc_ContainerAnvil_repairInventory.get(this),
+ (Container) mc_ContainerAnvil_resultInventory.get(this), this);
+ CraftInventoryView view = new CraftInventoryView(player.getBukkitEntity(), craftInventory, this);
+ mc_ContainerAnvil_bukkitEntity.set(this, view);
+
+ return view;
+ } catch (Exception ex) {
+ Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
+ }
+
+ return getBukkitView();
+ }
+
+ @Override
+ public boolean stillValid(Player entityHuman) {
+ return canUse;
+ }
+
+ @Override
+ public void broadcastFullState() {
+ super.broadcastFullState();
+
+ if (cost >= 0) {
+ this.setLevelCost(cost);
+ }
+
+ textChange.onChange();
+ }
+
+ @Override
+ public void update() {
+ broadcastFullState();
+ }
+
+ @Override
+ public String getRenameText() {
+ return this.itemName;
+ }
+
+ @Override
+ public void setRenameText(String text) {
+ this.setItemName(text);
+ }
+
+ @Override
+ public void setOnChange(AnvilTextChange handler) {
+ textChange = handler;
+ }
+
+ @Override
+ public String getCustomTitle() {
+ return customTitle;
+ }
+
+ @Override
+ public void setCustomTitle(String title) {
+ this.customTitle = title;
+
+ try {
+ mc_Container_title.set(this, MutableComponent.create(new TranslatableContents(this.customTitle != null ? this.customTitle : "", this.customTitle != null ? this.customTitle : "", new Object[0])));
+ } catch (Exception ex) {
+ Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Error", ex);
+ }
+ }
+
+ @Override
+ public void setLevelCost(int cost) {
+ this.cost = cost;
+ }
+
+ @Override
+ public int getLevelCost() {
+ if (cost >= 0) {
+ return cost;
+ }
+
+ return this.getLevelCost();
+ }
+
+ @Override
+ public void setCanUse(boolean bool) {
+ this.canUse = bool;
+ }
+
+ @Override
+ public ItemStack getLeftInput() {
+ return inventory.getItem(0);
+ }
+
+ @Override
+ public ItemStack getRightInput() {
+ return inventory.getItem(1);
+ }
+
+ @Override
+ public ItemStack getOutput() {
+ return inventory.getItem(2);
+ }
+
+ @Override
+ public void setLeftInput(ItemStack item) {
+ inventory.setItem(0, item);
+ }
+
+ @Override
+ public void setRightInput(ItemStack item) {
+ inventory.setItem(1, item);
+ }
+
+ @Override
+ public void setOutput(ItemStack item) {
+ inventory.setItem(2, item);
+ }
+
+ @Override
+ public Inventory getInventory() {
+ return inventory;
+ }
+
+ @Override
+ public void open() {
+ // Send the packet
+ entity.connection.send(new ClientboundOpenScreenPacket(super.containerId, MenuType.ANVIL, MutableComponent.create(new TranslatableContents(this.customTitle != null ? this.customTitle : "", this.customTitle != null ? this.customTitle : "", new Object[0]))));
+
+ // Set their active container to this anvil
+ entity.containerMenu = this;
+
+ // Add the slot listener
+ entity.initMenu(entity.containerMenu);
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/entity/NMSPlayerImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/entity/NMSPlayerImpl.java
new file mode 100644
index 00000000..4f457b36
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/entity/NMSPlayerImpl.java
@@ -0,0 +1,13 @@
+package com.songoda.core.nms.v1_19_R3.entity;
+
+import com.songoda.core.nms.entity.NMSPlayer;
+import net.minecraft.network.protocol.Packet;
+import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class NMSPlayerImpl implements NMSPlayer {
+ @Override
+ public void sendPacket(Player p, Object packet) {
+ ((CraftPlayer) p).getHandle().connection.send((Packet>) packet);
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCompoundImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCompoundImpl.java
new file mode 100644
index 00000000..f0c3b52e
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCompoundImpl.java
@@ -0,0 +1,208 @@
+package com.songoda.core.nms.v1_19_R3.nbt;
+
+import com.songoda.core.nms.nbt.NBTCompound;
+import com.songoda.core.nms.nbt.NBTObject;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.NbtIo;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Set;
+import java.util.UUID;
+
+public class NBTCompoundImpl implements NBTCompound {
+ protected CompoundTag compound;
+
+ protected NBTCompoundImpl(CompoundTag compound) {
+ this.compound = compound;
+ }
+
+ public NBTCompoundImpl() {
+ this.compound = new CompoundTag();
+ }
+
+ @Override
+ public NBTCompound set(String tag, String s) {
+ compound.putString(tag, s);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, boolean b) {
+ compound.putBoolean(tag, b);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, int i) {
+ compound.putInt(tag, i);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, double i) {
+ compound.putDouble(tag, i);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, long l) {
+ compound.putLong(tag, l);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, short s) {
+ compound.putShort(tag, s);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, byte b) {
+ compound.putByte(tag, b);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, int[] i) {
+ compound.putIntArray(tag, i);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, byte[] b) {
+ compound.putByteArray(tag, b);
+ return this;
+ }
+
+ @Override
+ public NBTCompound set(String tag, UUID u) {
+ compound.putUUID(tag, u);
+ return this;
+ }
+
+ @Override
+ public NBTCompound remove(String tag) {
+ compound.remove(tag);
+ return this;
+ }
+
+ @Override
+ public boolean has(String tag) {
+ return compound.contains(tag);
+ }
+
+ @Override
+ public NBTObject getNBTObject(String tag) {
+ return new NBTObjectImpl(compound, tag);
+ }
+
+ @Override
+ public String getString(String tag) {
+ return getNBTObject(tag).asString();
+ }
+
+ @Override
+ public boolean getBoolean(String tag) {
+ return getNBTObject(tag).asBoolean();
+ }
+
+ @Override
+ public int getInt(String tag) {
+ return getNBTObject(tag).asInt();
+ }
+
+ @Override
+ public double getDouble(String tag) {
+ return getNBTObject(tag).asDouble();
+ }
+
+ @Override
+ public long getLong(String tag) {
+ return getNBTObject(tag).asLong();
+ }
+
+ @Override
+ public short getShort(String tag) {
+ return getNBTObject(tag).asShort();
+ }
+
+ @Override
+ public byte getByte(String tag) {
+ return getNBTObject(tag).asByte();
+ }
+
+ @Override
+ public int[] getIntArray(String tag) {
+ return getNBTObject(tag).asIntArray();
+ }
+
+ @Override
+ public byte[] getByteArray(String tag) {
+ return getNBTObject(tag).asByteArray();
+ }
+
+ @Override
+ public NBTCompound getCompound(String tag) {
+ if (has(tag)) {
+ return getNBTObject(tag).asCompound();
+ }
+
+ CompoundTag newCompound = new CompoundTag();
+ compound.put(tag, newCompound);
+ return new NBTCompoundImpl(newCompound);
+ }
+
+ @Override
+ public Set getKeys() {
+ return compound.getAllKeys();
+ }
+
+ @Override
+ public Set getKeys(String tag) {
+ return compound.getCompound(tag).getAllKeys();
+ }
+
+ @Override
+ public byte[] serialize(String... exclusions) {
+ try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ ObjectOutputStream dataOutput = new ObjectOutputStream(outputStream)) {
+ addExtras();
+ CompoundTag compound = this.compound.copy();
+
+ for (String exclusion : exclusions) {
+ compound.remove(exclusion);
+ }
+
+ NbtIo.writeCompressed(compound, dataOutput);
+
+ return outputStream.toByteArray();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void deSerialize(byte[] serialized) {
+ try (ByteArrayInputStream inputStream = new ByteArrayInputStream(serialized);
+ ObjectInputStream dataInput = new ObjectInputStream(inputStream)) {
+ compound = NbtIo.readCompressed(dataInput);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Override
+ public void addExtras() {
+ // None
+ }
+
+ @Override
+ public String toString() {
+ return compound.toString();
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCoreImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCoreImpl.java
new file mode 100644
index 00000000..f18fe100
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTCoreImpl.java
@@ -0,0 +1,38 @@
+package com.songoda.core.nms.v1_19_R3.nbt;
+
+import com.songoda.core.nms.nbt.NBTCore;
+import com.songoda.core.nms.nbt.NBTEntity;
+import com.songoda.core.nms.nbt.NBTItem;
+import net.minecraft.nbt.CompoundTag;
+import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
+import org.bukkit.entity.Entity;
+import org.bukkit.inventory.ItemStack;
+
+public class NBTCoreImpl implements NBTCore {
+ @Deprecated
+ @Override
+ public NBTItem of(ItemStack item) {
+ return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
+ }
+
+ @Deprecated
+ @Override
+ public NBTItem newItem() {
+ return new NBTItemImpl(null);
+ }
+
+ @Override
+ public NBTEntity of(Entity entity) {
+ net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle();
+ CompoundTag nbt = new CompoundTag();
+ nmsEntity.saveWithoutId(nbt);
+
+ return new NBTEntityImpl(nbt, nmsEntity);
+ }
+
+ @Override
+ public NBTEntity newEntity() {
+ return new NBTEntityImpl(new CompoundTag(), null);
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTEntityImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTEntityImpl.java
new file mode 100644
index 00000000..8b38113a
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTEntityImpl.java
@@ -0,0 +1,67 @@
+package com.songoda.core.nms.v1_19_R3.nbt;
+
+import com.songoda.core.nms.nbt.NBTEntity;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Registry;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.MobSpawnType;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
+
+import java.util.Optional;
+
+public class NBTEntityImpl extends NBTCompoundImpl implements NBTEntity {
+ private Entity nmsEntity;
+
+ public NBTEntityImpl(CompoundTag entityNBT, Entity nmsEntity) {
+ super(entityNBT);
+
+ this.nmsEntity = nmsEntity;
+ }
+
+ @Override
+ public org.bukkit.entity.Entity spawn(Location location) {
+ String entityType = getNBTObject("entity_type").asString();
+ getKeys().remove("UUID");
+
+ Optional> optionalEntity = EntityType.byString(entityType);
+ if (optionalEntity.isPresent()) {
+ assert location.getWorld() != null;
+
+ Entity spawned = optionalEntity.get().spawn(
+ ((CraftWorld) location.getWorld()).getHandle(),
+ compound,
+ null,
+ new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()),
+ MobSpawnType.COMMAND,
+ true,
+ false
+ );
+
+ if (spawned != null) {
+ spawned.load(compound);
+ org.bukkit.entity.Entity entity = spawned.getBukkitEntity();
+ entity.teleport(location);
+ nmsEntity = spawned;
+
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public org.bukkit.entity.Entity reSpawn(Location location) {
+ nmsEntity.discard();
+ return spawn(location);
+ }
+
+ @Override
+ public void addExtras() {
+ compound.putString("entity_type", BuiltInRegistries.ENTITY_TYPE.getKey(nmsEntity.getType()).toString());
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTItemImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTItemImpl.java
new file mode 100644
index 00000000..bdffd1fd
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTItemImpl.java
@@ -0,0 +1,24 @@
+package com.songoda.core.nms.v1_19_R3.nbt;
+
+import com.songoda.core.nms.nbt.NBTItem;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.item.ItemStack;
+import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
+
+public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
+ private final ItemStack nmsItem;
+
+ public NBTItemImpl(ItemStack nmsItem) {
+ super(nmsItem != null && nmsItem.hasTag() ? nmsItem.getTag() : new CompoundTag());
+
+ this.nmsItem = nmsItem;
+ }
+
+ public org.bukkit.inventory.ItemStack finish() {
+ if (nmsItem == null) {
+ return CraftItemStack.asBukkitCopy(ItemStack.of(compound));
+ }
+
+ return CraftItemStack.asBukkitCopy(nmsItem);
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTObjectImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTObjectImpl.java
new file mode 100644
index 00000000..1f3cb708
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/nbt/NBTObjectImpl.java
@@ -0,0 +1,72 @@
+package com.songoda.core.nms.v1_19_R3.nbt;
+
+import com.songoda.core.nms.nbt.NBTCompound;
+import com.songoda.core.nms.nbt.NBTObject;
+import net.minecraft.nbt.CompoundTag;
+
+import java.util.Set;
+
+public class NBTObjectImpl implements NBTObject {
+ private final CompoundTag compound;
+ private final String tag;
+
+ public NBTObjectImpl(CompoundTag compound, String tag) {
+ this.compound = compound;
+ this.tag = tag;
+ }
+
+ @Override
+ public String asString() {
+ return compound.getString(tag);
+ }
+
+ @Override
+ public boolean asBoolean() {
+ return compound.getBoolean(tag);
+ }
+
+ @Override
+ public int asInt() {
+ return compound.getInt(tag);
+ }
+
+ @Override
+ public double asDouble() {
+ return compound.getDouble(tag);
+ }
+
+ @Override
+ public long asLong() {
+ return compound.getLong(tag);
+ }
+
+ @Override
+ public short asShort() {
+ return compound.getShort(tag);
+ }
+
+ @Override
+ public byte asByte() {
+ return compound.getByte(tag);
+ }
+
+ @Override
+ public int[] asIntArray() {
+ return compound.getIntArray(tag);
+ }
+
+ @Override
+ public byte[] asByteArray() {
+ return compound.getByteArray(tag);
+ }
+
+ @Override
+ public NBTCompound asCompound() {
+ return new NBTCompoundImpl(compound.getCompound(tag));
+ }
+
+ @Override
+ public Set getKeys() {
+ return compound.getAllKeys();
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SItemStackImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SItemStackImpl.java
new file mode 100644
index 00000000..5aafa871
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SItemStackImpl.java
@@ -0,0 +1,39 @@
+package com.songoda.core.nms.v1_19_R3.world;
+
+import com.songoda.core.nms.world.SItemStack;
+import net.minecraft.core.particles.ItemParticleOption;
+import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.phys.Vec3;
+import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+public class SItemStackImpl implements SItemStack {
+ private final ItemStack item;
+
+ public SItemStackImpl(ItemStack item) {
+ this.item = item;
+ }
+
+ @Override
+ public void breakItem(Player player, int amount) {
+ ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
+
+ for (int i = 0; i < amount; ++i) {
+ Vec3 vec3d = new Vec3(((double) random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
+ vec3d = vec3d.xRot(-entityPlayer.getXRot() * 0.017453292F);
+ vec3d = vec3d.yRot(-entityPlayer.getYRot() * 0.017453292F);
+
+ double d0 = (double) (-random.nextFloat()) * 0.6D - 0.3D;
+
+ Vec3 vec3d1 = new Vec3(((double) random.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
+ vec3d1 = vec3d1.xRot(-entityPlayer.getXRot() * 0.017453292F);
+ vec3d1 = vec3d1.yRot(-entityPlayer.getYRot() * 0.017453292F);
+ vec3d1 = vec3d1.add(entityPlayer.getX(), entityPlayer.getEyeY(), entityPlayer.getZ());
+
+ entityPlayer.level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, CraftItemStack.asNMSCopy(item)), vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y + 0.05D, vec3d.z);
+ }
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SSpawnerImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SSpawnerImpl.java
new file mode 100644
index 00000000..7dd731fa
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SSpawnerImpl.java
@@ -0,0 +1,132 @@
+package com.songoda.core.nms.v1_19_R3.world;
+
+import com.songoda.core.compatibility.CompatibleMaterial;
+import com.songoda.core.compatibility.CompatibleParticleHandler;
+import com.songoda.core.nms.world.SSpawner;
+import com.songoda.core.nms.world.SpawnedEntity;
+import net.minecraft.core.BlockPos;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.DifficultyInstance;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.MobSpawnType;
+import net.minecraft.world.level.SpawnData;
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+import java.util.Optional;
+import java.util.Set;
+
+public class SSpawnerImpl implements SSpawner {
+ private final Location spawnerLocation;
+
+ public SSpawnerImpl(Location location) {
+ this.spawnerLocation = location;
+ }
+
+ @Override
+ public LivingEntity spawnEntity(EntityType type, Location spawnerLocation) {
+ return spawnEntity(type, "EXPLOSION_NORMAL", null, null);
+ }
+
+ @Override
+ public LivingEntity spawnEntity(EntityType type, String particleType, SpawnedEntity spawned, Set canSpawnOn) {
+ SpawnData data = new SpawnData();
+ CompoundTag compound = data.getEntityToSpawn();
+
+ String name = type.name().toLowerCase().replace("snowman", "snow_golem")
+ .replace("mushroom_cow", "mooshroom");
+ compound.putString("id", "minecraft:" + name);
+
+ short spawnRange = 4;
+ for (int i = 0; i < 50; i++) {
+ assert spawnerLocation.getWorld() != null;
+ ServerLevel world = ((CraftWorld) spawnerLocation.getWorld()).getHandle();
+
+ RandomSource random = world.getRandom();
+ double x = spawnerLocation.getX() + (random.nextDouble() - random.nextDouble()) * (double) spawnRange + 0.5D;
+ double y = spawnerLocation.getY() + random.nextInt(3) - 1;
+ double z = spawnerLocation.getZ() + (random.nextDouble() - random.nextDouble()) * (double) spawnRange + 0.5D;
+
+ Optional optionalEntity = net.minecraft.world.entity.EntityType.create(compound, world);
+ if (optionalEntity.isEmpty()) continue;
+
+ Entity entity = optionalEntity.get();
+ entity.setPos(x, y, z);
+
+ BlockPos position = entity.blockPosition();
+ DifficultyInstance damageScaler = world.getCurrentDifficultyAt(position);
+
+ if (!(entity instanceof Mob entityInsentient)) {
+ continue;
+ }
+
+ Location spot = new Location(spawnerLocation.getWorld(), x, y, z);
+
+ if (!canSpawn(world, entityInsentient, spot, canSpawnOn)) {
+ continue;
+ }
+
+ entityInsentient.finalizeSpawn(world, damageScaler, MobSpawnType.SPAWNER, null, null);
+
+ LivingEntity craftEntity = (LivingEntity) entity.getBukkitEntity();
+
+ if (spawned != null && !spawned.onSpawn(craftEntity)) {
+ return null;
+ }
+
+ if (particleType != null) {
+ float xx = (float) (0 + (Math.random() * 1));
+ float yy = (float) (0 + (Math.random() * 2));
+ float zz = (float) (0 + (Math.random() * 1));
+
+ CompatibleParticleHandler.spawnParticles(CompatibleParticleHandler.ParticleType.getParticle(particleType), spot, 5, xx, yy, zz, 0);
+ }
+
+ world.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER);
+
+ spot.setYaw(random.nextFloat() * 360.0F);
+ craftEntity.teleport(spot);
+
+ return craftEntity;
+ }
+
+ return null;
+ }
+
+ private boolean canSpawn(ServerLevel world, Mob entityInsentient, Location location, Set canSpawnOn) {
+ if (!world.noCollision(entityInsentient, entityInsentient.getBoundingBox())) {
+ return false;
+ }
+
+ CompatibleMaterial spawnedIn = CompatibleMaterial.getMaterial(location.getBlock());
+ CompatibleMaterial spawnedOn = CompatibleMaterial.getMaterial(location.getBlock().getRelative(BlockFace.DOWN));
+
+ if (spawnedIn == null || spawnedOn == null) {
+ return false;
+ }
+
+ if (!spawnedIn.isAir() &&
+ spawnedIn != CompatibleMaterial.WATER &&
+ !spawnedIn.name().contains("PRESSURE") &&
+ !spawnedIn.name().contains("SLAB")) {
+ return false;
+ }
+
+ for (CompatibleMaterial material : canSpawnOn) {
+ if (material == null) continue;
+
+ if (spawnedOn.equals(material) || material.isAir()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java
new file mode 100644
index 00000000..4b1a54f8
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java
@@ -0,0 +1,38 @@
+package com.songoda.core.nms.v1_19_R3.world;
+
+import com.songoda.core.nms.world.SWorld;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.level.entity.LevelEntityGetter;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
+import org.bukkit.entity.LivingEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SWorldImpl implements SWorld {
+ private final World world;
+
+ public SWorldImpl(World world) {
+ this.world = world;
+ }
+
+ @Override
+ public List getLivingEntities() {
+ List result = new ArrayList<>();
+
+ ServerLevel worldServer = ((CraftWorld) world).getHandle();
+ LevelEntityGetter entities = worldServer.getEntities();
+
+ entities.getAll().forEach((mcEnt) -> {
+ org.bukkit.entity.Entity bukkitEntity = mcEnt.getBukkitEntity();
+
+ if (bukkitEntity instanceof LivingEntity && bukkitEntity.isValid()) {
+ result.add((LivingEntity) bukkitEntity);
+ }
+ });
+
+ return result;
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/WorldCoreImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/WorldCoreImpl.java
new file mode 100644
index 00000000..5a84efc4
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/WorldCoreImpl.java
@@ -0,0 +1,94 @@
+package com.songoda.core.nms.v1_19_R3.world;
+
+import com.songoda.core.nms.ReflectionUtils;
+import com.songoda.core.nms.v1_19_R3.world.spawner.BBaseSpawnerImpl;
+import com.songoda.core.nms.world.BBaseSpawner;
+import com.songoda.core.nms.world.SItemStack;
+import com.songoda.core.nms.world.SSpawner;
+import com.songoda.core.nms.world.SWorld;
+import com.songoda.core.nms.world.WorldCore;
+import net.minecraft.core.BlockPos;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.util.profiling.ProfilerFiller;
+import net.minecraft.world.level.BaseSpawner;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.chunk.ChunkStatus;
+import net.minecraft.world.level.chunk.LevelChunk;
+import net.minecraft.world.level.chunk.LevelChunkSection;
+import net.minecraft.world.level.material.FluidState;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.block.CreatureSpawner;
+import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
+import org.bukkit.inventory.ItemStack;
+
+public class WorldCoreImpl implements WorldCore {
+ @Override
+ public SSpawner getSpawner(CreatureSpawner spawner) {
+ return new SSpawnerImpl(spawner.getLocation());
+ }
+
+ @Override
+ public SSpawner getSpawner(Location location) {
+ return new SSpawnerImpl(location);
+ }
+
+ @Override
+ public SItemStack getItemStack(ItemStack item) {
+ return new SItemStackImpl(item);
+ }
+
+ @Override
+ public SWorld getWorld(World world) {
+ return new SWorldImpl(world);
+ }
+
+ @Override
+ public BBaseSpawner getBaseSpawner(CreatureSpawner spawner) throws NoSuchFieldException, NoSuchMethodException, IllegalAccessException {
+ Object cTileEntity = ReflectionUtils.getFieldValue(spawner, "tileEntity");
+
+ return new BBaseSpawnerImpl(spawner, (BaseSpawner) ReflectionUtils.getFieldValue(cTileEntity, "a"));
+ }
+
+ /**
+ * Method is based on {@link ServerLevel#tickChunk(LevelChunk, int)}.
+ */
+ @Override
+ public void randomTickChunk(org.bukkit.Chunk bukkitChunk, int tickAmount) {
+ LevelChunk chunk = (LevelChunk) ((CraftChunk) bukkitChunk).getHandle(ChunkStatus.FULL);
+ ServerLevel world = chunk.q;
+ ProfilerFiller gameProfilerFiller = world.getProfiler();
+
+ ChunkPos chunkCoordIntPair = chunk.getPos();
+ int j = chunkCoordIntPair.getMinBlockX();
+ int k = chunkCoordIntPair.getMinBlockZ();
+
+ gameProfilerFiller.popPush("tickBlocks");
+ if (tickAmount > 0) {
+ LevelChunkSection[] aChunkSection = chunk.getSections();
+
+ for (LevelChunkSection chunkSection : aChunkSection) {
+ if (chunkSection.isRandomlyTicking()) {
+ int j1 = chunkSection.bottomBlockY();
+
+ for (int k1 = 0; k1 < tickAmount; ++k1) {
+ BlockPos blockposition2 = world.getBlockRandomPos(j, j1, k, 15);
+ gameProfilerFiller.push("randomTick");
+ BlockState iBlockData1 = chunkSection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k);
+ if (iBlockData1.isRandomlyTicking()) {
+ iBlockData1.randomTick(world, blockposition2, world.random);
+ }
+
+ FluidState fluid = iBlockData1.getFluidState();
+ if (fluid.isRandomlyTicking()) {
+ fluid.randomTick(world, blockposition2, world.random);
+ }
+
+ gameProfilerFiller.pop();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/spawner/BBaseSpawnerImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/spawner/BBaseSpawnerImpl.java
new file mode 100644
index 00000000..570b2c4a
--- /dev/null
+++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/spawner/BBaseSpawnerImpl.java
@@ -0,0 +1,213 @@
+package com.songoda.core.nms.v1_19_R3.world.spawner;
+
+import com.songoda.core.nms.world.BBaseSpawner;
+import net.minecraft.core.BlockPos;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.util.RandomSource;
+import net.minecraft.util.random.WeightedEntry;
+import net.minecraft.world.Difficulty;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.MobSpawnType;
+import net.minecraft.world.entity.SpawnPlacements;
+import net.minecraft.world.level.BaseSpawner;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.LightLayer;
+import net.minecraft.world.level.SpawnData;
+import net.minecraft.world.level.gameevent.GameEvent;
+import net.minecraft.world.phys.AABB;
+import org.bukkit.block.CreatureSpawner;
+import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
+import org.bukkit.craftbukkit.v1_19_R3.block.CraftCreatureSpawner;
+import org.bukkit.craftbukkit.v1_19_R3.event.CraftEventFactory;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Optional;
+
+public class BBaseSpawnerImpl implements BBaseSpawner {
+ private final CreatureSpawner bukkitSpawner;
+ private final BaseSpawner spawner;
+
+ private final Method setNextSpawnDataMethod;
+ private final Method getOrCreateNextSpawnDataMethod;
+
+ public BBaseSpawnerImpl(CreatureSpawner bukkitSpawner, BaseSpawner spawner) throws NoSuchMethodException {
+ this.bukkitSpawner = bukkitSpawner;
+ this.spawner = spawner;
+
+ this.setNextSpawnDataMethod = this.spawner.getClass().getDeclaredMethod("a", Level.class, BlockPos.class, SpawnData.class);
+ if (!this.setNextSpawnDataMethod.canAccess(this.spawner)) {
+ this.setNextSpawnDataMethod.setAccessible(true);
+ }
+
+ this.getOrCreateNextSpawnDataMethod = this.spawner.getClass().getSuperclass().getDeclaredMethod("b", Level.class, RandomSource.class, BlockPos.class);
+ if (!this.getOrCreateNextSpawnDataMethod.canAccess(this.spawner)) {
+ this.getOrCreateNextSpawnDataMethod.setAccessible(true);
+ }
+ }
+
+ /**
+ * This method is based on {@link BaseSpawner#isNearPlayer(Level, BlockPos)}.
+ */
+ @SuppressWarnings("JavadocReference")
+ @Override
+ public boolean isNearPlayer() {
+ BlockPos bPos = getBlockPosition();
+ return getWorld().hasNearbyAlivePlayer(
+ (double) bPos.getX() + 0.5,
+ (double) bPos.getY() + 0.5,
+ (double) bPos.getZ() + 0.5,
+ this.spawner.requiredPlayerRange);
+ }
+
+ /**
+ * This method is based on {@link BaseSpawner#serverTick(ServerLevel, BlockPos)}.
+ */
+ @Override
+ public void tick() throws InvocationTargetException, IllegalAccessException {
+ ServerLevel worldserver = getWorld();
+ BlockPos blockposition = getBlockPosition();
+
+ if (this.spawner.spawnDelay == -1) {
+ this.delay(worldserver, blockposition);
+ }
+
+ if (this.spawner.spawnDelay > 0) {
+ --this.spawner.spawnDelay;
+ } else {
+ boolean flag = false;
+ RandomSource randomsource = worldserver.getRandom();
+ SpawnData mobspawnerdata = (SpawnData) this.getOrCreateNextSpawnDataMethod.invoke(this.spawner, worldserver, randomsource, blockposition);
+ int i = 0;
+
+ while (true) {
+ if (i >= this.spawner.spawnCount) {
+ if (flag) {
+ this.delay(worldserver, blockposition);
+ }
+ break;
+ }
+
+ CompoundTag nbttagcompound = mobspawnerdata.getEntityToSpawn();
+ Optional> optional = EntityType.by(nbttagcompound);
+ if (optional.isEmpty()) {
+ this.delay(worldserver, blockposition);
+ return;
+ }
+
+ ListTag nbttaglist = nbttagcompound.getList("Pos", 6);
+ int j = nbttaglist.size();
+ double d0 = j >= 1 ? nbttaglist.getDouble(0) : (double) blockposition.getX() + (randomsource.nextDouble() - randomsource.nextDouble()) * (double) this.spawner.spawnRange + 0.5;
+ double d1 = j >= 2 ? nbttaglist.getDouble(1) : (double) (blockposition.getY() + randomsource.nextInt(3) - 1);
+ double d2 = j >= 3 ? nbttaglist.getDouble(2) : (double) blockposition.getZ() + (randomsource.nextDouble() - randomsource.nextDouble()) * (double) this.spawner.spawnRange + 0.5;
+ if (worldserver.noCollision(optional.get().getAABB(d0, d1, d2))) {
+ label128:
+ {
+ BlockPos blockposition1 = BlockPos.containing(d0, d1, d2);
+ if (mobspawnerdata.getCustomSpawnRules().isPresent()) {
+ if (!optional.get().getCategory().isFriendly() && worldserver.getDifficulty() == Difficulty.PEACEFUL) {
+ break label128;
+ }
+
+ SpawnData.CustomSpawnRules mobspawnerdata_a = mobspawnerdata.getCustomSpawnRules().get();
+ if (!mobspawnerdata_a.blockLightLimit().isValueInRange(worldserver.getBrightness(LightLayer.BLOCK, blockposition1)) || !mobspawnerdata_a.skyLightLimit().isValueInRange(worldserver.getBrightness(LightLayer.SKY, blockposition1))) {
+ break label128;
+ }
+ } else if (!SpawnPlacements.checkSpawnRules((EntityType>) optional.get(), worldserver, MobSpawnType.SPAWNER, blockposition1, worldserver.getRandom())) {
+ break label128;
+ }
+
+ Entity entity = EntityType.loadEntityRecursive(nbttagcompound, worldserver, (entity1) -> {
+ entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot());
+ return entity1;
+ });
+ if (entity == null) {
+ this.delay(worldserver, blockposition);
+ return;
+ }
+
+ int k = worldserver.getEntitiesOfClass(entity.getClass(), (new AABB(blockposition.getX(), blockposition.getY(), blockposition.getZ(), blockposition.getX() + 1, blockposition.getY() + 1, blockposition.getZ() + 1)).inflate(this.spawner.spawnRange)).size();
+ if (k >= this.spawner.maxNearbyEntities) {
+ this.delay(worldserver, blockposition);
+ return;
+ }
+
+ entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), randomsource.nextFloat() * 360.0F, 0.0F);
+ if (entity instanceof Mob entityinsentient) {
+ if (mobspawnerdata.getCustomSpawnRules().isEmpty() && !entityinsentient.checkSpawnRules(worldserver, MobSpawnType.SPAWNER) || !entityinsentient.checkSpawnObstruction(worldserver)) {
+ break label128;
+ }
+
+ if (mobspawnerdata.getEntityToSpawn().size() == 1 && mobspawnerdata.getEntityToSpawn().contains("id", 8)) {
+ ((Mob) entity).finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null, null);
+ }
+
+ if (entityinsentient.level.spigotConfig.nerfSpawnerMobs) {
+ entityinsentient.aware = false;
+ }
+ }
+
+ if (CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
+ Entity vehicle = entity.getVehicle();
+ if (vehicle != null) {
+ vehicle.discard();
+ }
+
+ for (Entity passenger : entity.getIndirectPassengers()) {
+ passenger.discard();
+ }
+ } else {
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, CreatureSpawnEvent.SpawnReason.SPAWNER)) {
+ this.delay(worldserver, blockposition);
+ return;
+ }
+
+ worldserver.levelEvent(2004, blockposition, 0);
+ worldserver.gameEvent(entity, GameEvent.ENTITY_PLACE, blockposition1);
+ if (entity instanceof Mob) {
+ ((Mob) entity).spawnAnim();
+ }
+
+ flag = true;
+ }
+ }
+ }
+
+ ++i;
+ }
+ }
+ }
+
+ /**
+ * This method is based on {@link BaseSpawner#delay(Level, BlockPos)}.
+ */
+ @SuppressWarnings("JavadocReference")
+ private void delay(ServerLevel world, BlockPos bPos) throws InvocationTargetException, IllegalAccessException {
+ RandomSource randomsource = world.random;
+ if (this.spawner.maxSpawnDelay <= this.spawner.minSpawnDelay) {
+ this.spawner.spawnDelay = this.spawner.minSpawnDelay;
+ } else {
+ this.spawner.spawnDelay = this.spawner.minSpawnDelay + randomsource.nextInt(this.spawner.maxSpawnDelay - this.spawner.minSpawnDelay);
+ }
+
+ Optional> weightedEntry = this.spawner.spawnPotentials.getRandom(randomsource);
+ if (weightedEntry.isPresent()) {
+ this.setNextSpawnDataMethod.invoke(this.spawner, world, bPos, weightedEntry.get().getData());
+ }
+
+ this.spawner.broadcastEvent(world, bPos, 1);
+ }
+
+ private ServerLevel getWorld() {
+ return ((CraftWorld) this.bukkitSpawner.getWorld()).getHandle();
+ }
+
+ private BlockPos getBlockPosition() {
+ return ((CraftCreatureSpawner) this.bukkitSpawner).getPosition();
+ }
+}
diff --git a/NMS/NMS-v1_8_R1/pom.xml b/NMS/NMS-v1_8_R1/pom.xml
index 923e9bde..5f774ddd 100644
--- a/NMS/NMS-v1_8_R1/pom.xml
+++ b/NMS/NMS-v1_8_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_8_R2/pom.xml b/NMS/NMS-v1_8_R2/pom.xml
index 4e4778c0..281344d2 100644
--- a/NMS/NMS-v1_8_R2/pom.xml
+++ b/NMS/NMS-v1_8_R2/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_8_R3/pom.xml b/NMS/NMS-v1_8_R3/pom.xml
index e3783b2d..2af8c463 100644
--- a/NMS/NMS-v1_8_R3/pom.xml
+++ b/NMS/NMS-v1_8_R3/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_9_R1/pom.xml b/NMS/NMS-v1_9_R1/pom.xml
index b79c0b28..214d23c7 100644
--- a/NMS/NMS-v1_9_R1/pom.xml
+++ b/NMS/NMS-v1_9_R1/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/NMS/NMS-v1_9_R2/pom.xml b/NMS/NMS-v1_9_R2/pom.xml
index eb1e3117..7a564fc7 100644
--- a/NMS/NMS-v1_9_R2/pom.xml
+++ b/NMS/NMS-v1_9_R2/pom.xml
@@ -7,7 +7,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19../../pom.xml
diff --git a/pom.xml b/pom.xml
index 5a4f40a9..2ba3e4f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.songodaSongodaCore-Modules
- 2.6.18
+ 2.6.19pom
@@ -49,6 +49,7 @@
NMS/NMS-v1_19_R1NMS/NMS-v1_19_R1v2NMS/NMS-v1_19_R2
+ NMS/NMS-v1_19_R3