Skip to content

Commit

Permalink
Added 1.20.2 Support
Browse files Browse the repository at this point in the history
Added 1.20.2 Support
  • Loading branch information
ImYenil committed Oct 7, 2023
1 parent 75c6291 commit f0e5bd9
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bedwars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
</dependency>
<dependency>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>versionsupport_v1_20_R1</artifactId>
<artifactId>versionsupport_v1_20_R2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<module>versionsupport_v1_18_R2</module>
<module>versionsupport_v1_19_R2</module>
<module>versionsupport_v1_19_R3</module>
<module>versionsupport_v1_20_R1</module>
<module>versionsupport_v1_20_R2</module>
</modules>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<version>23.7-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_v1_20_R1</artifactId>
<artifactId>versionsupport_v1_20_R2</artifactId>

<properties>
<maven.compiler.source>1.19</maven.compiler.source>
Expand All @@ -35,7 +35,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<version>1.20.2-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

import com.andrei1058.bedwars.api.arena.team.ITeam;
import com.andrei1058.bedwars.api.server.VersionSupport;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

import com.andrei1058.bedwars.api.arena.team.ITeam;
import com.andrei1058.bedwars.api.server.VersionSupport;
Expand All @@ -12,7 +12,7 @@
import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget;
import net.minecraft.world.entity.player.EntityHuman;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

public enum DespawnableType {
IRON_GOLEM,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

import com.andrei1058.bedwars.api.arena.team.ITeam;
import com.andrei1058.bedwars.api.language.Language;
Expand All @@ -12,7 +12,7 @@
import net.minecraft.world.entity.animal.EntityIronGolem;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.IronGolem;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;
package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable;

import com.andrei1058.bedwars.api.arena.team.ITeam;
import com.andrei1058.bedwars.api.language.Language;
Expand All @@ -12,7 +12,7 @@
import net.minecraft.world.entity.monster.EntitySilverfish;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Silverfish;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.andrei1058.bedwars.support.version.v1_20_R1;
package com.andrei1058.bedwars.support.version.v1_20_R2;

import com.andrei1058.bedwars.api.arena.IArena;
import com.andrei1058.bedwars.api.arena.shop.ShopHolo;
Expand All @@ -10,9 +10,9 @@
import com.andrei1058.bedwars.api.language.Messages;
import com.andrei1058.bedwars.api.server.VersionSupport;
import com.andrei1058.bedwars.support.version.common.VersionCommon;
import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableAttributes;
import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableFactory;
import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableType;
import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableAttributes;
import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableFactory;
import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableType;
import com.mojang.datafixers.util.Pair;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
Expand Down Expand Up @@ -41,16 +41,16 @@
import org.bukkit.block.data.type.Ladder;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.command.Command;
import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
import org.bukkit.craftbukkit.v1_20_R1.entity.*;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
import org.bukkit.craftbukkit.v1_20_R2.entity.*;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.inventory.InventoryEvent;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -61,11 +61,11 @@
import java.util.logging.Level;

@SuppressWarnings("unused")
public class v1_20_R1 extends VersionSupport {
public class v1_20_R2 extends VersionSupport {

private final DespawnableFactory despawnableFactory;

public v1_20_R1(Plugin plugin, String name) {
public v1_20_R2(Plugin plugin, String name) {
super(plugin, name);
loadDefaultEffects();
this.despawnableFactory = new DespawnableFactory(this);
Expand Down Expand Up @@ -280,8 +280,9 @@ private static ArmorStand createArmorStand(String name, Location loc) {

@Override
public void voidKill(Player p) {
EntityPlayer player = getPlayer(p);
player.a(player.dJ().l(), 1000);
EntityDamageEvent event = new EntityDamageEvent(p, EntityDamageEvent.DamageCause.VOID, 1000.0);
p.setLastDamageCause(event);
p.setHealth(0);
}

@Override
Expand Down Expand Up @@ -548,7 +549,7 @@ public void sendPlayerSpawnPackets(Player respawned, IArena arena) {
if (arena.getRespawnSessions().containsKey(respawned)) return;

EntityPlayer entityPlayer = getPlayer(respawned);
PacketPlayOutNamedEntitySpawn show = new PacketPlayOutNamedEntitySpawn(entityPlayer);
PacketPlayOutSpawnEntity show = new PacketPlayOutSpawnEntity(entityPlayer);
PacketPlayOutEntityVelocity playerVelocity = new PacketPlayOutEntityVelocity(entityPlayer);
// we send head rotation packet because sometimes on respawn others see him with bad rotation
PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw()));
Expand Down Expand Up @@ -580,7 +581,7 @@ public void sendPlayerSpawnPackets(Player respawned, IArena arena) {
hideArmor(p, respawned);
} else {

PacketPlayOutNamedEntitySpawn show2 = new PacketPlayOutNamedEntitySpawn(boundTo);
PacketPlayOutSpawnEntity show2 = new PacketPlayOutSpawnEntity(boundTo);
PacketPlayOutEntityVelocity playerVelocity2 = new PacketPlayOutEntityVelocity(boundTo);
PacketPlayOutEntityHeadRotation head2 = new PacketPlayOutEntityHeadRotation(boundTo, getCompressedAngle(boundTo.getBukkitYaw()));
this.sendPackets(respawned, show2, playerVelocity2, head2);
Expand Down

0 comments on commit f0e5bd9

Please sign in to comment.