Java 1.6 compliance.

This commit is contained in:
Olof Larsson 2014-11-07 08:40:44 +01:00
parent 8fc5707061
commit 6e096e1a92
7 changed files with 90 additions and 74 deletions

View File

@ -31,8 +31,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.7</source> <source>1.6</source>
<target>1.7</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -14,8 +14,10 @@ import com.massivecraft.massivecore.util.MUtil;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
@SuppressWarnings("deprecation")
public class MoneyMixinVault extends MoneyMixinAbstract public class MoneyMixinVault extends MoneyMixinAbstract
{ {
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -381,26 +381,29 @@ public final class PS implements Cloneable, Serializable, Comparable<PS>
final String key = entry.getKey(); final String key = entry.getKey();
final JsonElement value = entry.getValue(); final JsonElement value = entry.getValue();
switch(key) if (key.equals("world"))
{ {
case "world": builder.world(value.getAsString());
builder.world(value.getAsString()); }
break; else if (key.equals("x"))
case "x": {
builder.locationX(value.getAsDouble()); builder.locationX(value.getAsDouble());
break; }
case "y": else if (key.equals("y"))
builder.locationY(value.getAsDouble()); {
break; builder.locationY(value.getAsDouble());
case "z": }
builder.locationZ(value.getAsDouble()); else if (key.equals("z"))
break; {
case "pitch": builder.locationZ(value.getAsDouble());
builder.pitch(value.getAsFloat()); }
break; else if (key.equals("pitch"))
case "yaw": {
builder.yaw(value.getAsFloat()); builder.pitch(value.getAsFloat());
break; }
else if (key.equals("yaw"))
{
builder.yaw(value.getAsFloat());
} }
} }
} }
@ -412,50 +415,61 @@ public final class PS implements Cloneable, Serializable, Comparable<PS>
final String key = entry.getKey(); final String key = entry.getKey();
final JsonElement value = entry.getValue(); final JsonElement value = entry.getValue();
switch(key) if (key.equals(NAME_SERIALIZED_WORLD))
{ {
case NAME_SERIALIZED_WORLD: builder.world(value.getAsString());
builder.world(value.getAsString()); }
break; else if (key.equals(NAME_SERIALIZED_BLOCKX))
case NAME_SERIALIZED_BLOCKX: {
builder.blockX(value.getAsInt()); builder.blockX(value.getAsInt());
break; }
case NAME_SERIALIZED_BLOCKY: else if (key.equals(NAME_SERIALIZED_BLOCKY))
builder.blockY(value.getAsInt()); {
break; builder.blockY(value.getAsInt());
case NAME_SERIALIZED_BLOCKZ: }
builder.blockZ(value.getAsInt()); else if (key.equals(NAME_SERIALIZED_BLOCKZ))
break; {
case NAME_SERIALIZED_LOCATIONX: builder.blockZ(value.getAsInt());
builder.locationX(value.getAsDouble()); }
break; else if (key.equals(NAME_SERIALIZED_LOCATIONX))
case NAME_SERIALIZED_LOCATIONY: {
builder.locationY(value.getAsDouble()); builder.locationX(value.getAsDouble());
break; }
case NAME_SERIALIZED_LOCATIONZ: else if (key.equals(NAME_SERIALIZED_LOCATIONY))
builder.locationZ(value.getAsDouble()); {
break; builder.locationY(value.getAsDouble());
case NAME_SERIALIZED_CHUNKX: }
builder.chunkX(value.getAsInt()); else if (key.equals(NAME_SERIALIZED_LOCATIONZ))
break; {
case NAME_SERIALIZED_CHUNKZ: builder.locationZ(value.getAsDouble());
builder.chunkZ(value.getAsInt()); }
break; else if (key.equals(NAME_SERIALIZED_CHUNKX))
case NAME_SERIALIZED_PITCH: {
builder.pitch(value.getAsFloat()); builder.chunkX(value.getAsInt());
break; }
case NAME_SERIALIZED_YAW: else if (key.equals(NAME_SERIALIZED_CHUNKZ))
builder.yaw(value.getAsFloat()); {
break; builder.chunkZ(value.getAsInt());
case NAME_SERIALIZED_VELOCITYX: }
builder.velocityX(value.getAsDouble()); else if (key.equals(NAME_SERIALIZED_PITCH))
break; {
case NAME_SERIALIZED_VELOCITYY: builder.pitch(value.getAsFloat());
builder.velocityY(value.getAsDouble()); }
break; else if (key.equals(NAME_SERIALIZED_YAW))
case NAME_SERIALIZED_VELOCITYZ: {
builder.velocityZ(value.getAsDouble()); builder.yaw(value.getAsFloat());
break; }
else if (key.equals(NAME_SERIALIZED_VELOCITYX))
{
builder.velocityX(value.getAsDouble());
}
else if (key.equals(NAME_SERIALIZED_VELOCITYY))
{
builder.velocityY(value.getAsDouble());
}
else if (key.equals(NAME_SERIALIZED_VELOCITYZ))
{
builder.velocityZ(value.getAsDouble());
} }
} }
} }

View File

@ -731,7 +731,7 @@ public class Coll<E> implements CollInterface<E>
MassiveCore.get().log(Txt.parse("<k>Error: <v>%s", e.getMessage())); MassiveCore.get().log(Txt.parse("<k>Error: <v>%s", e.getMessage()));
MassiveCore.get().log(Txt.parse("<k>Entity: <v>%s", id)); MassiveCore.get().log(Txt.parse("<k>Entity: <v>%s", id));
MassiveCore.get().log(Txt.parse("<k>Collection: <v>%s", this.getName())); MassiveCore.get().log(Txt.parse("<k>Collection: <v>%s", this.getName()));
throw e; throw new RuntimeException(e);
} }
return !MStore.equal(lastRaw, currentRaw); return !MStore.equal(lastRaw, currentRaw);

View File

@ -102,11 +102,11 @@ public class IdUtil implements Listener, Runnable
public static Set<IdData> getDatas() { return datas; } public static Set<IdData> getDatas() { return datas; }
// Id Index // Id Index
private static Map<String, IdData> idToData = new ConcurrentSkipListMap<>(String.CASE_INSENSITIVE_ORDER); private static Map<String, IdData> idToData = new ConcurrentSkipListMap<String, IdData>(String.CASE_INSENSITIVE_ORDER);
public static Map<String, IdData> getIdToData() { return idToData; } public static Map<String, IdData> getIdToData() { return idToData; }
// Name Index // Name Index
private static Map<String, IdData> nameToData = new ConcurrentSkipListMap<>(String.CASE_INSENSITIVE_ORDER); private static Map<String, IdData> nameToData = new ConcurrentSkipListMap<String, IdData>(String.CASE_INSENSITIVE_ORDER);
public static Map<String, IdData> getNameToData() { return nameToData; } public static Map<String, IdData> getNameToData() { return nameToData; }
// -------------------------------------------- // // -------------------------------------------- //
@ -114,17 +114,17 @@ public class IdUtil implements Listener, Runnable
// -------------------------------------------- // // -------------------------------------------- //
// Used for chat tab completion, argument readers, etc. // Used for chat tab completion, argument readers, etc.
private static Set<String> onlineIds = new ConcurrentSkipListSet<>(String.CASE_INSENSITIVE_ORDER); private static Set<String> onlineIds = new ConcurrentSkipListSet<String>(String.CASE_INSENSITIVE_ORDER);
public static Set<String> getOnlineIds() { return Collections.unmodifiableSet(onlineIds); } public static Set<String> getOnlineIds() { return Collections.unmodifiableSet(onlineIds); }
private static Set<String> onlineNames = new ConcurrentSkipListSet<>(String.CASE_INSENSITIVE_ORDER); private static Set<String> onlineNames = new ConcurrentSkipListSet<String>(String.CASE_INSENSITIVE_ORDER);
public static Set<String> getOnlineNames() { return Collections.unmodifiableSet(onlineNames); } public static Set<String> getOnlineNames() { return Collections.unmodifiableSet(onlineNames); }
private static Set<String> allIds = new ConcurrentSkipListSet<>(String.CASE_INSENSITIVE_ORDER); private static Set<String> allIds = new ConcurrentSkipListSet<String>(String.CASE_INSENSITIVE_ORDER);
public static Set<String> getAllIds() { return Collections.unmodifiableSet(allIds); } public static Set<String> getAllIds() { return Collections.unmodifiableSet(allIds); }
private static Set<String> allNames = new ConcurrentSkipListSet<>(String.CASE_INSENSITIVE_ORDER); private static Set<String> allNames = new ConcurrentSkipListSet<String>(String.CASE_INSENSITIVE_ORDER);
public static Set<String> getAllNames() { return Collections.unmodifiableSet(allNames); } public static Set<String> getAllNames() { return Collections.unmodifiableSet(allNames); }
// -------------------------------------------- // // -------------------------------------------- //
@ -133,8 +133,8 @@ public class IdUtil implements Listener, Runnable
// For registering extra custom CommandSender implementations. // For registering extra custom CommandSender implementations.
// It's assumed that the getName() returns the name which is also the id. // It's assumed that the getName() returns the name which is also the id.
private static Map<String, CommandSender> registryIdToSender = new ConcurrentHashMap<>(); private static Map<String, CommandSender> registryIdToSender = new ConcurrentHashMap<String, CommandSender>();
private static Map<CommandSender, String> registrySenderToId = new ConcurrentHashMap<>(); private static Map<CommandSender, String> registrySenderToId = new ConcurrentHashMap<CommandSender, String>();
public static void register(CommandSender sender) public static void register(CommandSender sender)
{ {

View File

@ -29,6 +29,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -69,7 +69,6 @@ public final class Streams {
TypeAdapters.JSON_ELEMENT.write(writer, element); TypeAdapters.JSON_ELEMENT.write(writer, element);
} }
@SuppressWarnings("resource")
public static Writer writerForAppendable(Appendable appendable) { public static Writer writerForAppendable(Appendable appendable) {
return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable); return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable);
} }