mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2025-02-05 06:12:48 +00:00
Removed google optionals in favor of java optionals for support of later ProtocolLib versions
This commit is contained in:
parent
3be68d39c8
commit
0ce215bb53
9 changed files with 49 additions and 42 deletions
10
pom.xml
10
pom.xml
|
@ -10,6 +10,16 @@
|
|||
<defaultGoal>clean install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>LibsDisguises</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.comphenix.protocol.wrappers.Vector3F;
|
|||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||
import com.google.common.base.Optional;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.*;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
|
@ -83,7 +82,7 @@ public class MetaIndex<Y> {
|
|||
new ItemStack(Material.STONE));
|
||||
|
||||
public static MetaIndex<Optional<BlockPosition>> ENDER_CRYSTAL_BEAM = new MetaIndex<>(EnderCrystalWatcher.class, 0,
|
||||
Optional.<BlockPosition>absent());
|
||||
Optional.empty());
|
||||
|
||||
public static MetaIndex<Boolean> ENDER_CRYSTAL_PLATE = new MetaIndex<>(EnderCrystalWatcher.class, 1, false);
|
||||
|
||||
|
@ -92,7 +91,7 @@ public class MetaIndex<Y> {
|
|||
public static MetaIndex<Boolean> ENDERMAN_AGRESSIVE = new MetaIndex<>(EndermanWatcher.class, 1, false);
|
||||
|
||||
public static MetaIndex<Optional<WrappedBlockData>> ENDERMAN_ITEM = new MetaIndex<>(EndermanWatcher.class, 0,
|
||||
Optional.<WrappedBlockData>absent());
|
||||
Optional.empty());
|
||||
|
||||
public static MetaIndex<Integer> ENTITY_AIR_TICKS = new MetaIndex<>(FlagWatcher.class, 1, 0);
|
||||
|
||||
|
@ -132,7 +131,7 @@ public class MetaIndex<Y> {
|
|||
public static MetaIndex<Byte> HORSE_META = new MetaIndex<>(AbstractHorseWatcher.class, 0, (byte) 0);
|
||||
|
||||
public static MetaIndex<Optional<UUID>> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1,
|
||||
Optional.<UUID>absent());
|
||||
Optional.empty());
|
||||
|
||||
public static MetaIndex<Byte> ILLAGER_META = new MetaIndex<>(IllagerWatcher.class, 0, (byte) 0);
|
||||
|
||||
|
@ -204,7 +203,7 @@ public class MetaIndex<Y> {
|
|||
public static MetaIndex<Byte> SHEEP_WOOL = new MetaIndex<>(SheepWatcher.class, 0, (byte) 0);
|
||||
|
||||
public static MetaIndex<Optional<BlockPosition>> SHULKER_ATTACHED = new MetaIndex<>(ShulkerWatcher.class, 1,
|
||||
Optional.<BlockPosition>absent());
|
||||
Optional.empty());
|
||||
|
||||
public static MetaIndex<Byte> SHULKER_COLOR = new MetaIndex<>(ShulkerWatcher.class, 3, (byte) 10);
|
||||
|
||||
|
@ -225,7 +224,7 @@ public class MetaIndex<Y> {
|
|||
public static MetaIndex<Byte> TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0);
|
||||
|
||||
public static MetaIndex<Optional<UUID>> TAMEABLE_OWNER = new MetaIndex<>(TameableWatcher.class, 1,
|
||||
Optional.<UUID>absent());
|
||||
Optional.empty());
|
||||
|
||||
public static MetaIndex<Integer> TIPPED_ARROW_COLOR = new MetaIndex<>(ArrowWatcher.class, 1, Color.WHITE.asRGB());
|
||||
|
||||
|
@ -349,10 +348,10 @@ public class MetaIndex<Y> {
|
|||
continue;
|
||||
|
||||
if (found != null) {
|
||||
System.err.println(entry.getKey()
|
||||
.getSimpleName() + " has multiple FlagType's registered for the index " + i + " (" + type
|
||||
.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher()
|
||||
.getSimpleName() + ")");
|
||||
System.err.println(
|
||||
entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index " +
|
||||
i + " (" + type.getFlagWatcher().getSimpleName() + ", " +
|
||||
found.getFlagWatcher().getSimpleName() + ")");
|
||||
continue loop;
|
||||
}
|
||||
|
||||
|
@ -377,8 +376,9 @@ public class MetaIndex<Y> {
|
|||
|
||||
MetaIndex index = (MetaIndex) field.get(null);
|
||||
|
||||
toPrint.add(index.getFlagWatcher().getSimpleName() + " " + field.getName() + " " + index
|
||||
.getIndex() + " " + index.getDefault().getClass().getSimpleName());
|
||||
toPrint.add(
|
||||
index.getFlagWatcher().getSimpleName() + " " + field.getName() + " " + index.getIndex() + " " +
|
||||
index.getDefault().getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
@ -460,15 +460,15 @@ public class MetaIndex<Y> {
|
|||
}
|
||||
|
||||
for (MetaIndex metaIndex : values()) {
|
||||
if (metaIndex == null || metaIndex.getFlagWatcher() != index.getFlagWatcher() || metaIndex
|
||||
.getIndex() != index.getIndex()) {
|
||||
if (metaIndex == null || metaIndex.getFlagWatcher() != index.getFlagWatcher() ||
|
||||
metaIndex.getIndex() != index.getIndex()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
System.err.println("[LibsDisguises] MetaIndex " + metaIndex.getFlagWatcher()
|
||||
.getSimpleName() + " at index " + metaIndex
|
||||
.getIndex() + " has already registered this! (" + metaIndex.getDefault() + "," + index
|
||||
.getDefault() + ")");
|
||||
System.err.println(
|
||||
"[LibsDisguises] MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " +
|
||||
metaIndex.getIndex() + " has already registered this! (" + metaIndex.getDefault() +
|
||||
"," + index.getDefault() + ")");
|
||||
}
|
||||
|
||||
values()[i] = metaIndexes[a];
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class AbstractHorseWatcher extends AgeableWatcher {
|
||||
public AbstractHorseWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Navid
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EndermanWatcher extends InsentientWatcher
|
||||
{
|
||||
|
@ -58,7 +57,7 @@ public class EndermanWatcher extends InsentientWatcher
|
|||
Optional<WrappedBlockData> optional;
|
||||
|
||||
if (type == null)
|
||||
optional = Optional.<WrappedBlockData> absent();
|
||||
optional = Optional.empty();
|
||||
else
|
||||
optional = Optional.<WrappedBlockData> of(WrappedBlockData.createData(type, data));
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Navid
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TameableWatcher extends AgeableWatcher
|
||||
{
|
||||
public TameableWatcher(Disguise disguise)
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
|
|||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtWrapper;
|
||||
import com.google.common.base.Optional;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.bukkit.*;
|
||||
|
@ -18,6 +17,7 @@ import org.bukkit.potion.PotionEffect;
|
|||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.UUID;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ReflectionManager {
|
||||
private static final String bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3];
|
||||
|
@ -810,7 +810,7 @@ public class ReflectionManager {
|
|||
val = getNmsItem((ItemStack) val);
|
||||
|
||||
if (val == null)
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
else
|
||||
return Optional.of(val);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 9/06/2017.
|
||||
* <p>
|
||||
|
|
Loading…
Reference in a new issue