-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed unused (de)serialization methodes #147
base: 2.6.0
Are you sure you want to change the base?
Changes from all commits
baeda89
2a685fe
6d32b2b
7c46c23
4069f88
64ef7d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,13 +40,12 @@ | |
import org.shanerx.tradeshop.utils.Utils; | ||
import org.shanerx.tradeshop.utils.gsonprocessing.GsonProcessor; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
public class PlayerSetting implements Serializable { | ||
public class PlayerSetting { | ||
|
||
private transient UUID uuid; | ||
private final String uuidString; | ||
|
@@ -80,12 +79,6 @@ public PlayerSetting(UUID playerUUID) { | |
load(); | ||
} | ||
|
||
public static PlayerSetting deserialize(String serialized) { | ||
PlayerSetting playerSetting = new GsonProcessor().fromJson(serialized, PlayerSetting.class); | ||
playerSetting.load(); | ||
return playerSetting; | ||
} | ||
|
||
Comment on lines
-83
to
-88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
public boolean isAdminEnabled() { | ||
return adminEnabled; | ||
} | ||
|
@@ -147,10 +140,6 @@ public void load() { | |
utils = new Utils(); | ||
} | ||
|
||
public String serialize() { | ||
return new GsonProcessor().toJson(this); | ||
} | ||
|
||
Comment on lines
-150
to
-153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
public String getInvolvedStatusesString() { | ||
Set<String> nullShops = new HashSet<>(); | ||
StringBuilder sb = new StringBuilder(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,10 @@ | |
import org.bukkit.inventory.meta.SkullMeta; | ||
import org.shanerx.tradeshop.utils.gsonprocessing.GsonProcessor; | ||
|
||
import java.io.Serializable; | ||
import java.util.UUID; | ||
|
||
@SuppressWarnings("unused") | ||
public class ShopUser implements Serializable { | ||
public class ShopUser { | ||
|
||
private transient OfflinePlayer player; | ||
@SerializedName("player") | ||
|
@@ -56,12 +55,6 @@ public ShopUser(UUID pUUID, ShopRole role) { | |
this.role = role; | ||
} | ||
|
||
public static ShopUser deserialize(String serialized) { | ||
ShopUser shopUser = new GsonProcessor().fromJson(serialized, ShopUser.class); | ||
shopUser.player = Bukkit.getOfflinePlayer(UUID.fromString(shopUser.playerUUID)); | ||
return shopUser; | ||
} | ||
|
||
Comment on lines
-59
to
-64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
public OfflinePlayer getPlayer() { | ||
fix(); | ||
return player; | ||
|
@@ -85,10 +78,6 @@ private void fix() { | |
} | ||
} | ||
|
||
public String serialize() { | ||
return new GsonProcessor().toJson(this); | ||
} | ||
|
||
Comment on lines
-88
to
-91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
public ItemStack getHead() { | ||
ItemStack userHead = new ItemStack(Material.PLAYER_HEAD); | ||
SkullMeta userMeta = (SkullMeta) userHead.getItemMeta(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ | |
import org.shanerx.tradeshop.utils.objects.ObjectHolder; | ||
import org.shanerx.tradeshop.utils.objects.Tuple; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
|
@@ -61,7 +60,7 @@ | |
import java.util.UUID; | ||
import java.util.stream.Collectors; | ||
|
||
public class Shop implements Serializable { | ||
public class Shop { | ||
|
||
private ShopUser owner; | ||
private Set<UUID> managers, members; | ||
|
@@ -146,20 +145,7 @@ public Shop(Location location, ShopType shopType, ShopUser owner) { | |
} | ||
|
||
/** | ||
* Deserializes the object to Json using Gson | ||
* | ||
* @param serialized Shop GSON to be deserialized | ||
* | ||
* @return Shop object from file | ||
*/ | ||
public static Shop deserialize(String serialized) { | ||
Shop shop = new GsonProcessor().fromJson(serialized, Shop.class); | ||
shop.fixAfterLoad(); | ||
|
||
return shop; | ||
} | ||
|
||
/** | ||
Comment on lines
-149
to
-162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
* Loads a shop from file and returns the Shop object | ||
* | ||
* @param loc Location of the shop sign | ||
|
@@ -260,15 +246,6 @@ public int getAvailableTrades() { | |
return availableTrades; | ||
} | ||
|
||
/** | ||
* Serializes the object to Json using Gson | ||
* | ||
* @return serialized string | ||
*/ | ||
public String serialize() { | ||
return new GsonProcessor().toJson(this); | ||
} | ||
|
||
Comment on lines
-263
to
-271
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
/** | ||
* Returns the shop signs location as a ShopLocation | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,10 +35,8 @@ | |
import org.shanerx.tradeshop.player.Permissions; | ||
import org.shanerx.tradeshop.utils.gsonprocessing.GsonProcessor; | ||
|
||
import java.io.Serializable; | ||
|
||
|
||
public enum ShopType implements Serializable { | ||
public enum ShopType { | ||
|
||
TRADE(Permissions.CREATE), | ||
|
||
|
@@ -82,10 +80,6 @@ public static ShopType getType(Sign s) { | |
return null; | ||
} | ||
|
||
public static ShopType deserialize(String serialized) { | ||
return new GsonProcessor().fromJson(serialized, ShopType.class); | ||
} | ||
|
||
Comment on lines
-85
to
-88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
@Override | ||
public String toString() { | ||
return getKey().getString(); | ||
|
@@ -105,10 +99,6 @@ public boolean checkPerm(Player pl) { | |
return Permissions.hasPermission(pl, perm); | ||
} | ||
|
||
public String serialize() { | ||
return new GsonProcessor().toJson(this); | ||
} | ||
|
||
Comment on lines
-108
to
-111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ |
||
public boolean isTrade() { | ||
return this.equals(TRADE); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing Serializable is good if it's not being used, but I see no point in removing the (de)serialize methods since at worst they just waste space. They do occasionally get used when I need to add debug to a section. In most cases when I do that they have to be removed soon after for performance like in the Hopper code(where no debug can stay since it runs so often with each hopper)