Fix indent style

This commit is contained in:
Olof Larsson 2012-12-20 08:50:03 +01:00
parent e5c7d7708e
commit 01fd133352
16 changed files with 225 additions and 225 deletions

View File

@ -34,7 +34,7 @@
CustomPotionEffects:
[
{
ID: byte
Id: byte
Amplifier: byte
Duration: int
Amplifier: bool

View File

@ -530,18 +530,18 @@ public class PS implements Cloneable
// TO STRING
//----------------------------------------------//
@Override
public synchronized String toString()
{
return this.getClass().getSimpleName()+MCore.gson.toJson(this);
}
protected final transient static DecimalFormat twoDForm = new DecimalFormat("#.##");
public List<String> getDesc()
{
// ret.add("<h>World <a>"+this.worldName);
return this.getDesc("<k>%s <v>%s");
}
@Override
public synchronized String toString()
{
return this.getClass().getSimpleName()+MCore.gson.toJson(this);
}
protected final transient static DecimalFormat twoDForm = new DecimalFormat("#.##");
public List<String> getDesc()
{
// ret.add("<h>World <a>"+this.worldName);
return this.getDesc("<k>%s <v>%s");
}
public List<String> getDesc(String format)
{
List<String> ret = new ArrayList<String>();
@ -570,9 +570,9 @@ public class PS implements Cloneable
}
public String getShortDesc()
{
return this.getShortDesc("<k>%s <v>%s ");
}
{
return this.getShortDesc("<k>%s <v>%s ");
}
public String getShortDesc(String format)
{
List<String> ret = new ArrayList<String>();

View File

@ -28,7 +28,7 @@ public enum Permission
Permission(final String permissionNode)
{
this.node = "mcore."+permissionNode;
}
}
public boolean has(CommandSender sender, boolean informSenderIfNot)
{

View File

@ -47,42 +47,42 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
public static final String DAMAGE = "damage";
public static final String NAME = "name";
public static final String LORE = "lore";
public static final String ENCHANTS = "enchants";
public static final String REPAIRCOST = "repaircost";
public static final String BOOK_TITLE = "title";
public static final String BOOK_AUTHOR = "author";
public static final String BOOK_PAGES = "pages";
public static final String LEATHER_ARMOR_COLOR = "color";
public static final String MAP_SCALING = "scaling";
public static final String SKULL_OWNER = "skull";
public static final String POTION_EFFECTS = "effects";
public static final String LORE = "lore";
public static final String ENCHANTS = "enchants";
public static final String REPAIRCOST = "repaircost";
public static final String BOOK_TITLE = "title";
public static final String BOOK_AUTHOR = "author";
public static final String BOOK_PAGES = "pages";
public static final String LEATHER_ARMOR_COLOR = "color";
public static final String MAP_SCALING = "scaling";
public static final String SKULL_OWNER = "skull";
public static final String POTION_EFFECTS = "effects";
// -------------------------------------------- //
// OTHER CONSTANTS
// -------------------------------------------- //
public static final int DEFAULT_ID;
public static final int DEFAULT_COUNT;
public static final int DEFAULT_DAMAGE;
// TODO: Awaiting https://bukkit.atlassian.net/browse/BUKKIT-3203
static final Color DEFAULT_LEATHER_COLOR = Color.fromRGB(0xA06540);
static
{
ItemStack stack = createItemStack();
DEFAULT_ID = stack.getTypeId();
DEFAULT_COUNT = stack.getAmount();
DEFAULT_DAMAGE = stack.getDurability();
}
public static final int DEFAULT_ID;
public static final int DEFAULT_COUNT;
public static final int DEFAULT_DAMAGE;
// TODO: Awaiting https://bukkit.atlassian.net/browse/BUKKIT-3203
static final Color DEFAULT_LEATHER_COLOR = Color.fromRGB(0xA06540);
static
{
ItemStack stack = createItemStack();
DEFAULT_ID = stack.getTypeId();
DEFAULT_COUNT = stack.getAmount();
DEFAULT_DAMAGE = stack.getDurability();
}
// -------------------------------------------- //
// GSON INTERFACE IMPLEMENTATION
@ -286,7 +286,7 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
if (meta2json)
{
if ( ! meta.hasLore()) return;
json.add(LORE, fromStringCollection(meta.getLore()));
json.add(LORE, fromStringCollection(meta.getLore()));
}
else
{
@ -306,13 +306,13 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
{
if ( ! meta.hasEnchants()) return;
JsonObject enchants = new JsonObject();
for (Entry<Enchantment, Integer> entry : meta.getEnchants().entrySet())
{
enchants.addProperty(String.valueOf(entry.getKey().getId()), entry.getValue());
}
json.add(ENCHANTS, enchants);
JsonObject enchants = new JsonObject();
for (Entry<Enchantment, Integer> entry : meta.getEnchants().entrySet())
{
enchants.addProperty(String.valueOf(entry.getKey().getId()), entry.getValue());
}
json.add(ENCHANTS, enchants);
}
else
{
@ -342,7 +342,7 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
if (meta2json)
{
if ( ! repairable.hasRepairCost()) return;
json.addProperty(REPAIRCOST, repairable.getRepairCost());
json.addProperty(REPAIRCOST, repairable.getRepairCost());
}
else
{
@ -528,11 +528,11 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
public static JsonArray fromStringCollection(Collection<String> strings)
{
JsonArray ret = new JsonArray();
for (String string : strings)
{
ret.add(new JsonPrimitive(string));
}
return ret;
for (String string : strings)
{
ret.add(new JsonPrimitive(string));
}
return ret;
}
public static List<String> toStringCollection(JsonElement json)
@ -546,8 +546,8 @@ public class ItemStackAdapterV2 implements JsonDeserializer<ItemStack>, JsonSeri
JsonElement element = iter.next();
ret.add(element.getAsString());
}
return ret;
return ret;
}
// -------------------------------------------- //

View File

@ -19,8 +19,8 @@ public class BukkitGlueCommand extends Command
{
if ( ! mcommand.p().isEnabled())
{
return false;
}
return false;
}
this.mcommand.execute(sender, Txt.tokenizeArguments(Txt.implode(args, " ")));
return true;

View File

@ -32,7 +32,7 @@ public class ExamineThread<E, L> extends Thread
catch (InterruptedException e)
{
// We've been interrupted. Lets bail.
return;
return;
}
catch (Exception e)
{

View File

@ -2,14 +2,14 @@ package com.massivecraft.mcore5.store;
public enum ModificationState
{
LOCAL_ALTER (true, true),
LOCAL_ALTER (true, true),
LOCAL_ATTACH (true, true),
LOCAL_DETACH (true, true),
REMOTE_ALTER (true, false),
REMOTE_ATTACH (true, false),
REMOTE_DETACH (true, false),
NONE (false, false),
UNKNOWN (false, false),
NONE (false, false),
UNKNOWN (false, false),
;
private final boolean modified;

View File

@ -44,15 +44,15 @@ public class IdStrategyAiMongo extends IdStrategyAbstract<String, String>
// this object represents your "query", its analogous to a WHERE clause in SQL
DBObject query = new BasicDBObject();
query.put("_id", sequenseName); // where _id = the input sequence name
query.put("_id", sequenseName); // where _id = the input sequence name
// this object represents the "update" or the SET blah=blah in SQL
DBObject change = new BasicDBObject(this.sequenseField, 1);
DBObject update = new BasicDBObject("$inc", change); // the $inc here is a mongodb command for increment
// this object represents the "update" or the SET blah=blah in SQL
DBObject change = new BasicDBObject(this.sequenseField, 1);
DBObject update = new BasicDBObject("$inc", change); // the $inc here is a mongodb command for increment
// Atomically updates the sequence field and returns the value for you
DBObject res = sequenseCollection.findAndModify(query, new BasicDBObject(), new BasicDBObject(), false, update, true, true);
return res.get(this.sequenseField).toString();
// Atomically updates the sequence field and returns the value for you
DBObject res = sequenseCollection.findAndModify(query, new BasicDBObject(), new BasicDBObject(), false, update, true, true);
return res.get(this.sequenseField).toString();
}
// -------------------------------------------- //

View File

@ -44,14 +44,14 @@ public class BiomeUtil
WorldServer worldServer = craftWorld.getHandle();
BiomeBase bb = BiomeBase.biomes[id];
if (craftWorld.loadChunk(x >> 4, z >> 4, false)) {
Chunk chunk = worldServer.getChunkAtWorldCoords(x, z);
if (craftWorld.loadChunk(x >> 4, z >> 4, false)) {
Chunk chunk = worldServer.getChunkAtWorldCoords(x, z);
if (chunk != null) {
byte[] biomevals = chunk.m();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
}
}
if (chunk != null) {
byte[] biomevals = chunk.m();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
}
}
}
public static int getBiomeIdAt(World world, int x, int z)

View File

@ -45,13 +45,13 @@ public class ClassResolveUtil
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try
{
return classLoader.loadClass(className);
}
catch (ClassNotFoundException e)
{
return Class.forName(className, false, classLoader);
}
try
{
return classLoader.loadClass(className);
}
catch (ClassNotFoundException e)
{
return Class.forName(className, false, classLoader);
}
}
}

View File

@ -36,50 +36,50 @@ public class EventUtil
public static void callEventAt(Event event, EventPriority priority)
{
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners().clone();
RegisteredListener[] listeners = handlers.getRegisteredListeners().clone();
for (RegisteredListener registration : listeners)
{
try
for (RegisteredListener registration : listeners)
{
try
{
EventPriority thisPriority = (EventPriority) fieldRegisteredListenerDotPriority.get(registration);
if (thisPriority != priority) continue;
EventPriority thisPriority = (EventPriority) fieldRegisteredListenerDotPriority.get(registration);
if (thisPriority != priority) continue;
}
catch (Exception e)
{
e.printStackTrace();
continue;
}
fireEventRegistration(event, registration);
}
fireEventRegistration(event, registration);
}
}
public static void callEventAfter(Event event, Listener listener, EventPriority priority)
{
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners().clone();
RegisteredListener[] listeners = handlers.getRegisteredListeners().clone();
boolean run = false;
for (RegisteredListener registration : listeners)
{
if (run)
{
fireEventRegistration(event, registration);
}
else
{
try
{
EventPriority thisPriority = (EventPriority) fieldRegisteredListenerDotPriority.get(registration);
Listener thisListener = (Listener) fieldRegisteredListenerDotListener.get(registration);
if (thisListener == listener && thisPriority == priority) run = true;
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
boolean run = false;
for (RegisteredListener registration : listeners)
{
if (run)
{
fireEventRegistration(event, registration);
}
else
{
try
{
EventPriority thisPriority = (EventPriority) fieldRegisteredListenerDotPriority.get(registration);
Listener thisListener = (Listener) fieldRegisteredListenerDotListener.get(registration);
if (thisListener == listener && thisPriority == priority) run = true;
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
/**

View File

@ -12,17 +12,17 @@ public class LightUtil
// RECALC LIGHT LEVEL AT
// -------------------------------------------- //
// This method will update the light level for the block.
// It will however only work properly if all chunks that are around the chunk the block is in are loaded.
// It will however only work properly if all chunks that are around the chunk the block is in are loaded.
public static void recalcLightLevelAt(Block block)
{
recalcLightLevelAt(block.getWorld(), block.getX(), block.getY(), block.getZ());
}
public static void recalcLightLevelAt(World world, int x, int y, int z)
{
CraftWorld cworld = (CraftWorld)world;
WorldServer worldServer = cworld.getHandle();
worldServer.z(x, y, z);
}
public static void recalcLightLevelAt(Block block)
{
recalcLightLevelAt(block.getWorld(), block.getX(), block.getY(), block.getZ());
}
public static void recalcLightLevelAt(World world, int x, int y, int z)
{
CraftWorld cworld = (CraftWorld)world;
WorldServer worldServer = cworld.getHandle();
worldServer.z(x, y, z);
}
}

View File

@ -203,16 +203,16 @@ public class MUtil
//http://stackoverflow.com/questions/2864840/treemap-sort-by-value
/*public static <K,V extends Comparable<? super V>> SortedSet<Map.Entry<K,V>> entriesSortedByValues(Map<K,V> map) {
SortedSet<Map.Entry<K,V>> sortedEntries = new TreeSet<Map.Entry<K,V>>(
new Comparator<Map.Entry<K,V>>() {
@Override public int compare(Map.Entry<K,V> e1, Map.Entry<K,V> e2) {
int res = e1.getValue().compareTo(e2.getValue());
return res != 0 ? res : 1; // Special fix to preserve items with equal values
}
}
);
sortedEntries.addAll(map.entrySet());
return sortedEntries;
SortedSet<Map.Entry<K,V>> sortedEntries = new TreeSet<Map.Entry<K,V>>(
new Comparator<Map.Entry<K,V>>() {
@Override public int compare(Map.Entry<K,V> e1, Map.Entry<K,V> e2) {
int res = e1.getValue().compareTo(e2.getValue());
return res != 0 ? res : 1; // Special fix to preserve items with equal values
}
}
);
sortedEntries.addAll(map.entrySet());
return sortedEntries;
}*/
// http://stackoverflow.com/questions/2864840/treemap-sort-by-value

View File

@ -89,43 +89,43 @@ public class Perm
// GET CREATIVE
// -------------------------------------------- //
public static Permission getCreative(String name)
{
return getCreative(name, null, null, null);
}
public static Permission getCreative(String name)
{
return getCreative(name, null, null, null);
}
public static Permission getCreative(String name, String description)
{
return getCreative(name, description, null, null);
}
public static Permission getCreative(String name, String description)
{
return getCreative(name, description, null, null);
}
public static Permission getCreative(String name, PermissionDefault defaultValue)
{
return getCreative(name, null, defaultValue, null);
}
public static Permission getCreative(String name, PermissionDefault defaultValue)
{
return getCreative(name, null, defaultValue, null);
}
public static Permission getCreative(String name, String description, PermissionDefault defaultValue)
{
return getCreative(name, description, defaultValue, null);
}
public static Permission getCreative(String name, String description, PermissionDefault defaultValue)
{
return getCreative(name, description, defaultValue, null);
}
public static Permission getCreative(String name, Map<String, Boolean> children)
{
return getCreative(name, null, null, children);
}
public static Permission getCreative(String name, Map<String, Boolean> children)
{
return getCreative(name, null, null, children);
}
public static Permission getCreative(String name, String description, Map<String, Boolean> children)
{
return getCreative(name, description, null, children);
}
public static Permission getCreative(String name, String description, Map<String, Boolean> children)
{
return getCreative(name, description, null, children);
}
public static Permission getCreative(String name, PermissionDefault defaultValue, Map<String, Boolean> children)
{
return getCreative(name, null, defaultValue, children);
}
public static Permission getCreative(String name, PermissionDefault defaultValue, Map<String, Boolean> children)
{
return getCreative(name, null, defaultValue, children);
}
public static Permission getCreative(String name, String description, PermissionDefault defaultValue, Map<String, Boolean> children)
{
public static Permission getCreative(String name, String description, PermissionDefault defaultValue, Map<String, Boolean> children)
{
Permission ret = Bukkit.getPluginManager().getPermission(name);
if (ret == null)
{
@ -133,5 +133,5 @@ public class Perm
Bukkit.getPluginManager().addPermission(ret);
}
return ret;
}
}
}

View File

@ -19,16 +19,16 @@ import org.bukkit.craftbukkit.v1_4_5.CraftWorld;
// -----------------------------
// Smoke Directions
// -----------------------------
// Direction ID Direction
// 0 South - East
// 1 South
// 2 South - West
// 3 East
// 4 (Up or middle ?)
// 5 West
// 6 North - East
// 7 North
// 8 North - West
// Direction ID Direction
// 0 South - East
// 1 South
// 2 South - West
// 3 East
// 4 (Up or middle ?)
// 5 West
// 6 North - East
// 7 North
// 8 North - West
//-----------------------------
public class SmokeUtil
@ -98,13 +98,13 @@ public class SmokeUtil
}
public static void fakeExplosion(Location location, int viewDistance)
{
List<ChunkPosition> chunkPositions = new ArrayList<ChunkPosition>();
Packet60Explosion packet = new Packet60Explosion(location.getX(),location.getY(), location.getZ(), 0.1f, chunkPositions, null);
CraftServer craftServer = (CraftServer) Bukkit.getServer();
MinecraftServer minecraftServer = craftServer.getServer();
minecraftServer.getServerConfigurationManager().sendPacketNearby(location.getX(), location.getY(), location.getZ(), viewDistance, ((CraftWorld)location.getWorld()).getHandle().dimension, packet);
}
{
List<ChunkPosition> chunkPositions = new ArrayList<ChunkPosition>();
Packet60Explosion packet = new Packet60Explosion(location.getX(),location.getY(), location.getZ(), 0.1f, chunkPositions, null);
CraftServer craftServer = (CraftServer) Bukkit.getServer();
MinecraftServer minecraftServer = craftServer.getServer();
minecraftServer.getServerConfigurationManager().sendPacketNearby(location.getX(), location.getY(), location.getZ(), viewDistance, ((CraftWorld)location.getWorld()).getHandle().dimension, packet);
}
// -------------------------------------------- //
// Attach continuous effects to or locations

View File

@ -19,12 +19,12 @@ public class Txt
public static final Pattern parsePattern;
public static final long millisPerSecond = 1000;
public static final long millisPerMinute = 60 * millisPerSecond;
public static final long millisPerHour = 60 * millisPerMinute;
public static final long millisPerDay = 24 * millisPerHour;
public static final long millisPerWeek = 7 * millisPerDay;
public static final long millisPerMonth = 31 * millisPerDay;
public static final long millisPerYear = 365 * millisPerDay;
public static final long millisPerMinute = 60 * millisPerSecond;
public static final long millisPerHour = 60 * millisPerMinute;
public static final long millisPerDay = 24 * millisPerHour;
public static final long millisPerWeek = 7 * millisPerDay;
public static final long millisPerMonth = 31 * millisPerDay;
public static final long millisPerYear = 365 * millisPerDay;
public static final Set<String> vowel = MUtil.set(
"A", "E", "I", "O", "U", "Y", "Å", "Ä", "Ö",
@ -210,32 +210,32 @@ public class Txt
public static String repeat(String string, int times)
{
if (times <= 0) return "";
else return string + repeat(string, times-1);
if (times <= 0) return "";
else return string + repeat(string, times-1);
}
public static String implode(final Object[] list, final String glue, final String format)
{
StringBuilder ret = new StringBuilder();
for (int i=0; i<list.length; i++)
{
Object item = list[i];
String str = (item == null ? "NULL" : item.toString());
if (i!=0)
{
ret.append(glue);
}
if (format != null)
{
ret.append(String.format(format, str));
}
else
{
ret.append(str);
}
}
return ret.toString();
StringBuilder ret = new StringBuilder();
for (int i=0; i<list.length; i++)
{
Object item = list[i];
String str = (item == null ? "NULL" : item.toString());
if (i!=0)
{
ret.append(glue);
}
if (format != null)
{
ret.append(String.format(format, str));
}
else
{
ret.append(str);
}
}
return ret.toString();
}
public static String implode(final Object[] list, final String glue)
{
@ -252,7 +252,7 @@ public class Txt
public static String implodeCommaAndDot(final Collection<? extends Object> objects, final String format, final String comma, final String and, final String dot)
{
if (objects.size() == 0) return "";
if (objects.size() == 0) return "";
if (objects.size() == 1)
{
return implode(objects, comma, format);
@ -285,11 +285,11 @@ public class Txt
}
public static String implodeCommaAndDot(final Collection<? extends Object> objects, final String color)
{
return implodeCommaAndDot(objects, color+", ", color+" and ", color+".");
return implodeCommaAndDot(objects, color+", ", color+" and ", color+".");
}
public static String implodeCommaAnd(final Collection<? extends Object> objects, final String color)
{
return implodeCommaAndDot(objects, color+", ", color+" and ", "");
return implodeCommaAndDot(objects, color+", ", color+" and ", "");
}
public static String implodeCommaAndDot(final Collection<? extends Object> objects)
{