mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-13 10:54:43 +02:00
Tidy code.
This commit is contained in:
@ -255,8 +255,6 @@ public class Metrics {
|
||||
|
||||
/**
|
||||
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void enable() {
|
||||
// Enable Task, if it is not running
|
||||
@ -267,7 +265,6 @@ public class Metrics {
|
||||
|
||||
/**
|
||||
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||
*
|
||||
*/
|
||||
public void disable() {
|
||||
// Disable Task, if it is running
|
||||
@ -499,7 +496,7 @@ public class Metrics {
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
*
|
||||
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||
* @return an unmodifiable {@link Set} of the plotter objects
|
||||
*/
|
||||
public Set<Plotter> getPlotters() {
|
||||
return Collections.unmodifiableSet(this.plotters);
|
||||
|
@ -20,6 +20,7 @@ import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -160,7 +161,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Load the content of a file from a stream.
|
||||
*
|
||||
* Use {@link Files#newInputStreamSupplier(java.io.File)} to provide a stream from a file.
|
||||
* Use {@link Files#newInputStreamSupplier(File)} to provide a stream from a file.
|
||||
* @param stream - the stream supplier.
|
||||
* @param option - whether or not to decompress the input stream.
|
||||
* @return The decoded NBT compound.
|
||||
@ -195,7 +196,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Save the content of a NBT compound to a stream.
|
||||
*
|
||||
* Use {@link Files#newOutputStreamSupplier(java.io.File)} to provide a stream supplier to a file.
|
||||
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
|
||||
* @param source - the NBT compound to save.
|
||||
* @param stream - the stream.
|
||||
* @param option - whether or not to compress the output.
|
||||
@ -284,7 +285,7 @@ public class NbtFactory {
|
||||
Constructor<?> caller = INSTANCE.CRAFT_STACK.getDeclaredConstructor(ItemStack.class);
|
||||
caller.setAccessible(true);
|
||||
return (ItemStack) caller.newInstance(stack);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
throw new IllegalStateException("Unable to convert " + stack + " + to a CraftItemStack.");
|
||||
}
|
||||
}
|
||||
@ -396,9 +397,7 @@ public class NbtFactory {
|
||||
try {
|
||||
this.STREAM_TOOLS = loader.loadClass(nmsPackage + ".NBTCompressedStreamTools");
|
||||
this.READ_LIMITER_CLASS = loader.loadClass(nmsPackage + ".NBTReadLimiter");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Ignore - we will detect this later
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
private String getPackageName() {
|
||||
@ -435,12 +434,10 @@ public class NbtFactory {
|
||||
|
||||
if (value instanceof Wrapper) {
|
||||
return ((Wrapper) value).getHandle();
|
||||
|
||||
} else if (value instanceof List) {
|
||||
throw new IllegalArgumentException("Can only insert a WrappedList.");
|
||||
} else if (value instanceof Map) {
|
||||
throw new IllegalArgumentException("Can only insert a WrappedCompound.");
|
||||
|
||||
} else {
|
||||
return createNbtTag(getPrimitiveType(value), value);
|
||||
}
|
||||
@ -652,7 +649,7 @@ public class NbtFactory {
|
||||
* All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following:
|
||||
* <ul>
|
||||
* <li>Primitive types</li>
|
||||
* <li>{@link java.lang.String String}</li>
|
||||
* <li>{@link String String}</li>
|
||||
* <li>{@link NbtList}</li>
|
||||
* <li>{@link NbtCompound}</li>
|
||||
* </ul>
|
||||
@ -773,7 +770,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Save the content of a NBT compound to a stream.
|
||||
* <p>
|
||||
* Use {@link Files#newOutputStreamSupplier(java.io.File)} to provide a stream supplier to a file.
|
||||
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
|
||||
* @param stream - the output stream.
|
||||
* @param option - whether or not to compress the output.
|
||||
* @throws IOException If anything went wrong.
|
||||
|
@ -51,7 +51,6 @@ public class SendChunk {
|
||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
//TODO in 1.7.10 this is PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i, int version)
|
||||
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 4)) {
|
||||
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(),int.class);
|
||||
} else {
|
||||
@ -65,7 +64,7 @@ public class SendChunk {
|
||||
}
|
||||
|
||||
public void sendChunk(Collection<Chunk> input) {
|
||||
HashSet<Chunk> chunks = new HashSet<Chunk>(input);
|
||||
HashSet<Chunk> chunks = new HashSet<>(input);
|
||||
HashMap<String, ArrayList<Chunk>> map = new HashMap<>();
|
||||
int view = Bukkit.getServer().getViewDistance();
|
||||
for (Chunk chunk : chunks) {
|
||||
@ -126,9 +125,9 @@ public class SendChunk {
|
||||
public void run() {
|
||||
try {
|
||||
chunk.unload(true, false);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
String worldName = chunk.getWorld().getName();
|
||||
PS.debug("$4Could not save chunk: " + worldName + ";" + chunk.getX() + ";" + chunk.getZ());
|
||||
PS.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";" + chunk.getZ());
|
||||
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||
|
Reference in New Issue
Block a user