SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Fix event things' (#256) from fix_event into master

Reviewed-on: #256
Dieser Commit ist enthalten in:
Lixfel 2021-04-09 14:47:10 +02:00
Commit 762fc3e230
9 geänderte Dateien mit 95 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -24,9 +24,12 @@ import net.minecraft.server.v1_10_R1.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World;
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;
class FightWorld_10 {
public class FightWorld_10 {
private FightWorld_10(){}
static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_10 {
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.World;
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;
class FightWorld_12 {
public class FightWorld_12 {
private FightWorld_12(){}
static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_12 {
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.World;
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;
class FightWorld_14 {
public class FightWorld_14 {
private FightWorld_14(){}
static void resetChunk(World world, World backup, int x, int z){
@ -45,4 +48,12 @@ class FightWorld_14 {
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.World;
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;
class FightWorld_15 {
public class FightWorld_15 {
private FightWorld_15(){}
static void resetChunk(World world, World backup, int x, int z){
@ -45,4 +48,12 @@ class FightWorld_15 {
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

@ -21,8 +21,6 @@ package de.steamwar.fightsystem.record;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import org.bukkit.entity.Entity;
class RecordSystem_15 {
private RecordSystem_15(){}
@ -30,8 +28,4 @@ class RecordSystem_15 {
static int blockToId(Block block){
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.World;
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;
class FightWorld_8 {
public class FightWorld_8 {
private FightWorld_8(){}
static void resetChunk(World world, World backup, int x, int z){
@ -43,4 +46,12 @@ class FightWorld_8 {
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.World;
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;
class FightWorld_9 {
public class FightWorld_9 {
private FightWorld_9(){}
static void resetChunk(World world, World backup, int x, int z){
@ -44,4 +47,12 @@ class FightWorld_9 {
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;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.entity.Player;
@ -19,7 +21,7 @@ public class ResourcePack implements Listener {
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.setResourcePack("https://steamwar.de/antixray.zip");
sendResourcePack(player, "https://steamwar.de/antixray.zip", "3e94f5abeb07cc95067b27705615ec14666abe7b");
}
@EventHandler
@ -29,7 +31,17 @@ public class ResourcePack implements Listener {
Player player = e.getPlayer();
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);
}
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;
import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
@ -107,9 +107,14 @@ public class RecordSystem {
Recorder.rDouble(location.getZ());
Recorder.rFloat(location.getPitch());
Recorder.rFloat(location.getYaw());
VersionedRunnable.call(new VersionedRunnable(() -> {
Recorder.rByte(RecordSystem_15.headRotation(e));
}, 15));
Recorder.rByte((int)(VersionedCallable.call(
new VersionedCallable<>(() -> FightWorld_8.headRotation(e), 8),
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();
}