Merge branch 'master' into Anti_Ice_Melt
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Commit
bfb394c609
@ -152,7 +152,6 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
ProtocolAPI.tinyProtocol.close();
|
||||
GlobalRecorder.getInstance().close();
|
||||
}
|
||||
|
||||
|
@ -20,13 +20,13 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.fightsystem.utils.ProtocolAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
@ -146,7 +146,7 @@ public class Fight {
|
||||
|
||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||
public static void pseudoSpectator(Player player, boolean enable) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, playerInfoPacket(updateGamemode, new GameProfile(player.getUniqueId(), player.getName()), enable ? creative : spectator));
|
||||
TinyProtocol.instance.sendPacket(player, playerInfoPacket(updateGamemode, new GameProfile(player.getUniqueId(), player.getName()), enable ? creative : spectator));
|
||||
}
|
||||
|
||||
public static Object playerInfoPacket(Object action, GameProfile profile, Object mode) {
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
@ -41,8 +42,9 @@ public class PistonListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handlePistonExtend(BlockPistonExtendEvent e){
|
||||
BlockFace face = e.getDirection();
|
||||
for(Block block : e.getBlocks()){
|
||||
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)){
|
||||
if(!Config.BlueExtendRegion.inRegion(block.getRelative(face)) && !Config.RedExtendRegion.inRegion(block.getRelative(face))){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@ -72,22 +73,22 @@ public class REntity {
|
||||
public static void playerJoins(Player player) {
|
||||
for(REntity entity : entities.values()){
|
||||
if(entity.entityType == EntityType.PLAYER){
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getPlayerInfoPacket());
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getNamedSpawnPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getPlayerInfoPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getNamedSpawnPacket());
|
||||
for (Map.Entry<String, ItemStack> entry : entity.itemSlots.entrySet()) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getEquipmentPacket(entry.getKey(), entry.getValue()));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getEquipmentPacket(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}else{
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getSpawnEntityPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getSpawnEntityPacket());
|
||||
}
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getTeleportPacket());
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getHeadRotationPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getTeleportPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getHeadRotationPacket());
|
||||
|
||||
if(entity.fireTick != 0) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getDataWatcherPacket(entityStatusWatcher, (byte) 1));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getDataWatcherPacket(entityStatusWatcher, (byte) 1));
|
||||
}
|
||||
if(entity.sneaks) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getDataWatcherPacket(sneakingDataWatcher, BlockIdWrapper.impl.getPose(true)));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getDataWatcherPacket(sneakingDataWatcher, BlockIdWrapper.impl.getPose(true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import io.netty.channel.Channel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -42,23 +40,20 @@ public class ProtocolAPI {
|
||||
private static final Map<Class<?>, BiFunction<Player, Object, Object>> outgoingHandler = new HashMap<>();
|
||||
private static final Map<Class<?>, BiFunction<Player, Object, Object>> incomingHandler = new HashMap<>();
|
||||
|
||||
public static final TinyProtocol tinyProtocol = new TinyProtocol(FightSystem.getPlugin()) {
|
||||
@Override
|
||||
public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) {
|
||||
static {
|
||||
TinyProtocol.instance.setOutFilter((receiver, channel, packet) -> {
|
||||
BiFunction<Player, Object, Object> handler = outgoingHandler.get(packet.getClass());
|
||||
if(handler == null)
|
||||
return packet;
|
||||
return handler.apply(receiver, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object onPacketInAsync(Player sender, Channel channel, Object packet) {
|
||||
});
|
||||
TinyProtocol.instance.setInFilter((sender, channel, packet) -> {
|
||||
BiFunction<Player, Object, Object> handler = incomingHandler.get(packet.getClass());
|
||||
if(handler == null)
|
||||
return packet;
|
||||
return handler.apply(sender, packet);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
public static void setOutgoingHandler(Class<?> packetClass, BiFunction<Player, Object, Object> handler) {
|
||||
outgoingHandler.put(packetClass, handler);
|
||||
@ -77,7 +72,7 @@ public class ProtocolAPI {
|
||||
}
|
||||
|
||||
public static void broadcastPacket(Object packet) {
|
||||
Bukkit.getOnlinePlayers().stream().map(tinyProtocol::getChannel).filter(tinyProtocol::hasInjected).forEach(channel -> tinyProtocol.sendPacket(channel, packet));
|
||||
Bukkit.getOnlinePlayers().stream().map(TinyProtocol.instance::getChannel).filter(TinyProtocol.instance::hasInjected).forEach(channel -> TinyProtocol.instance.sendPacket(channel, packet));
|
||||
}
|
||||
|
||||
public static BiFunction<Object, UnaryOperator<Object>, Object> arrayCloneGenerator(Class<?> elementClass) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren