Skip to content

Commit 4de34c8

Browse files
author
Colby Terry
committed
Update to use CraftBukkit 1.13.2.
1 parent 6ba0922 commit 4de34c8

5 files changed

Lines changed: 251 additions & 311 deletions

File tree

dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<dependency>
7777
<groupId>org.bukkit</groupId>
7878
<artifactId>bukkit</artifactId>
79-
<version>1.10.2-R0.1-SNAPSHOT</version>
79+
<version>1.13.2-R0.1-SNAPSHOT</version>
8080
<scope>compile</scope>
8181
</dependency>
8282
</dependencies>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<dependency>
4848
<groupId>org.bukkit</groupId>
4949
<artifactId>bukkit</artifactId>
50-
<version>1.10.2-R0.1-SNAPSHOT</version>
50+
<version>1.13.2-R0.1-SNAPSHOT</version>
5151
</dependency>
5252

5353
<dependency>

src/main/java/net/voidteam/websend/JSONSerializer.java

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@
1919
import org.json.JSONObject;
2020

2121
/**
22-
* Bukkit is not updated to 1.8 and the server mods based of bukkit are implementing their own patches to support 1.8
23-
* This is a compatibility problem since the central Bukkit API is now splitting up in several small APIs that all require seperate code to support.
24-
* This class provides several abstract serialization methods for subclasses to implement according to each API.
22+
* Bukkit is not updated to 1.8 and the server mods based of bukkit are
23+
* implementing their own patches to support 1.8 This is a compatibility problem
24+
* since the central Bukkit API is now splitting up in several small APIs that
25+
* all require seperate code to support. This class provides several abstract
26+
* serialization methods for subclasses to implement according to each API.
2527
*/
2628
public abstract class JSONSerializer {
2729
private static JSONSerializer instance = null;
2830

29-
public static JSONSerializer getInstance(){
30-
if(instance == null){
31-
if(Bukkit.getServer().getVersion().contains("Spigot")){
31+
public static JSONSerializer getInstance() {
32+
if (instance == null) {
33+
if (Bukkit.getServer().getVersion().contains("Spigot")) {
3234
instance = new SpigotJSONSerializer();
33-
}else{
35+
} else {
3436
instance = new BukkitJSONSerializer();
3537
}
3638
}
@@ -51,7 +53,7 @@ public JSONObject serializePlayer(Player ply, boolean serializeAllData) throws J
5153
player.put("Health", ply.getHealth());
5254
player.put("IP", ply.getAddress().toString());
5355
player.put("IsOP", ply.isOp());
54-
if(serializeAllData){
56+
if (serializeAllData) {
5557
player.put("CurrentItemIndex", ply.getInventory().getHeldItemSlot());
5658
player.put("MainHandItemID", ply.getInventory().getItemInMainHand().getType().name());
5759
player.put("OffHandItemID", ply.getInventory().getItemInOffHand().getType().name());
@@ -115,7 +117,7 @@ public JSONObject serializeItemStack(ItemStack itemStack) throws JSONException {
115117
Enchantment cur = enchIter.next();
116118
JSONObject enchantment = new JSONObject();
117119
{
118-
enchantment.put("Name", cur.getName());
120+
enchantment.put("Name", cur.getKey());
119121
enchantment.put("Level", itemStack.getEnchantmentLevel(cur));
120122
}
121123
enchantments.put(enchantment);
@@ -132,9 +134,9 @@ public JSONObject serializeMetaData(ItemMeta meta) throws JSONException {
132134
JSONObject result = null;
133135
try {
134136
result = serializeMetaCustom(meta);
135-
if(result != null){
136-
//Is custom item implemented by subclass
137-
}else if (meta instanceof BookMeta) {
137+
if (result != null) {
138+
// Is custom item implemented by subclass
139+
} else if (meta instanceof BookMeta) {
138140
result = serializeMetaBook((BookMeta) meta);
139141
} else if (meta instanceof FireworkEffectMeta) {
140142
result = serializeMetaFireworkEffect((FireworkEffectMeta) meta);
@@ -157,18 +159,13 @@ public JSONObject serializeMetaData(ItemMeta meta) throws JSONException {
157159
}
158160
} catch (Exception ex) {
159161
if (Main.getSettings().isDebugMode()) {
160-
Main.getMainLogger().log(
161-
Level.WARNING,
162-
"Exception while serializing item meta data. "
163-
+ "This may be caused by a mismatch between the Bukkit and "
164-
+ "Websend versions.",
165-
ex);
162+
Main.getMainLogger().log(Level.WARNING, "Exception while serializing item meta data. "
163+
+ "This may be caused by a mismatch between the Bukkit and " + "Websend versions.", ex);
166164
} else {
167-
Main.getMainLogger().log(
168-
Level.WARNING,
165+
Main.getMainLogger().log(Level.WARNING,
169166
"Exception while serializing item meta data. "
170-
+ "This may be caused by a mismatch between the Bukkit and "
171-
+ "Websend versions. Enable debug mode for stack trace.");
167+
+ "This may be caused by a mismatch between the Bukkit and "
168+
+ "Websend versions. Enable debug mode for stack trace.");
172169
}
173170
}
174171
addNameAndLore(result, meta);
@@ -196,8 +193,7 @@ public void addEnchantments(JSONObject obj, ItemMeta meta) throws JSONException
196193
Enchantment enchantment = set.getKey();
197194
JSONObject enchantmentObj = new JSONObject();
198195
{
199-
enchantmentObj.put("Type", enchantment.getId());
200-
enchantmentObj.put("Name", enchantment.getName());
196+
enchantmentObj.put("Name", enchantment.getKey());
201197
enchantmentObj.put("MaxLevel", enchantment.getMaxLevel());
202198
enchantmentObj.put("StartLevel", enchantment.getStartLevel());
203199
enchantmentObj.put("Level", meta.getEnchantLevel(enchantment));
@@ -249,7 +245,8 @@ public JSONObject serializeMetaFirework(FireworkMeta fireworkMeta) throws JSONEx
249245
return metaObj;
250246
}
251247

252-
public JSONObject serializeMetaEnchantmentStorage(EnchantmentStorageMeta enchantmentStorageMeta) throws JSONException {
248+
public JSONObject serializeMetaEnchantmentStorage(EnchantmentStorageMeta enchantmentStorageMeta)
249+
throws JSONException {
253250
JSONObject metaObj = new JSONObject();
254251
{
255252
JSONArray enchantArray = new JSONArray();
@@ -258,8 +255,7 @@ public JSONObject serializeMetaEnchantmentStorage(EnchantmentStorageMeta enchant
258255
Enchantment enchantment = set.getKey();
259256
JSONObject enchantmentObj = new JSONObject();
260257
{
261-
enchantmentObj.put("Type", enchantment.getId());
262-
enchantmentObj.put("Name", enchantment.getName());
258+
enchantmentObj.put("Name", enchantment.getKey());
263259
enchantmentObj.put("MaxLevel", enchantment.getMaxLevel());
264260
enchantmentObj.put("StartLevel", enchantment.getStartLevel());
265261
enchantmentObj.put("Level", set.getValue());
@@ -300,7 +296,7 @@ public JSONObject serializeMetaPotion(PotionMeta potionMeta) throws JSONExceptio
300296
}
301297

302298
PotionData data = potionMeta.getBasePotionData();
303-
if(data != null){
299+
if (data != null) {
304300
JSONObject potionTypeObj = new JSONObject();
305301
{
306302
potionTypeObj.put("Name", data.getType().name());

src/main/java/net/voidteam/websend/WebsendConsoleCommandSender.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
import org.bukkit.plugin.Plugin;
1414

1515
public class WebsendConsoleCommandSender implements ConsoleCommandSender {
16-
/* This class allows tapping into command output from plugins
17-
* if the output is sent through the commandsender.
16+
/*
17+
* This class allows tapping into command output from plugins if the output is
18+
* sent through the commandsender.
1819
*
19-
* Tap this method(1.6.4): sendRawMessage, sendMessage(String), sendMessage(String[])
20+
* Tap this method(1.6.4): sendRawMessage, sendMessage(String),
21+
* sendMessage(String[])
2022
*/
2123

2224
private final ConsoleCommandSender parent;

0 commit comments

Comments
 (0)