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: CustomPotionEffects:
[ [
{ {
ID: byte Id: byte
Amplifier: byte Amplifier: byte
Duration: int Duration: int
Amplifier: bool Amplifier: bool

View File

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

View File

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

View File

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

View File

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

View File

@ -2,14 +2,14 @@ package com.massivecraft.mcore5.store;
public enum ModificationState public enum ModificationState
{ {
LOCAL_ALTER (true, true), LOCAL_ALTER (true, true),
LOCAL_ATTACH (true, true), LOCAL_ATTACH (true, true),
LOCAL_DETACH (true, true), LOCAL_DETACH (true, true),
REMOTE_ALTER (true, false), REMOTE_ALTER (true, false),
REMOTE_ATTACH (true, false), REMOTE_ATTACH (true, false),
REMOTE_DETACH (true, false), REMOTE_DETACH (true, false),
NONE (false, false), NONE (false, false),
UNKNOWN (false, false), UNKNOWN (false, false),
; ;
private final boolean modified; 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 // this object represents your "query", its analogous to a WHERE clause in SQL
DBObject query = new BasicDBObject(); 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 // this object represents the "update" or the SET blah=blah in SQL
DBObject change = new BasicDBObject(this.sequenseField, 1); DBObject change = new BasicDBObject(this.sequenseField, 1);
DBObject update = new BasicDBObject("$inc", change); // the $inc here is a mongodb command for increment 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 // Atomically updates the sequence field and returns the value for you
DBObject res = sequenseCollection.findAndModify(query, new BasicDBObject(), new BasicDBObject(), false, update, true, true); DBObject res = sequenseCollection.findAndModify(query, new BasicDBObject(), new BasicDBObject(), false, update, true, true);
return res.get(this.sequenseField).toString(); return res.get(this.sequenseField).toString();
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

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

View File

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

View File

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

View File

@ -12,17 +12,17 @@ public class LightUtil
// RECALC LIGHT LEVEL AT // RECALC LIGHT LEVEL AT
// -------------------------------------------- // // -------------------------------------------- //
// This method will update the light level for the block. // 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) public static void recalcLightLevelAt(Block block)
{ {
recalcLightLevelAt(block.getWorld(), block.getX(), block.getY(), block.getZ()); recalcLightLevelAt(block.getWorld(), block.getX(), block.getY(), block.getZ());
} }
public static void recalcLightLevelAt(World world, int x, int y, int z) public static void recalcLightLevelAt(World world, int x, int y, int z)
{ {
CraftWorld cworld = (CraftWorld)world; CraftWorld cworld = (CraftWorld)world;
WorldServer worldServer = cworld.getHandle(); WorldServer worldServer = cworld.getHandle();
worldServer.z(x, y, z); worldServer.z(x, y, z);
} }
} }

View File

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

View File

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

View File

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

View File

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