Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 19, 2017
1 parent a00cce9 commit b643ab3
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 24 deletions.
Expand Up @@ -115,7 +115,8 @@ public void execute(CommandQueue queue, CommandEntry entry) {
(ColorSet.good + "!") :
(ColorSet.good + " with reason " + ColorSet.emphasis + reason.toPlain() + ColorSet.good + "!")));
}
} catch (UnknownHostException e) {
}
catch (UnknownHostException e) {
queue.handleError(entry, "Invalid IP address provided!");
return;
}
Expand Down
Expand Up @@ -52,7 +52,7 @@ public int getMaximumArguments() {
@Override
public void execute(CommandQueue queue, CommandEntry entry) {
PlayerTag player = null;
if (queue.commandStack.peek().hasDefinition("player")){
if (queue.commandStack.peek().hasDefinition("player")) {
AbstractTagObject ato = queue.commandStack.peek().getDefinition("player");
if (ato instanceof PlayerTag) {
player = (PlayerTag) ato;
Expand Down
Expand Up @@ -67,7 +67,8 @@ public void execute(CommandQueue queue, CommandEntry entry) {
queue.outGood("Pardoning IP " + ColorSet.emphasis + address.getHostName() + ColorSet.good + "!");
}
Sponge.getServiceManager().provide(BanService.class).get().pardon(address);
} catch (UnknownHostException e) {
}
catch (UnknownHostException e) {
queue.handleError(entry, "Invalid IP address provided!");
}
}
Expand Down
Expand Up @@ -8,7 +8,7 @@
import com.denizenscript.denizen2sponge.tags.objects.PlayerTag;
import org.spongepowered.api.Sponge;

public class ExecuteCommand extends AbstractCommand {
public class ExecuteCommand extends AbstractCommand {

// <--[command]
// @Name execute
Expand Down
Expand Up @@ -85,7 +85,8 @@ public void execute(CommandQueue queue, CommandEntry entry) {
if (queue.shouldShowGood()) {
queue.outGood("World '" + ColorSet.emphasis + worldName + ColorSet.good + "' was deleted successfully!");
}
} catch (InterruptedException | ExecutionException e) {
}
catch (InterruptedException | ExecutionException e) {
queue.handleError(entry, "World deletion failed!");
Denizen2Core.getImplementation().outputException(e);
}
Expand Down
Expand Up @@ -46,7 +46,7 @@ public int getMaximumArguments() {

@Override
public void execute(CommandQueue queue, CommandEntry entry) {
WorldTag world = WorldTag.getFor(queue.error, entry.getArgumentObject(queue, 0));
WorldTag world = WorldTag.getFor(queue.error, entry.getArgumentObject(queue, 0));
if (queue.shouldShowGood()) {
queue.outGood("Attempting to unload world '" + ColorSet.emphasis + world.debug() + ColorSet.good + "'...");
}
Expand Down
Expand Up @@ -207,6 +207,7 @@ public HashMap<String, Function2<TagData, AbstractTagObject, AbstractTagObject>>
public String getTagTypeName() {
return "ServerBaseTag";
}

@Override
public AbstractTagObject handleElseCase(TagData data) {
return new TextTag("server");
Expand Down
Expand Up @@ -99,7 +99,7 @@ else if (str.equals("reset")) {
else if (str.equals("underline")) {
build.style(TextStyles.UNDERLINE);
}
else if (str.equals("strike")) {
else if (str.equals("strike")) {
build.style(TextStyles.STRIKETHROUGH);
}
}
Expand Down
Expand Up @@ -110,12 +110,12 @@ public boolean contains(UtilLocation point) {
}
CuboidTag ct = (CuboidTag) obj;
ListTag lt = new ListTag();
int maxx = (int)Math.ceil(ct.internal.max.x + 0.01);
int maxy = (int)Math.ceil(ct.internal.max.y + 0.01);
int maxz = (int)Math.ceil(ct.internal.max.z + 0.01);
for (int x = (int)Math.floor(ct.internal.min.x); x < maxx; x++) {
for (int y = (int)Math.floor(ct.internal.min.y); y < maxy; y++) {
for (int z = (int)Math.floor(ct.internal.min.z); z < maxz; z++) {
int maxx = (int) Math.ceil(ct.internal.max.x + 0.01);
int maxy = (int) Math.ceil(ct.internal.max.y + 0.01);
int maxz = (int) Math.ceil(ct.internal.max.z + 0.01);
for (int x = (int) Math.floor(ct.internal.min.x); x < maxx; x++) {
for (int y = (int) Math.floor(ct.internal.min.y); y < maxy; y++) {
for (int z = (int) Math.floor(ct.internal.min.z); z < maxz; z++) {
Location<World> loc = new Location<>(ct.internal.min.world, x, y, z);
if (valids == null || valids.contains(loc.getBlockType())) {
lt.getInternal().add(new LocationTag(loc));
Expand Down Expand Up @@ -166,6 +166,7 @@ public AbstractTagObject handleElseCase(TagData data) {
public String getTagTypeName() {
return "CuboidTag";
}

@Override
public String toString() {
return CoreUtilities.doubleToString(internal.min.x) + ","
Expand Down
Expand Up @@ -308,15 +308,15 @@ public String friendlyName() {
// @ReturnType EntityTag
// @Returns the entity that is the base of the stack that this entity is currently part of.
// -->
handlers.put("base_vehicle", (dat,obj) -> new EntityTag(((EntityTag) obj).internal.getBaseVehicle()));
handlers.put("base_vehicle", (dat, obj) -> new EntityTag(((EntityTag) obj).internal.getBaseVehicle()));
// <--[tag]
// @Name EntityTag.on_ground
// @Updated 2017/04/04
// @Group Current Information
// @ReturnType BooleanTag
// @Returns whether this entity is on the ground or not.
// -->
handlers.put("on_ground", (dat,obj) -> new BooleanTag(((EntityTag) obj).internal.isOnGround()));
handlers.put("on_ground", (dat, obj) -> new BooleanTag(((EntityTag) obj).internal.isOnGround()));
// <--[tag]
// @Name EntityTag.scale
// @Updated 2017/04/04
Expand Down Expand Up @@ -430,6 +430,7 @@ public String toString() {
public String getTagTypeName() {
return "EntityTag";
}

@Override
public String debug() {
return toString() + "/" + internal.getType().getId();
Expand Down
Expand Up @@ -97,6 +97,7 @@ public String toString() {
public String getTagTypeName() {
return "FormattedTextTag";
}

@Override
public String debug() {
return "Formatted[" + internal.toPlain() + "]";
Expand Down
Expand Up @@ -196,6 +196,7 @@ public String savable() {
public String getTagTypeName() {
return "InventoryTag";
}

@Override
public String debug() {
return toString();
Expand Down
Expand Up @@ -145,7 +145,7 @@ public ItemStack getInternal() {
// -->
handlers.put("with_quantity", (dat, obj) -> {
ItemStack its = ((ItemTag) obj).internal.createSnapshot().createStack();
its.setQuantity((int)IntegerTag.getFor(dat.error, dat.getNextModifier()).getInternal());
its.setQuantity((int) IntegerTag.getFor(dat.error, dat.getNextModifier()).getInternal());
return new ItemTag(its);
});
// <--[tag]
Expand Down Expand Up @@ -221,7 +221,7 @@ public static ItemTag getFor(Action<String> error, String text) {
ItemTypeTag type = ItemTypeTag.getFor(error, split.get(0));
int q = 1;
if (split.size() > 1) {
q = (int)IntegerTag.getFor(error, split.get(1)).getInternal();
q = (int) IntegerTag.getFor(error, split.get(1)).getInternal();
}
ItemStack its = ItemStack.of(type.getInternal(), q);
if (split.size() > 2) {
Expand Down Expand Up @@ -252,6 +252,7 @@ public AbstractTagObject handleElseCase(TagData data) {
public String getTagTypeName() {
return "ItemTag";
}

@Override
public String toString() {
return internal.getType().getId() + "/" + internal.getQuantity() + "/" + DataKeys.getAllKeys(internal).toString();
Expand Down
Expand Up @@ -93,6 +93,7 @@ public AbstractTagObject handleElseCase(TagData data) {
public String getTagTypeName() {
return "ItemTypeTag";
}

@Override
public String toString() {
return internal.getId();
Expand Down
Expand Up @@ -55,9 +55,10 @@ public LocationTag(Location<World> location) {
this(location.getX(), location.getY(), location.getZ(), location.getExtent());
}

public LocationTag(Vector3i location, World world) {
public LocationTag(Vector3i location, World world) {
this(location.getX(), location.getY(), location.getZ(), world);
}

public LocationTag(Vector3d location) {
this(location.getX(), location.getY(), location.getZ());
}
Expand Down Expand Up @@ -348,8 +349,8 @@ && LengthSquared(ent.getLocation().sub(loc.toVector3d())) < range * range) {
}
double range = NumberTag.getFor(dat.error, map.getInternal().get("range")).getInternal();
UtilLocation loc = ((LocationTag) obj).getInternal();
int low = (int)Math.floor(-range);
int high = (int)Math.ceil(range);
int low = (int) Math.floor(-range);
int high = (int) Math.ceil(range);
for (int x = low; x < high; x++) {
for (int y = low; y < high; y++) {
for (int z = low; z < high; z++) {
Expand Down Expand Up @@ -453,6 +454,7 @@ public AbstractTagObject handleElseCase(TagData data) {
public String getTagTypeName() {
return "LocationTag";
}

@Override
public String toString() {
String s = CoreUtilities.doubleToString(internal.x) + ","
Expand Down
Expand Up @@ -88,7 +88,7 @@ public User getInternal() {
// @ReturnType NumberTag
// @Returns the saturation of the player. ONLINE-PLAYERS-ONLY.
// -->
handlers.put("saturation", (dat, obj) ->{
handlers.put("saturation", (dat, obj) -> {
Player pl = ((PlayerTag) obj).getOnline(dat);
if (pl == null) {
return new NullTag();
Expand Down Expand Up @@ -305,6 +305,7 @@ public String toString() {
public String getTagTypeName() {
return "PlayerTag";
}

@Override
public String debug() {
return toString() + "/" + internal.getName();
Expand Down
Expand Up @@ -171,7 +171,7 @@ public static ImmutableDataHolder with(ImmutableDataHolder entity, Key key, Abst
}
}
if (Boolean.class.isAssignableFrom(clazz)) {
return (ImmutableDataHolder) entity.with(key, BooleanTag.getFor(error, value).getInternal()).get();
return (ImmutableDataHolder) entity.with(key, BooleanTag.getFor(error, value).getInternal()).get();
}
else if (CatalogType.class.isAssignableFrom(clazz)) {
String val = value.toString();
Expand Down
Expand Up @@ -16,6 +16,7 @@ public class FlagMapDataBuilder extends AbstractDataBuilder<FlagMapDataImpl> imp
protected FlagMapDataBuilder(Class<FlagMapDataImpl> requiredClass, int supportedVersion) {
super(requiredClass, supportedVersion);
}

@Override
public FlagMapDataImpl create() {
return new FlagMapDataImpl();
Expand All @@ -41,7 +42,9 @@ protected Optional<FlagMapDataImpl> buildContent(DataView container) throws Inva
return Optional.empty();
}
String val = str.get();
MapTag mt = (MapTag) Denizen2Core.loadFromSaved((e) -> { throw new InvalidDataException("Denizen2: " + e); }, val);
MapTag mt = (MapTag) Denizen2Core.loadFromSaved((e) -> {
throw new InvalidDataException("Denizen2: " + e);
}, val);
return Optional.of(new FlagMapDataImpl(new FlagMap(mt)));
}
}
Expand Up @@ -54,7 +54,7 @@ public Optional<FlagMapDataImpl> fill(DataHolder dataHolder, MergeFunction overl

@Override
public Optional<FlagMapDataImpl> from(DataContainer container) {
if(container.contains(FlagHelper.FLAGMAP)) {
if (container.contains(FlagHelper.FLAGMAP)) {
// Loads the structure defined in toContainer
setValue(container.getSerializable(FlagHelper.FLAGMAP.getQuery(), FlagMap.class).get());
return Optional.of(this);
Expand Down

0 comments on commit b643ab3

Please sign in to comment.