Skip to content

Commit

Permalink
CheckStyle: Fix MultipleVariableDeclarations violations
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter12345 committed Jun 9, 2018
1 parent aaf0798 commit fc08e99
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/laytonsmith/PureUtilities/Color.java
Expand Up @@ -594,7 +594,9 @@ public static Color getColor(String nm, int v) {
* @since JDK1.0
*/
public static int HSBtoRGB(float hue, float saturation, float brightness) {
int r = 0, g = 0, b = 0;
int r = 0;
int g = 0;
int b = 0;
if(saturation == 0) {
r = g = b = (int) (brightness * 255.0f + 0.5f);
} else {
Expand Down Expand Up @@ -658,7 +660,9 @@ public static int HSBtoRGB(float hue, float saturation, float brightness) {
* @since JDK1.0
*/
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) {
float hue, saturation, brightness;
float hue;
float saturation;
float brightness;
if(hsbvals == null) {
hsbvals = new float[3];
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/laytonsmith/core/ObjectGenerator.java
Expand Up @@ -331,7 +331,8 @@ public Construct itemMeta(MCItemStack is, Target t) {
if(!is.hasItemMeta()) {
return CNull.NULL;
} else {
Construct display, lore;
Construct display;
Construct lore;
CArray ma = CArray.GetAssociativeArray(t);
MCItemMeta meta = is.getItemMeta();
if(meta.hasDisplayName()) {
Expand Down Expand Up @@ -462,7 +463,9 @@ public Construct itemMeta(MCItemStack is, Target t) {
CArray color = color(((MCLeatherArmorMeta) meta).getColor(), t);
ma.set("color", color, t);
} else if(meta instanceof MCBookMeta) {
Construct title, author, pages;
Construct title;
Construct author;
Construct pages;
if(((MCBookMeta) meta).hasTitle()) {
title = new CString(((MCBookMeta) meta).getTitle(), t);
} else {
Expand Down Expand Up @@ -1125,7 +1128,8 @@ public List<MCLivingEntity.MCEffect> potions(CArray ea, Target t) {
for(String key : ea.stringKeySet()) {
if(ea.get(key, t) instanceof CArray) {
CArray effect = (CArray) ea.get(key, t);
int potionID = 0, strength = 0;
int potionID = 0;
int strength = 0;
double seconds = 30.0;
boolean ambient = false;
boolean particles = true;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/laytonsmith/core/events/Prefilters.java
Expand Up @@ -191,7 +191,8 @@ private static void ExpressionMatch(Construct expression, String key, Construct
}
String eClass = "com.sk89q.worldedit.internal.expression.Expression";
String errClass = "com.sk89q.worldedit.internal.expression.ExpressionException";
Class eClazz, errClazz;
Class eClazz;
Class errClazz;
try {
eClazz = Class.forName(eClass);
errClazz = Class.forName(errClass);
Expand Down
Expand Up @@ -1240,7 +1240,8 @@ public static class set_entity_rider extends EntitySetterFunction {

@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
MCEntity horse, rider;
MCEntity horse;
MCEntity rider;
boolean success;
if(args[0] instanceof CNull) {
horse = null;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/laytonsmith/core/functions/Environment.java
Expand Up @@ -971,7 +971,8 @@ public Construct exec(Target t,
MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t);
MCSound sound;
MCSoundCategory category = null;
float volume = 1, pitch = 1;
float volume = 1;
float pitch = 1;

if(!(args[1] instanceof CArray)) {
throw new CREFormatException("An array was expected but recieved " + args[1], t);
Expand Down Expand Up @@ -1088,7 +1089,8 @@ public Construct exec(Target t,
MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t);
String path;
MCSoundCategory category = null;
float volume = 1, pitch = 1;
float volume = 1;
float pitch = 1;

if(!(args[1] instanceof CArray)) {
throw new CREFormatException("An array was expected but recieved " + args[1], t);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/laytonsmith/core/functions/ItemMeta.java
Expand Up @@ -179,7 +179,8 @@ public Boolean runAsync() {
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer();
Construct slot, meta;
Construct slot;
Construct meta;
MCItemStack is;
if(args.length == 3) {
p = Static.GetPlayer(args[0], t);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/laytonsmith/core/functions/Math.java
Expand Up @@ -2382,7 +2382,8 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
}*/
String eClass = "com.sk89q.worldedit.internal.expression.Expression";
String errClass = "com.sk89q.worldedit.internal.expression.ExpressionException";
Class eClazz, errClazz;
Class eClazz;
Class errClazz;
try {
eClazz = Class.forName(eClass);
errClazz = Class.forName(errClass);
Expand Down
Expand Up @@ -4204,13 +4204,13 @@ public Boolean runAsync() {
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer();
int hunger, hungerIndex = 0;
int hungerIndex = 0;
if(args.length == 2) {
p = Static.GetPlayer(args[0], t);
hungerIndex = 1;
}
Static.AssertPlayerNonNull(p, t);
hunger = Static.getInt32(args[hungerIndex], t);
int hunger = Static.getInt32(args[hungerIndex], t);
p.setFoodLevel(hunger);
return CVoid.VOID;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/laytonsmith/core/functions/Weather.java
Expand Up @@ -59,7 +59,9 @@ public Class<? extends CREThrowable>[] thrown() {

@Override
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException {
int x, y, z;
int x;
int y;
int z;
UUID ent;
MCWorld w = null;
boolean safe = false;
Expand Down
Expand Up @@ -1072,7 +1072,8 @@ public void testAmbigousCommandRegistration() {
* @param expectFail - True if cmd1 and cmd2 are expected to be ambigous, false otherwise.
*/
private void ambigousCommandRegistrationHelper(String cmd1, String cmd2, boolean expectFail) {
Script s1, s2;
Script s1;
Script s2;
try {
List<Script> scripts = MethodScriptCompiler.preprocess(
MethodScriptCompiler.lex(cmd1 + "\n" + cmd2, null, false));
Expand All @@ -1086,7 +1087,8 @@ private void ambigousCommandRegistrationHelper(String cmd1, String cmd2, boolean
}

// Check scripts 1 and 2 against eachother.
ConfigCompileException e1 = null, e2 = null;
ConfigCompileException e1 = null;
ConfigCompileException e2 = null;
try {
s2.checkAmbiguous(Arrays.asList(new Script[]{s1}));
} catch (ConfigCompileException e) {
Expand Down

0 comments on commit fc08e99

Please sign in to comment.