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>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>

View File

@ -14,8 +14,10 @@ import com.massivecraft.massivecore.util.MUtil;
import net.milkbowl.vault.economy.Economy;
@SuppressWarnings("deprecation")
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 JsonElement value = entry.getValue();
switch(key)
if (key.equals("world"))
{
case "world":
builder.world(value.getAsString());
break;
case "x":
builder.locationX(value.getAsDouble());
break;
case "y":
builder.locationY(value.getAsDouble());
break;
case "z":
builder.locationZ(value.getAsDouble());
break;
case "pitch":
builder.pitch(value.getAsFloat());
break;
case "yaw":
builder.yaw(value.getAsFloat());
break;
builder.world(value.getAsString());
}
else if (key.equals("x"))
{
builder.locationX(value.getAsDouble());
}
else if (key.equals("y"))
{
builder.locationY(value.getAsDouble());
}
else if (key.equals("z"))
{
builder.locationZ(value.getAsDouble());
}
else if (key.equals("pitch"))
{
builder.pitch(value.getAsFloat());
}
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 JsonElement value = entry.getValue();
switch(key)
if (key.equals(NAME_SERIALIZED_WORLD))
{
case NAME_SERIALIZED_WORLD:
builder.world(value.getAsString());
break;
case NAME_SERIALIZED_BLOCKX:
builder.blockX(value.getAsInt());
break;
case NAME_SERIALIZED_BLOCKY:
builder.blockY(value.getAsInt());
break;
case NAME_SERIALIZED_BLOCKZ:
builder.blockZ(value.getAsInt());
break;
case NAME_SERIALIZED_LOCATIONX:
builder.locationX(value.getAsDouble());
break;
case NAME_SERIALIZED_LOCATIONY:
builder.locationY(value.getAsDouble());
break;
case NAME_SERIALIZED_LOCATIONZ:
builder.locationZ(value.getAsDouble());
break;
case NAME_SERIALIZED_CHUNKX:
builder.chunkX(value.getAsInt());
break;
case NAME_SERIALIZED_CHUNKZ:
builder.chunkZ(value.getAsInt());
break;
case NAME_SERIALIZED_PITCH:
builder.pitch(value.getAsFloat());
break;
case NAME_SERIALIZED_YAW:
builder.yaw(value.getAsFloat());
break;
case NAME_SERIALIZED_VELOCITYX:
builder.velocityX(value.getAsDouble());
break;
case NAME_SERIALIZED_VELOCITYY:
builder.velocityY(value.getAsDouble());
break;
case NAME_SERIALIZED_VELOCITYZ:
builder.velocityZ(value.getAsDouble());
break;
builder.world(value.getAsString());
}
else if (key.equals(NAME_SERIALIZED_BLOCKX))
{
builder.blockX(value.getAsInt());
}
else if (key.equals(NAME_SERIALIZED_BLOCKY))
{
builder.blockY(value.getAsInt());
}
else if (key.equals(NAME_SERIALIZED_BLOCKZ))
{
builder.blockZ(value.getAsInt());
}
else if (key.equals(NAME_SERIALIZED_LOCATIONX))
{
builder.locationX(value.getAsDouble());
}
else if (key.equals(NAME_SERIALIZED_LOCATIONY))
{
builder.locationY(value.getAsDouble());
}
else if (key.equals(NAME_SERIALIZED_LOCATIONZ))
{
builder.locationZ(value.getAsDouble());
}
else if (key.equals(NAME_SERIALIZED_CHUNKX))
{
builder.chunkX(value.getAsInt());
}
else if (key.equals(NAME_SERIALIZED_CHUNKZ))
{
builder.chunkZ(value.getAsInt());
}
else if (key.equals(NAME_SERIALIZED_PITCH))
{
builder.pitch(value.getAsFloat());
}
else if (key.equals(NAME_SERIALIZED_YAW))
{
builder.yaw(value.getAsFloat());
}
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>Entity: <v>%s", id));
MassiveCore.get().log(Txt.parse("<k>Collection: <v>%s", this.getName()));
throw e;
throw new RuntimeException(e);
}
return !MStore.equal(lastRaw, currentRaw);

View File

@ -102,11 +102,11 @@ public class IdUtil implements Listener, Runnable
public static Set<IdData> getDatas() { return datas; }
// 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; }
// 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; }
// -------------------------------------------- //
@ -114,17 +114,17 @@ public class IdUtil implements Listener, Runnable
// -------------------------------------------- //
// 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); }
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); }
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); }
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); }
// -------------------------------------------- //
@ -133,8 +133,8 @@ public class IdUtil implements Listener, Runnable
// For registering extra custom CommandSender implementations.
// 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<CommandSender, String> registrySenderToId = new ConcurrentHashMap<>();
private static Map<String, CommandSender> registryIdToSender = new ConcurrentHashMap<String, CommandSender>();
private static Map<CommandSender, String> registrySenderToId = new ConcurrentHashMap<CommandSender, String>();
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.command.CommandSender;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

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