mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-27 18:41:23 +01:00
Check for floodgate players
This commit is contained in:
parent
550c72a234
commit
7577a049d9
@ -16,6 +16,10 @@
|
|||||||
<id>viaversion-repo</id>
|
<id>viaversion-repo</id>
|
||||||
<url>https://repo.viaversion.com</url>
|
<url>https://repo.viaversion.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>opencollab-snapshot</id>
|
||||||
|
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -37,6 +41,12 @@
|
|||||||
<version>4.5.1</version>
|
<version>4.5.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.geysermc.floodgate</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean package install</defaultGoal>
|
<defaultGoal>clean package install</defaultGoal>
|
||||||
|
@ -51,6 +51,7 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
@ -859,13 +860,18 @@ public class NMSImpl implements NMSBridge {
|
|||||||
registerTraitWithCommand(manager, TropicalFishTrait.class);
|
registerTraitWithCommand(manager, TropicalFishTrait.class);
|
||||||
registerTraitWithCommand(manager, VillagerTrait.class);
|
registerTraitWithCommand(manager, VillagerTrait.class);
|
||||||
|
|
||||||
if (VIA_ENABLED == null) {
|
try {
|
||||||
try {
|
Via.getAPI();
|
||||||
Via.getAPI();
|
VIA_ENABLED = true;
|
||||||
VIA_ENABLED = true;
|
} catch (Throwable t) {
|
||||||
} catch (Throwable t) {
|
VIA_ENABLED = false;
|
||||||
VIA_ENABLED = false;
|
}
|
||||||
}
|
|
||||||
|
try {
|
||||||
|
FloodgateApi.getInstance();
|
||||||
|
FLOODGATE_ENABLED = true;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
FLOODGATE_ENABLED = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,11 +1263,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NMSImpl.sendPacket(recipient, packet);
|
NMSImpl.sendPacket(recipient, packet);
|
||||||
if (VIA_ENABLED == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int version = Via.getAPI().getPlayerVersion(recipient);
|
if (FLOODGATE_ENABLED == true) {
|
||||||
return version < 761;
|
return FloodgateApi.getInstance().isFloodgatePlayer(recipient.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VIA_ENABLED == true) {
|
||||||
|
int version = Via.getAPI().getPlayerVersion(recipient);
|
||||||
|
return version < 761;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2365,6 +2376,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT,
|
EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT,
|
||||||
EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST,
|
EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST,
|
||||||
EntityType.SHULKER, EntityType.PHANTOM);
|
EntityType.SHULKER, EntityType.PHANTOM);
|
||||||
|
|
||||||
private static final MethodHandle BEHAVIOR_TREE_MAP = NMS.getGetter(Brain.class, "f");
|
private static final MethodHandle BEHAVIOR_TREE_MAP = NMS.getGetter(Brain.class, "f");
|
||||||
private static final MethodHandle BUKKITENTITY_FIELD_SETTER = NMS.getSetter(Entity.class, "bukkitEntity");
|
private static final MethodHandle BUKKITENTITY_FIELD_SETTER = NMS.getSetter(Entity.class, "bukkitEntity");
|
||||||
private static final MethodHandle CHUNKMAP_UPDATE_PLAYER_STATUS = NMS.getMethodHandle(ChunkMap.class, "a", true,
|
private static final MethodHandle CHUNKMAP_UPDATE_PLAYER_STATUS = NMS.getMethodHandle(ChunkMap.class, "a", true,
|
||||||
@ -2386,6 +2398,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
true, PortalInfo.class, ServerLevel.class);
|
true, PortalInfo.class, ServerLevel.class);
|
||||||
// first int of block of 4
|
// first int of block of 4
|
||||||
private static final MethodHandle FISHING_HOOK_LIFE = NMS.getSetter(FishingHook.class, "aq");
|
private static final MethodHandle FISHING_HOOK_LIFE = NMS.getSetter(FishingHook.class, "aq");
|
||||||
|
private static Boolean FLOODGATE_ENABLED = null;
|
||||||
private static final MethodHandle FLYING_MOVECONTROL_FLOAT_GETTER = NMS.getFirstGetter(FlyingMoveControl.class,
|
private static final MethodHandle FLYING_MOVECONTROL_FLOAT_GETTER = NMS.getFirstGetter(FlyingMoveControl.class,
|
||||||
boolean.class);
|
boolean.class);
|
||||||
private static final MethodHandle FLYING_MOVECONTROL_FLOAT_SETTER = NMS.getFirstSetter(FlyingMoveControl.class,
|
private static final MethodHandle FLYING_MOVECONTROL_FLOAT_SETTER = NMS.getFirstSetter(FlyingMoveControl.class,
|
||||||
|
Loading…
Reference in New Issue
Block a user