Beautify code

This commit is contained in:
MattBDev
2016-06-02 11:38:47 -04:00
parent 8e306a92e3
commit da58c7b411
77 changed files with 1319 additions and 1311 deletions

View File

@ -376,8 +376,8 @@ public class BukkitChunkManager extends ChunkManager {
int tz = pos2.getZ();
for (Entity entity : entities) {
if (!(entity instanceof Player)) {
org.bukkit.Location loc = entity.getLocation();
if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) {
org.bukkit.Location location = entity.getLocation();
if (location.getX() >= bx && location.getX() <= tx && location.getZ() >= bz && location.getZ() <= tz) {
entity.remove();
}
}
@ -472,15 +472,15 @@ public class BukkitChunkManager extends ChunkManager {
int[] count = new int[6];
if (doWhole) {
for (Entity entity : entities) {
org.bukkit.Location loc = entity.getLocation();
Chunk chunk = loc.getChunk();
org.bukkit.Location location = entity.getLocation();
Chunk chunk = location.getChunk();
if (chunks.contains(chunk)) {
int X = chunk.getX();
int Z = chunk.getZ();
if (X > bx && X < tx && Z > bz && Z < tz) {
count(count, entity);
} else {
Plot other = area.getPlot(BukkitUtil.getLocation(loc));
Plot other = area.getPlot(BukkitUtil.getLocation(location));
if (plot.equals(other)) {
count(count, entity);
}

View File

@ -179,11 +179,11 @@ public class BukkitSetupUtils extends SetupUtils {
}
@Override
public String getGenerator(PlotArea plotworld) {
public String getGenerator(PlotArea plotArea) {
if (SetupUtils.generators.isEmpty()) {
updateGenerators();
}
World world = Bukkit.getWorld(plotworld.worldname);
World world = Bukkit.getWorld(plotArea.worldname);
if (world == null) {
return null;
}

View File

@ -43,7 +43,7 @@ public class BukkitUtil extends WorldUtil {
private static Player lastPlayer = null;
private static PlotPlayer lastPlotPlayer = null;
public static void removePlayer(String plr) {
public static void removePlayer(String player) {
lastPlayer = null;
lastPlotPlayer = null;
}
@ -62,9 +62,9 @@ public class BukkitUtil extends WorldUtil {
return lastPlotPlayer;
}
String name = player.getName();
PlotPlayer pp = UUIDHandler.getPlayer(name);
if (pp != null) {
return pp;
PlotPlayer plotPlayer = UUIDHandler.getPlayer(name);
if (plotPlayer != null) {
return plotPlayer;
}
lastPlotPlayer = new BukkitPlayer(player);
UUIDHandler.getPlayers().put(name, lastPlotPlayer);
@ -102,15 +102,15 @@ public class BukkitUtil extends WorldUtil {
}
public static Location getLocation(Entity entity) {
org.bukkit.Location loc = entity.getLocation();
String world = loc.getWorld().getName();
return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
org.bukkit.Location location = entity.getLocation();
String world = location.getWorld().getName();
return new Location(world, location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
public static Location getLocationFull(Entity entity) {
org.bukkit.Location loc = entity.getLocation();
return new Location(loc.getWorld().getName(), MathMan.roundInt(loc.getX()), MathMan.roundInt(loc.getY()), MathMan.roundInt(loc.getZ()),
loc.getYaw(), loc.getPitch());
org.bukkit.Location location = entity.getLocation();
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()),
location.getYaw(), location.getPitch());
}
@Override
@ -158,8 +158,8 @@ public class BukkitUtil extends WorldUtil {
}
@Override
public Location getSpawn(PlotPlayer pp) {
return getLocation(((BukkitPlayer) pp).player.getBedSpawnLocation());
public Location getSpawn(PlotPlayer player) {
return getLocation(((BukkitPlayer) player).player.getBedSpawnLocation());
}
@Override
@ -190,9 +190,9 @@ public class BukkitUtil extends WorldUtil {
}
@Override
public int getBiomeFromString(String biomeStr) {
public int getBiomeFromString(String biomeString) {
try {
Biome biome = Biome.valueOf(biomeStr.toUpperCase());
Biome biome = Biome.valueOf(biomeString.toUpperCase());
return Arrays.asList(Biome.values()).indexOf(biome);
} catch (IllegalArgumentException ignored) {
return -1;
@ -300,9 +300,9 @@ public class BukkitUtil extends WorldUtil {
}
@Override
public void setBiomes(String worldName, RegionWrapper region, String biomeStr) {
public void setBiomes(String worldName, RegionWrapper region, String biomeString) {
World world = getWorld(worldName);
Biome biome = Biome.valueOf(biomeStr.toUpperCase());
Biome biome = Biome.valueOf(biomeString.toUpperCase());
for (int x = region.minX; x <= region.maxX; x++) {
for (int z = region.minZ; z <= region.maxZ; z++) {
world.setBiome(x, z, biome);

View File

@ -86,23 +86,23 @@ public class SendChunk {
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer pp = entry.getValue();
Plot plot = pp.getCurrentPlot();
Location loc = null;
Location location = null;
String world;
if (plot != null) {
world = plot.getArea().worldname;
} else {
loc = pp.getLocation();
world = loc.getWorld();
location = pp.getLocation();
world = location.getWorld();
}
ArrayList<Chunk> list = map.get(world);
if (list == null) {
continue;
}
if (loc == null) {
loc = pp.getLocation();
if (location == null) {
location = pp.getLocation();
}
int cx = loc.getX() >> 4;
int cz = loc.getZ() >> 4;
int cx = location.getX() >> 4;
int cz = location.getZ() >> 4;
Player player = ((BukkitPlayer) pp).player;
Object entity = this.methodGetHandlePlayer.of(player).call();

View File

@ -280,7 +280,6 @@ public class FastQueue_1_8_3 extends SlowQueue {
if (fixAll && !(boolean) this.methodAreNeighborsLoaded.of(c).call(1)) {
World world = chunk.getWorld();
ChunkWrapper wrapper = bc.getChunkWrapper();
String worldName = wrapper.world;
for (int x = wrapper.x - 1; x <= wrapper.x + 1; x++) {
for (int z = wrapper.z - 1; z <= wrapper.z + 1; z++) {
if (x != 0 && z != 0) {
@ -288,7 +287,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
while (!other.isLoaded()) {
other.load(true);
}
ChunkManager.manager.loadChunk(worldName, new ChunkLoc(x, z), true);
ChunkManager.manager.loadChunk(wrapper.world, new ChunkLoc(x, z), true);
}
}
}