Fix #8, add 1.14 support and fix esgive system cmd in console

This commit is contained in:
SeanOMik 2020-09-03 11:27:43 -05:00
parent bb37c50d2f
commit e518e26d17
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
5 changed files with 18 additions and 12 deletions

11
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>energeticstorage</artifactId> <artifactId>energeticstorage</artifactId>
<version>0.3-SNAPSHOT</version> <version>0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>EnergeticStorage</name> <name>EnergeticStorage</name>
@ -47,8 +47,10 @@
</relocation> </relocation>
</relocations> </relocations>
<outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.15.2_\plugins\EnergeticStorage-v${project.version}.jar</outputFile> <outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.14.4_\plugins\EnergeticStorage-v${project.version}.jar</outputFile>
<!--<outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.15.2_\plugins\EnergeticStorage-v${project.version}.jar</outputFile>-->
<!--<outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.16.1_\plugins\EnergeticStorage-MC-v${project.version}.jar</outputFile>--> <!--<outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.16.1_\plugins\EnergeticStorage-MC-v${project.version}.jar</outputFile>-->
<!--<outputFile>D:\Code\java\spigotPlugins\_TEST_SERVER_1.16.2_\plugins\EnergeticStorage-MC-v${project.version}.jar</outputFile>-->
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
@ -86,14 +88,13 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId> <artifactId>spigot</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version> <version>1.14-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.tr7zw</groupId> <groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId> <artifactId>item-nbt-api</artifactId>
<version>2.4.1</version> <version>2.5.0</version>
<!--<scope>compile</scope>-->
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.WesJD.AnvilGUI</groupId> <groupId>com.github.WesJD.AnvilGUI</groupId>

View File

@ -76,7 +76,7 @@ public class ESGiveCommand implements TabExecutor {
sender.sendMessage("Saved systems!"); sender.sendMessage("Saved systems!");
break; break;
case "system": case "system":
Player p = (Player) sender; //Player p = (Player) sender;
if (args.length == 2) { if (args.length == 2) {
if (!PermissionChecks.canESGiveOthers(sender)) { if (!PermissionChecks.canESGiveOthers(sender)) {
@ -94,7 +94,13 @@ public class ESGiveCommand implements TabExecutor {
sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Player does not exist or is not online!"); sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Player does not exist or is not online!");
} }
} else if (args.length == 1) { } else if (args.length == 1) {
p.getInventory().addItem(ItemConstructor.createSystemBlock()); if (sender instanceof Player) {
Player player = (Player) sender;
player.getInventory().addItem(ItemConstructor.createSystemBlock());
} else {
sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Supply a player to run this command!");
sender.sendMessage(generateCommandUsage(args));
}
} }
break; break;
case "drive": case "drive":
@ -117,7 +123,7 @@ public class ESGiveCommand implements TabExecutor {
if (player != null) { if (player != null) {
player.getInventory().addItem(ItemConstructor.createDrive(size, 0, 0)); player.getInventory().addItem(ItemConstructor.createDrive(size, 0, 0));
sender.sendMessage(Reference.PREFIX + ChatColor.GREEN + "Gave an ES System to " + player.getDisplayName()); sender.sendMessage(Reference.PREFIX + ChatColor.GREEN + "Gave an ES Drive to " + player.getDisplayName());
} else { } else {
sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Player does not exist or is not online!"); sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Player does not exist or is not online!");
} }

View File

@ -10,7 +10,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.libs.org.apache.commons.lang3.StringEscapeUtils; //import org.bukkit.craftbukkit.libs.org.apache.commons.lang3.StringEscapeUtils;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
@ -245,7 +245,7 @@ public class PlayersFile extends YamlConfiguration {
JSONArray itemsJson = new JSONArray(); JSONArray itemsJson = new JSONArray();
for (Map.Entry<ItemStack, Integer> entry : drive.getItems().entrySet()) { for (Map.Entry<ItemStack, Integer> entry : drive.getItems().entrySet()) {
try { try {
String object = "{\"itemYAML\":\"" + StringEscapeUtils.escapeJson(ItemSerialization.serializeItem(entry.getKey(), entry.getValue())) + "\"}"; String object = "{\"itemYAML\":\"" + ItemSerialization.serializeItem(entry.getKey(), entry.getValue()).replace("\"", "\\\"") + "\"}";
JSONObject itemJSON = (JSONObject) new JSONParser().parse(object); JSONObject itemJSON = (JSONObject) new JSONParser().parse(object);
itemsJson.add(itemJSON); itemsJson.add(itemJSON);

View File

@ -10,7 +10,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.Hash;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View File

@ -1,7 +1,7 @@
name: EnergeticStorage name: EnergeticStorage
version: ${project.version} version: ${project.version}
main: net.seanomik.energeticstorage.EnergeticStorage main: net.seanomik.energeticstorage.EnergeticStorage
api-version: 1.15 api-version: 1.14
authors: [SeanOMik] authors: [SeanOMik]
softdepend: [Multiverse-Core] softdepend: [Multiverse-Core]
commands: commands: