Archiviert
13
0

Use correct Guava package, fix a few compatibility issues

Dieser Commit ist enthalten in:
Dan Mulloy 2015-06-19 13:14:20 -04:00
Ursprung b1b5408c53
Commit e0f7c72e18
7 geänderte Dateien mit 63 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -22,13 +22,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Set;
import net.minecraft.util.com.google.common.io.ByteStreams;
import net.minecraft.util.com.google.common.io.InputSupplier;
import com.comphenix.protocol.PacketType;
import com.google.common.collect.DiscreteDomains;
import com.google.common.collect.Range;
import com.google.common.collect.Ranges;
import com.google.common.io.ByteStreams;
import com.google.common.io.InputSupplier;
/**
* @author dmulloy2

Datei anzeigen

@ -261,6 +261,8 @@ public class ProtocolLibrary extends JavaPlugin {
throw e;
} catch (ThreadDeath e) {
throw e;
} catch (LinkageError e) {
logger.warning("Failed to register command " + command.name() + ": " + e);
} catch (Throwable e) {
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_REGISTER_COMMAND)
.messageParam(command.name(), e.getMessage()).error(e));

Datei anzeigen

@ -122,13 +122,21 @@ public class DetailedErrorReporter implements ErrorReporter {
throw new IllegalArgumentException("Plugin cannot be NULL.");
this.pluginReference = new WeakReference<Plugin>(plugin);
this.pluginName = plugin.getName();
this.pluginName = getNameSafely(plugin);
this.prefix = prefix;
this.supportURL = supportURL;
this.maxErrorCount = maxErrorCount;
this.logger = logger;
}
private String getNameSafely(Plugin plugin) {
try {
return plugin.getName();
} catch (LinkageError e) {
return "ProtocolLib";
}
}
// Attempt to get the logger.
private static Logger getBukkitLogger() {
try {

Datei anzeigen

@ -1166,4 +1166,9 @@ public class PacketContainer implements Serializable {
return WrappedChatComponent[].class;
}
}
@Override
public String toString() {
return "PacketContainer[type=" + type + ", structureModifier=" + structureModifier + "]";
}
}

Datei anzeigen

@ -261,6 +261,7 @@ public class PacketEvent extends EventObject implements Cancellable {
* Retrieves whether or not the packet should be cancelled.
* @return TRUE if it should be cancelled, FALSE otherwise.
*/
@Override
public boolean isCancelled() {
return cancel;
}
@ -307,6 +308,7 @@ public class PacketEvent extends EventObject implements Cancellable {
*
* @param cancel - TRUE if it should be cancelled, FALSE otherwise.
*/
@Override
public void setCancelled(boolean cancel) {
if (readOnly)
throw new IllegalStateException("The packet event is read-only.");
@ -445,4 +447,9 @@ public class PacketEvent extends EventObject implements Cancellable {
playerReference = new WeakReference<Player>(offlinePlayer);
}
}
@Override
public String toString() {
return "PacketEvent[player=" + getPlayer() + ", packet=" + packet + "]";
}
}

Datei anzeigen

@ -4,10 +4,12 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginLoadOrder;
import com.comphenix.protocol.ProtocolLibrary;
import com.google.common.collect.Sets;
/**
@ -73,9 +75,15 @@ class PluginVerifier {
public PluginVerifier(Plugin dependency) {
if (dependency == null)
throw new IllegalArgumentException("dependency cannot be NULL.");
// This would screw with the assumption in hasDependency(Plugin, Plugin)
if (safeConversion(dependency.getDescription().getLoadBefore()).size() > 0)
throw new IllegalArgumentException("dependency cannot have a load directives.");
try {
// This would screw with the assumption in hasDependency(Plugin, Plugin)
if (safeConversion(dependency.getDescription().getLoadBefore()).size() > 0)
throw new IllegalArgumentException("dependency cannot have a load directives.");
} catch (LinkageError e) {
// They're probably using an ancient version of Bukkit
ProtocolLibrary.log(Level.WARNING, "Failed to determine loadBefore: " + e);
}
this.dependency = dependency;
}

Datei anzeigen

@ -656,4 +656,9 @@ public class StructureModifier<TField> {
}
return result;
}
@Override
public String toString() {
return "StructureModifier[fieldType=" + fieldType + ", data=" + data + "]";
}
}