SteamWar/FightSystem
Archiviert
13
1

Fix event things

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-04-09 14:45:09 +02:00
Ursprung a62d9ab48a
Commit a2b02ea234
9 geänderte Dateien mit 95 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_10_R1.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_10 { public class FightWorld_10 {
private FightWorld_10(){} private FightWorld_10(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_10 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_12_R1.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_12 { public class FightWorld_12 {
private FightWorld_12(){} private FightWorld_12(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_12 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_14_R1.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_14 { public class FightWorld_14 {
private FightWorld_14(){} private FightWorld_14(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -45,4 +48,12 @@ class FightWorld_14 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_15_R1.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_15 { public class FightWorld_15 {
private FightWorld_15(){} private FightWorld_15(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -45,4 +48,12 @@ class FightWorld_15 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -30,8 +30,4 @@ class RecordSystem_15 {
static int blockToId(Block block){ static int blockToId(Block block){
return net.minecraft.server.v1_15_R1.Block.REGISTRY_ID.getId(((CraftBlock)block).getNMS()); return net.minecraft.server.v1_15_R1.Block.REGISTRY_ID.getId(((CraftBlock)block).getNMS());
} }
static int headRotation(Entity e){
return (int)(((CraftEntity)e).getHandle().getHeadRotation() * 256 / 360);
}
} }

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_8_R3.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_8 { public class FightWorld_8 {
private FightWorld_8(){} private FightWorld_8(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -43,4 +46,12 @@ class FightWorld_8 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_9_R2.Chunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
class FightWorld_9 { public class FightWorld_9 {
private FightWorld_9(){} private FightWorld_9(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_9 {
ChunkListener.sendChunk(p, x, z); ChunkListener.sendChunk(p, x, z);
} }
} }
public static void sendResourcePack(Player player, String pack, String sha1){
((CraftPlayer)player).getHandle().setResourcePack(pack, sha1);
}
public static float headRotation(Entity e){
return ((CraftEntity)e).getHandle().getHeadRotation();
}
} }

Datei anzeigen

@ -1,7 +1,9 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -19,7 +21,7 @@ public class ResourcePack implements Listener {
@EventHandler @EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) { public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
player.setResourcePack("https://steamwar.de/antixray.zip"); sendResourcePack(player, "https://steamwar.de/antixray.zip", "3e94f5abeb07cc95067b27705615ec14666abe7b");
} }
@EventHandler @EventHandler
@ -29,7 +31,17 @@ public class ResourcePack implements Listener {
Player player = e.getPlayer(); Player player = e.getPlayer();
player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden"); player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden");
player.sendMessage(FightSystem.PREFIX + "§cDa du abgelehnt hast, musst du nun in der Serverliste erstmal wieder Ressourcenpakete von SteamWar aktivieren."); player.sendMessage(FightSystem.PREFIX + "§cDa du abgelehnt hast, musst du nun in der Serverliste erst einmal wieder Ressourcenpakete von SteamWar aktivieren.");
player.kickPlayer(null); player.kickPlayer(null);
} }
private void sendResourcePack(Player player, String pack, String sha1){
VersionedRunnable.call(
new VersionedRunnable(() -> FightWorld_8.sendResourcePack(player, pack, sha1), 8),
new VersionedRunnable(() -> FightWorld_9.sendResourcePack(player, pack, sha1), 9),
new VersionedRunnable(() -> FightWorld_10.sendResourcePack(player, pack, sha1), 10),
new VersionedRunnable(() -> FightWorld_12.sendResourcePack(player, pack, sha1), 12),
new VersionedRunnable(() -> FightWorld_14.sendResourcePack(player, pack, sha1), 14),
new VersionedRunnable(() -> FightWorld_15.sendResourcePack(player, pack, sha1), 15));
}
} }

Datei anzeigen

@ -20,10 +20,10 @@
package de.steamwar.fightsystem.record; package de.steamwar.fightsystem.record;
import de.steamwar.core.VersionedCallable; import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -107,9 +107,14 @@ public class RecordSystem {
Recorder.rDouble(location.getZ()); Recorder.rDouble(location.getZ());
Recorder.rFloat(location.getPitch()); Recorder.rFloat(location.getPitch());
Recorder.rFloat(location.getYaw()); Recorder.rFloat(location.getYaw());
VersionedRunnable.call(new VersionedRunnable(() -> { Recorder.rByte((int)(VersionedCallable.call(
Recorder.rByte(RecordSystem_15.headRotation(e)); new VersionedCallable<>(() -> FightWorld_8.headRotation(e), 8),
}, 15)); new VersionedCallable<>(() -> FightWorld_9.headRotation(e), 9),
new VersionedCallable<>(() -> FightWorld_10.headRotation(e), 10),
new VersionedCallable<>(() -> FightWorld_12.headRotation(e), 12),
new VersionedCallable<>(() -> FightWorld_14.headRotation(e), 14),
new VersionedCallable<>(() -> FightWorld_15.headRotation(e), 15)
) * 256 / 360));
Recorder.flush(); Recorder.flush();
} }