mirror of
https://github.com/xoo0524tw/OpenArcadeGames.git
synced 2026-12-06 02:46:01 +02:00
Consolidate engine and games into common module and unify platform APIs
This commit is contained in:
1 parent
76ac0e3acd
commit
fbed884ad9
1353 files changed
+44571
-59600
No files matched your search
@@ -2,5 +2,5 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion><parent><groupId>ro.fr33styler.arcade</groupId><artifactId>arcadegames-parent</artifactId><version>2.19f-reconstructed</version><relativePath>../../../../pom.xml</relativePath></parent>
|
||||
<artifactId>platforms-latest-v1_20_R4</artifactId><properties><maven.compiler.release>17</maven.compiler.release></properties>
|
||||
<dependencies><dependency><groupId>ro.fr33styler.arcade</groupId><artifactId>common</artifactId><version>${project.version}</version></dependency><dependency><groupId>ro.fr33styler.arcade</groupId><artifactId>platform-api-latest</artifactId><version>${project.version}</version></dependency><dependency><groupId>local.compile-only</groupId><artifactId>latest-v1_20_R4</artifactId><version>2.19f</version><scope>system</scope><systemPath>${maven.multiModuleProjectDirectory}/build-support/deps/stubs-latest-v1_20_R4.jar</systemPath></dependency></dependencies>
|
||||
<dependencies><dependency><groupId>ro.fr33styler.arcade</groupId><artifactId>common</artifactId><version>${project.version}</version></dependency><dependency><groupId>local.compile-only</groupId><artifactId>latest-v1_20_R4</artifactId><version>2.19f</version><scope>system</scope><systemPath>${maven.multiModuleProjectDirectory}/build-support/deps/stubs-latest-v1_20_R4.jar</systemPath></dependency></dependencies>
|
||||
</project>
|
||||
+15
-15
@@ -52,7 +52,7 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||
import ro.fr33styler.arcade.platform.api.scoreboard.TeamVisibility;
|
||||
import ro.fr33styler.arcade.api.engine.command.Command;
|
||||
|
||||
public class V1_20_6Platform implements ServerPlatform {
|
||||
@@ -63,32 +63,32 @@ public class V1_20_6Platform implements ServerPlatform {
|
||||
this.a = new V1_20_6NpcFactory(var1);
|
||||
}
|
||||
|
||||
public V1_20_6NpcFactory a() {
|
||||
public V1_20_6NpcFactory getNpcFactory() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public V1_20_6PacketInterceptor b() {
|
||||
public V1_20_6PacketInterceptor getPacketInterceptor() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
public void sendHealthUpdate(Player var1) {
|
||||
var1.sendHealthUpdate();
|
||||
}
|
||||
|
||||
public void a(Player var1, Item var2) {
|
||||
public void sendCollectItemAnimation(Player var1, Item var2) {
|
||||
((CraftPlayer)var1).getHandle().c.b(new PacketPlayOutCollect(var2.getEntityId(), var1.getEntityId(), var2.getItemStack().getAmount()));
|
||||
}
|
||||
|
||||
public void a(Command var1) {
|
||||
public void registerCommand(Command var1) {
|
||||
this.a(var1, var1.getCommand());
|
||||
var1.getAliases().forEach(var2 -> this.a(var1, var2));
|
||||
}
|
||||
|
||||
public void b(Command var1) {
|
||||
public void unregisterCommand(Command var1) {
|
||||
RootCommandNode var2 = this.e().a().getRoot();
|
||||
var2.removeCommand(var1.getCommand());
|
||||
var1.getAliases().forEach(var2::removeCommand);
|
||||
BukkitCommands.b(var1);
|
||||
BukkitCommands.unregisterCommand(var1);
|
||||
}
|
||||
|
||||
private CommandDispatcher e() {
|
||||
@@ -126,25 +126,25 @@ public class V1_20_6Platform implements ServerPlatform {
|
||||
return 1;
|
||||
});
|
||||
LiteralCommandNode var4 = var3.build();
|
||||
if (!ServerVersion.d) {
|
||||
BukkitCommands.a(new VanillaCommandWrapper(this.e(), var4));
|
||||
if (!ServerVersion.IS_PAPER) {
|
||||
BukkitCommands.registerBukkitCommand(new VanillaCommandWrapper(this.e(), var4));
|
||||
}
|
||||
|
||||
this.e().a().getRoot().addChild(var4);
|
||||
}
|
||||
|
||||
public void a(Block var1, Material var2) {
|
||||
public void setBlock(Block var1, Material var2) {
|
||||
CraftBlock var3 = (CraftBlock)var1;
|
||||
IBlockData var4 = CraftMagicNumbers.getBlock(var2).o();
|
||||
((CraftChunk)var1.getChunk()).getHandle(ChunkStatus.n).a(var3.getPosition(), var4, false);
|
||||
var3.getCraftWorld().getHandle().a(var3.getPosition(), var3.getNMS(), var4, 0);
|
||||
}
|
||||
|
||||
public HologramEntity a(World var1, double var2, double var4, double var6) {
|
||||
public HologramEntity createHologram(World var1, double var2, double var4, double var6) {
|
||||
return new V1_20_6HologramEntity(((CraftWorld)var1).getHandle(), var2, var4, var6);
|
||||
}
|
||||
|
||||
public boolean a(Block var1, double var2, double var4, double var6) {
|
||||
public boolean isInsideBlockHitbox(Block var1, double var2, double var4, double var6) {
|
||||
CraftBlock var8 = (CraftBlock)var1;
|
||||
VoxelShape var9 = var8.getNMS().j(var8.getCraftWorld().getHandle(), var8.getPosition());
|
||||
if (var9.c()) {
|
||||
@@ -163,7 +163,7 @@ public class V1_20_6Platform implements ServerPlatform {
|
||||
return var16.booleanValue();
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2, Score var3, int var4) {
|
||||
public void sendScorePacket(Player var1, boolean var2, Score var3, int var4) {
|
||||
if (var2) {
|
||||
((CraftPlayer)var1).getHandle().c.b(new ClientboundResetScorePacket(var3.getEntry(), var3.getObjective().getName()));
|
||||
} else {
|
||||
@@ -174,7 +174,7 @@ public class V1_20_6Platform implements ServerPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Player var1, Team var2, String var3, String var4, OptionStatus var5) {
|
||||
public void sendTeamPacket(Player var1, Team var2, String var3, String var4, TeamVisibility var5) {
|
||||
if (var1.getScoreboard() == var2.getScoreboard()) {
|
||||
EntityPlayer var6 = ((CraftPlayer)var1).getHandle();
|
||||
ScoreboardTeam var7 = var6.gr().b(var2.getName());
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@ import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class V1_20_6PlatformFactory implements VersionFactory<ServerPlatform> {
|
||||
public String a() {
|
||||
public String getVersionLabel() {
|
||||
return "1.20.6";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
public boolean supports(String var1) {
|
||||
return var1.equals("1.20.5") || var1.equals("1.20.6");
|
||||
}
|
||||
|
||||
public ServerPlatform a(Server var1) {
|
||||
public ServerPlatform create(Server var1) {
|
||||
return new V1_20_6Platform(var1);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ import org.bukkit.util.Vector;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class BombLobbersV1_20_6TntFactory implements BombLobbersTntFactory {
|
||||
public TNTPrimed a(Player var1, Color var2, Vector var3) {
|
||||
public TNTPrimed spawnTnt(Player var1, Color var2, Vector var3) {
|
||||
EntityPlayer var4 = ((CraftPlayer)var1).getHandle();
|
||||
Vector3f var5 = new Vector3f(var2.getRed() / 255.0F, var2.getGreen() / 255.0F, var2.getBlue() / 255.0F);
|
||||
BombLobbersV1_20_6TntEntity var6 = new BombLobbersV1_20_6TntEntity(var4, new ParticleParamRedstone(var5, 1.0F), var3);
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@ import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class BombLobbersV1_20_6TntFactorySelector implements VersionFactory<BombLobbersTntFactory> {
|
||||
public String a() {
|
||||
public String getVersionLabel() {
|
||||
return "1.20.6";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
public boolean supports(String var1) {
|
||||
return var1.equals("1.20.5") || var1.equals("1.20.6");
|
||||
}
|
||||
|
||||
public BombLobbersTntFactory a(Server var1) {
|
||||
public BombLobbersTntFactory create(Server var1) {
|
||||
return new BombLobbersV1_20_6TntFactory();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,15 +16,15 @@ import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MiniWallsV1_20_6EntityFactory implements MiniWallsEntityFactory {
|
||||
public Wither a(Location var1, Predicate<LivingEntity> var2, Runnable var3) {
|
||||
public Wither spawnWither(Location var1, Predicate<LivingEntity> var2, Runnable var3) {
|
||||
return (Wither)new MiniWallsV1_20_6Wither(var1, var2, var3).getBukkitEntity();
|
||||
}
|
||||
|
||||
public Arrow a(Player var1, Color var2, Vector var3, Predicate<Entity> var4) {
|
||||
public Arrow spawnArrow(Player var1, Color var2, Vector var3, Predicate<Entity> var4) {
|
||||
return (Arrow)new MiniWallsV1_20_6Arrow(((CraftPlayer)var1).getHandle(), var2, var3, var4).getBukkitEntity();
|
||||
}
|
||||
|
||||
public WitherSkull a(Wither var1, Vector var2, Predicate<Entity> var3) {
|
||||
public WitherSkull spawnWitherSkull(Wither var1, Vector var2, Predicate<Entity> var3) {
|
||||
return (WitherSkull)new MiniWallsV1_20_6WitherSkull(((CraftWither)var1).getHandle(), var2, var3).getBukkitEntity();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -6,15 +6,15 @@ import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class MiniWallsV1_20_6EntityFactorySelector implements VersionFactory<MiniWallsEntityFactory> {
|
||||
public String a() {
|
||||
public String getVersionLabel() {
|
||||
return "1.20.6";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
public boolean supports(String var1) {
|
||||
return var1.equals("1.20.5") || var1.equals("1.20.6");
|
||||
}
|
||||
|
||||
public MiniWallsEntityFactory a(Server var1) {
|
||||
public MiniWallsEntityFactory create(Server var1) {
|
||||
return new MiniWallsV1_20_6EntityFactory();
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -35,34 +35,34 @@ public class PropHuntV1_20_6PropEntity extends EntityArmorStand implements PropH
|
||||
this.a(EnumItemSlot.f, CraftItemStack.asNMSCopy(var2));
|
||||
}
|
||||
|
||||
this.a(var3);
|
||||
this.teleport(var3);
|
||||
}
|
||||
|
||||
public UUID a() {
|
||||
public UUID getUniqueId() {
|
||||
return this.az;
|
||||
}
|
||||
|
||||
public PropHuntPropType b() {
|
||||
public PropHuntPropType getPropType() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public ItemStack c() {
|
||||
public ItemStack getItem() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public Player d() {
|
||||
public Player getOwner() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
public void setOwner(Player var1) {
|
||||
this.a = (CraftPlayer)var1;
|
||||
}
|
||||
|
||||
public Location e() {
|
||||
public Location getLocation() {
|
||||
return new Location(this.dP().getWorld(), this.du(), this.dw() + 1.35, this.dA(), this.dF(), this.dH());
|
||||
}
|
||||
|
||||
public void a(Location var1) {
|
||||
public void teleport(Location var1) {
|
||||
double var2 = var1.getX();
|
||||
double var4 = var1.getY() - 1.35;
|
||||
double var6 = var1.getZ();
|
||||
@@ -76,13 +76,13 @@ public class PropHuntV1_20_6PropEntity extends EntityArmorStand implements PropH
|
||||
this.e(var2, var4, var6);
|
||||
}
|
||||
|
||||
public void f() {
|
||||
public void attachOwner() {
|
||||
if (this.a != null) {
|
||||
this.getBukkitEntity().addPassenger(this.a);
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void destroy() {
|
||||
this.ao();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PropHuntV1_20_6PropEntity extends EntityArmorStand implements PropH
|
||||
|
||||
public void l() {
|
||||
if (this.a != null && !this.a.isInsideVehicle()) {
|
||||
this.a(this.a.getLocation());
|
||||
this.teleport(this.a.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -10,11 +10,11 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PropHuntV1_20_6PropFactory implements PropHuntPropFactory {
|
||||
public Particle a() {
|
||||
public Particle getDisguiseParticle() {
|
||||
return Particle.HAPPY_VILLAGER;
|
||||
}
|
||||
|
||||
public PropHuntProp a(PropHuntPropType var1, ItemStack var2, Location var3) {
|
||||
public PropHuntProp createProp(PropHuntPropType var1, ItemStack var2, Location var3) {
|
||||
PropHuntV1_20_6PropEntity var4 = new PropHuntV1_20_6PropEntity(var1, var2, var3);
|
||||
var4.dP().addFreshEntity(var4, SpawnReason.CUSTOM);
|
||||
return var4;
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@ import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class PropHuntV1_20_6PropFactorySelector implements VersionFactory<PropHuntPropFactory> {
|
||||
public String a() {
|
||||
public String getVersionLabel() {
|
||||
return "1.20.6";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
public boolean supports(String var1) {
|
||||
return var1.equals("1.20.5") || var1.equals("1.20.6");
|
||||
}
|
||||
|
||||
public PropHuntPropFactory a(Server var1) {
|
||||
public PropHuntPropFactory create(Server var1) {
|
||||
return new PropHuntV1_20_6PropFactory();
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -22,22 +22,22 @@ public class V1_20_6HologramEntity extends EntityArmorStand implements HologramE
|
||||
super.k(true);
|
||||
}
|
||||
|
||||
public void a(String var1) {
|
||||
public void setText(String var1) {
|
||||
super.b(CraftChatMessage.fromStringOrNull(var1));
|
||||
if (super.ag()) {
|
||||
super.o(true);
|
||||
}
|
||||
}
|
||||
|
||||
public LivingEntity a() {
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity)this.getBukkitEntity();
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
public void updateMetadata(Player var1) {
|
||||
this.a(this.b(var1));
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2) {
|
||||
public void setVisible(Player var1, boolean var2) {
|
||||
PlayerConnection var3 = this.b(var1);
|
||||
if (var2) {
|
||||
var3.b(new PacketPlayOutSpawnEntity(this));
|
||||
|
||||
+4
-4
@@ -13,10 +13,10 @@ import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class V1_20_6PacketInterceptor implements PacketInterceptor {
|
||||
private static final Field a = Reflection.a(ServerCommonPacketListenerImpl.class, NetworkManager.class);
|
||||
private static final Field a = Reflection.findFieldByType(ServerCommonPacketListenerImpl.class, NetworkManager.class);
|
||||
|
||||
private Channel a(Player var1) throws IllegalAccessException {
|
||||
NetworkManager var2 = (NetworkManager)Reflection.a(a, ((CraftPlayer)var1).getHandle().c);
|
||||
NetworkManager var2 = (NetworkManager)Reflection.getFieldValue(a, ((CraftPlayer)var1).getHandle().c);
|
||||
return var2.n;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class V1_20_6PacketInterceptor implements PacketInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String var1, Player var2) {
|
||||
public void inject(String var1, Player var2) {
|
||||
try {
|
||||
ChannelPipeline var3 = this.a(var2).pipeline();
|
||||
this.a(var3, var1);
|
||||
@@ -37,7 +37,7 @@ public class V1_20_6PacketInterceptor implements PacketInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
public void b(String var1, Player var2) {
|
||||
public void eject(String var1, Player var2) {
|
||||
try {
|
||||
Channel var3 = this.a(var2);
|
||||
var3.eventLoop().execute(() -> this.a(var3.pipeline(), var1));
|
||||
|
||||
+4
-4
@@ -36,11 +36,11 @@ public class V1_20_6Npc extends EntityPlayer implements Npc {
|
||||
this.a = var4;
|
||||
}
|
||||
|
||||
public int a() {
|
||||
public int getEntityId() {
|
||||
return this.al();
|
||||
}
|
||||
|
||||
public Location b() {
|
||||
public Location getLocation() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class V1_20_6Npc extends EntityPlayer implements Npc {
|
||||
this.b = var1;
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2) {
|
||||
public void setVisible(Player var1, boolean var2) {
|
||||
this.c = this.b(var1);
|
||||
if (var2) {
|
||||
this.c.b(new ClientboundPlayerInfoUpdatePacket(net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket.a.a, this));
|
||||
@@ -69,7 +69,7 @@ public class V1_20_6Npc extends EntityPlayer implements Npc {
|
||||
return ((CraftPlayer)var1).getHandle().c;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
public void removeFromTabList(Player var1) {
|
||||
this.b(var1).b(new ClientboundPlayerInfoRemovePacket(List.of(this.az)));
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -26,7 +26,7 @@ public class V1_20_6NpcFactory implements NpcFactory {
|
||||
this.a = var1;
|
||||
}
|
||||
|
||||
public V1_20_6Npc a(Location var1, Player var2) {
|
||||
public V1_20_6Npc createPlayerNpc(Location var1, Player var2) {
|
||||
EntityPlayer var3 = ((CraftPlayer)var2).getHandle();
|
||||
GameProfile var4 = new GameProfile(UUID.randomUUID(), var2.getName());
|
||||
var4.getProperties().putAll(var3.gb().getProperties());
|
||||
@@ -36,19 +36,19 @@ public class V1_20_6NpcFactory implements NpcFactory {
|
||||
public V1_20_6Npc a(Location var1, String var2, SkinTexture var3) {
|
||||
CraftWorld var4 = (CraftWorld)var1.getWorld();
|
||||
GameProfile var5 = new GameProfile(UUID.randomUUID(), var2);
|
||||
var5.getProperties().put("textures", new Property("textures", var3.a(), var3.b()));
|
||||
var5.getProperties().put("textures", new Property("textures", var3.getValue(), var3.getSignature()));
|
||||
return new V1_20_6Npc(((CraftServer)this.a).getServer(), var4.getHandle(), var5, var1);
|
||||
}
|
||||
|
||||
public V1_20_6Npc a(Location var1, String var2, SkinTexture var3, NpcEquipment var4) {
|
||||
public V1_20_6Npc createNpc(Location var1, String var2, SkinTexture var3, NpcEquipment var4) {
|
||||
V1_20_6Npc var5 = this.a(var1, var2, var3);
|
||||
ArrayList var6 = new ArrayList();
|
||||
var6.add(new Pair(EnumItemSlot.a, CraftItemStack.asNMSCopy(var4.a())));
|
||||
var6.add(new Pair(EnumItemSlot.b, CraftItemStack.asNMSCopy(var4.b())));
|
||||
var6.add(new Pair(EnumItemSlot.f, CraftItemStack.asNMSCopy(var4.c())));
|
||||
var6.add(new Pair(EnumItemSlot.e, CraftItemStack.asNMSCopy(var4.d())));
|
||||
var6.add(new Pair(EnumItemSlot.d, CraftItemStack.asNMSCopy(var4.e())));
|
||||
var6.add(new Pair(EnumItemSlot.c, CraftItemStack.asNMSCopy(var4.f())));
|
||||
var6.add(new Pair(EnumItemSlot.a, CraftItemStack.asNMSCopy(var4.getMainHandItem())));
|
||||
var6.add(new Pair(EnumItemSlot.b, CraftItemStack.asNMSCopy(var4.getOffHandItem())));
|
||||
var6.add(new Pair(EnumItemSlot.f, CraftItemStack.asNMSCopy(var4.getHelmetItem())));
|
||||
var6.add(new Pair(EnumItemSlot.e, CraftItemStack.asNMSCopy(var4.getChestplateItem())));
|
||||
var6.add(new Pair(EnumItemSlot.d, CraftItemStack.asNMSCopy(var4.getLeggingsItem())));
|
||||
var6.add(new Pair(EnumItemSlot.c, CraftItemStack.asNMSCopy(var4.getBootsItem())));
|
||||
var5.a(var6);
|
||||
return var5;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user