Skip to content
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

Update SectorUtil.java #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/com/bartekmajster/opensectors/SectorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import org.bukkit.potion.*;
import org.bukkit.*;

public class SectorUtil
{
public static String InventoryToString(final Inventory invInventory) {
public class SectorUtil {
public static String inventoryToString(final Inventory invInventory) {
String serialization = String.valueOf(invInventory.getSize()) + ";";
for (int i = 0; i < invInventory.getSize(); ++i) {
final ItemStack is = invInventory.getItem(i);
Expand Down Expand Up @@ -125,7 +124,7 @@ public static ItemStack[] stringToArmor(final String string) {
return deserializedArmor;
}

public static Inventory StringToInventory(final String invString) {
public static Inventory stringToInventory(final String invString) {
final String[] serializedBlocks = invString.split(";");
final String invInfo = serializedBlocks[0];
final Inventory deserializedInventory = Bukkit.getServer().createInventory((InventoryHolder)null, (int)Integer.valueOf(invInfo));
Expand Down Expand Up @@ -160,15 +159,15 @@ else if (itemAttribute[0].equals("e") && createdItemStack) {
return deserializedInventory;
}

public static String EffectToString(final Collection<PotionEffect> effects) {
public static String effectToString(final Collection<PotionEffect> effects) {
String serialized = "";
for (final PotionEffect e : effects) {
serialized = String.valueOf(serialized) + e.getType().getId() + ":" + e.getDuration() + ":" + e.getAmplifier() + ";";
}
return serialized;
}

public static Collection<PotionEffect> StringToEffect(final String serializedEffects) {
public static Collection<PotionEffect> stringToEffect(final String serializedEffects) {
final ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
if (serializedEffects.isEmpty()) {
return effects;
Expand All @@ -192,7 +191,7 @@ public static Collection<PotionEffect> StringToEffect(final String serializedEff
return effects;
}

public static Location StringToLocation(final String location) {
public static Location stringToLocation(final String location) {
final String[] str2loc = location.split("\\:");
final Location loc = new Location(Bukkit.getWorld(str2loc[0]), 0.0, 0.0, 0.0, 0.0f, 0.0f);
loc.setX(Double.parseDouble(str2loc[1]));
Expand All @@ -203,7 +202,7 @@ public static Location StringToLocation(final String location) {
return loc;
}

public static String LocationToString(final Location location) {
public static String locationToString(final Location location) {
return String.valueOf(location.getWorld().getName()) + ":" + location.getX() + ":" + location.getY() + ":" + location.getZ() + ":" + location.getYaw() + ":" + location.getPitch();
}
}