3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00
Dieser Commit ist enthalten in:
Myles 2016-09-27 17:48:56 +01:00
Ursprung d5108061c1
Commit 866e494d3c
8 geänderte Dateien mit 18 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,7 @@
package us.myles.ViaVersion.api; package us.myles.ViaVersion.api;
import com.google.common.base.Preconditions;
import lombok.Getter; import lombok.Getter;
import org.apache.commons.lang.Validate;
import us.myles.ViaVersion.ViaManager; import us.myles.ViaVersion.ViaManager;
import us.myles.ViaVersion.api.platform.ViaPlatform; import us.myles.ViaVersion.api.platform.ViaPlatform;
@ -17,7 +17,7 @@ public class Via {
* @param viaManager The ViaManager * @param viaManager The ViaManager
*/ */
public static void init(ViaManager viaManager) { public static void init(ViaManager viaManager) {
Validate.isTrue(manager == null, "ViaManager is already set"); Preconditions.checkArgument(manager == null, "ViaManager is already set");
Via.platform = viaManager.getPlatform(); Via.platform = viaManager.getPlatform();
Via.manager = viaManager; Via.manager = viaManager;
@ -29,7 +29,7 @@ public class Via {
* @return API instance * @return API instance
*/ */
public static ViaAPI getAPI() { public static ViaAPI getAPI() {
Validate.isTrue(platform != null, "ViaVersion has not loaded the Platform"); Preconditions.checkArgument(platform != null, "ViaVersion has not loaded the Platform");
return Via.platform.getApi(); return Via.platform.getApi();
} }
@ -39,7 +39,7 @@ public class Via {
* @return Config instance * @return Config instance
*/ */
public static ViaVersionConfig getConfig() { public static ViaVersionConfig getConfig() {
Validate.isTrue(platform != null, "ViaVersion has not loaded the Platform"); Preconditions.checkArgument(platform != null, "ViaVersion has not loaded the Platform");
return Via.platform.getConf(); return Via.platform.getConf();
} }
} }

Datei anzeigen

@ -1,6 +1,5 @@
package us.myles.ViaVersion.api.boss; package us.myles.ViaVersion.api.boss;
import org.apache.commons.lang.NotImplementedException;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import java.util.Set; import java.util.Set;
@ -76,7 +75,7 @@ public abstract class BossBar<T> {
*/ */
@Deprecated @Deprecated
public BossBar addPlayer(T player) { public BossBar addPlayer(T player) {
throw new NotImplementedException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName()); throw new UnsupportedOperationException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName());
} }
/** /**
@ -96,7 +95,7 @@ public abstract class BossBar<T> {
*/ */
@Deprecated @Deprecated
public BossBar addPlayers(T... players) { public BossBar addPlayers(T... players) {
throw new NotImplementedException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName()); throw new UnsupportedOperationException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName());
} }
/** /**
@ -108,7 +107,7 @@ public abstract class BossBar<T> {
*/ */
@Deprecated @Deprecated
public BossBar removePlayer(T player) { public BossBar removePlayer(T player) {
throw new NotImplementedException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName()); throw new UnsupportedOperationException("This method is not implemented for the platform " + Via.getPlatform().getPlatformName());
} }
/** /**

Datei anzeigen

@ -1,11 +1,11 @@
package us.myles.ViaVersion.boss; package us.myles.ViaVersion.boss;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.Validate;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.boss.BossBar; import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor; import us.myles.ViaVersion.api.boss.BossColor;
@ -29,8 +29,8 @@ public abstract class CommonBoss<T> extends BossBar<T> {
private Set<BossFlag> flags; private Set<BossFlag> flags;
public CommonBoss(String title, float health, BossColor color, BossStyle style) { public CommonBoss(String title, float health, BossColor color, BossStyle style) {
Validate.notNull(title, "Title cannot be null"); Preconditions.checkNotNull(title, "Title cannot be null");
Validate.isTrue((health >= 0 && health <= 1), "Health must be between 0 and 1"); Preconditions.checkArgument((health >= 0 && health <= 1), "Health must be between 0 and 1");
this.uuid = UUID.randomUUID(); this.uuid = UUID.randomUUID();
this.title = title; this.title = title;
@ -51,7 +51,7 @@ public abstract class CommonBoss<T> extends BossBar<T> {
@Override @Override
public BossBar setHealth(float health) { public BossBar setHealth(float health) {
Validate.isTrue((health >= 0 && health <= 1), "Health must be between 0 and 1"); Preconditions.checkArgument((health >= 0 && health <= 1), "Health must be between 0 and 1");
this.health = health; this.health = health;
sendPacket(CommonBoss.UpdateAction.UPDATE_HEALTH); sendPacket(CommonBoss.UpdateAction.UPDATE_HEALTH);
return this; return this;

Datei anzeigen

@ -1,8 +1,8 @@
package us.myles.ViaVersion.commands; package us.myles.ViaVersion.commands;
import com.google.common.base.Preconditions;
import lombok.NonNull; import lombok.NonNull;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.Validate;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.command.ViaCommandSender;
import us.myles.ViaVersion.api.command.ViaSubCommand; import us.myles.ViaVersion.api.command.ViaSubCommand;
@ -25,7 +25,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
@Override @Override
public void registerSubCommand(@NonNull ViaSubCommand command) throws Exception { public void registerSubCommand(@NonNull ViaSubCommand command) throws Exception {
Validate.isTrue(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid subcommand name"); Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid subcommand name");
if (hasSubCommand(command.name())) if (hasSubCommand(command.name()))
throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later. throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later.
commandMap.put(command.name().toLowerCase(), command); commandMap.put(command.name().toLowerCase(), command);

Datei anzeigen

@ -1,5 +1,7 @@
package us.myles.ViaVersion.protocols.base; package us.myles.ViaVersion.protocols.base;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -8,7 +10,6 @@ import io.netty.channel.ChannelFuture;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener; import io.netty.util.concurrent.GenericFutureListener;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.StringUtils;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.Pair;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
@ -110,7 +111,7 @@ public class BaseProtocol extends Protocol {
new Object[]{ new Object[]{
wrapper.get(Type.STRING, 1), wrapper.get(Type.STRING, 1),
info.getProtocolVersion(), info.getProtocolVersion(),
StringUtils.join(info.getPipeline().pipes(), ", ") Joiner.on(", ").join(info.getPipeline().pipes(), ", ")
}); });
} }
} }

Datei anzeigen

@ -1,6 +1,6 @@
package us.myles.ViaVersion.update; package us.myles.ViaVersion.update;
import org.apache.commons.lang.StringUtils; import com.google.common.base.Joiner;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -72,7 +72,7 @@ public class Version implements Comparable<Version> {
for (int i = 0; i < parts.length; i += 1) for (int i = 0; i < parts.length; i += 1)
split[i] = String.valueOf(parts[i]); split[i] = String.valueOf(parts[i]);
return StringUtils.join(split, ".") + (tag.length() != 0 ? "-" + tag : ""); return Joiner.on(".").join(split) + (tag.length() != 0 ? "-" + tag : "");
} }
@Override @Override

Datei anzeigen

@ -57,10 +57,6 @@
<pattern>org.javassist</pattern> <pattern>org.javassist</pattern>
<shadedPattern>us.myles.viaversion.libs.javassist</shadedPattern> <shadedPattern>us.myles.viaversion.libs.javassist</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>org.apache</pattern>
<shadedPattern>us.myles.viaversion.libs.apache</shadedPattern>
</relocation>
</relocations> </relocations>
</configuration> </configuration>
<executions> <executions>

Datei anzeigen

@ -100,14 +100,6 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Apache Commons Lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<!-- ChatColour API --> <!-- ChatColour API -->
<dependency> <dependency>
<groupId>net.md-5</groupId> <groupId>net.md-5</groupId>