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>
<artifactId>energeticstorage</artifactId>
<version>0.3-SNAPSHOT</version>
<version>0.4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>EnergeticStorage</name>
@ -47,8 +47,10 @@
</relocation>
</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.2_\plugins\EnergeticStorage-MC-v${project.version}.jar</outputFile>-->
</configuration>
</execution>
</executions>
@ -86,14 +88,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.14-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId>
<version>2.4.1</version>
<!--<scope>compile</scope>-->
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.github.WesJD.AnvilGUI</groupId>

View File

@ -76,7 +76,7 @@ public class ESGiveCommand implements TabExecutor {
sender.sendMessage("Saved systems!");
break;
case "system":
Player p = (Player) sender;
//Player p = (Player) sender;
if (args.length == 2) {
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!");
}
} 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;
case "drive":
@ -117,7 +123,7 @@ public class ESGiveCommand implements TabExecutor {
if (player != null) {
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 {
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.configuration.InvalidConfigurationException;
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.json.simple.JSONArray;
import org.json.simple.JSONObject;
@ -245,7 +245,7 @@ public class PlayersFile extends YamlConfiguration {
JSONArray itemsJson = new JSONArray();
for (Map.Entry<ItemStack, Integer> entry : drive.getItems().entrySet()) {
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);
itemsJson.add(itemJSON);

View File

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

View File

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