Skip to content

Commit a07f8fc

Browse files
committed
6.1.2, add support for 1.20.2
1 parent 55edffd commit a07f8fc

15 files changed

Lines changed: 51 additions & 114 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.settings/
22
/bin/
33
.classpath
4-
.project
4+
.project
5+
/.gradle/
0 Bytes
Binary file not shown.

build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ plugins {
77
id "com.github.johnrengelman.shadow" version "7.0.0"
88
}
99

10+
java {
11+
toolchain {
12+
languageVersion.set(JavaLanguageVersion.of(8))
13+
}
14+
}
15+
1016
//Fixes issues related to special characters being used
1117
compileJava.options.encoding = "UTF-8"
1218
compileTestJava.options.encoding = "UTF-8"
1319

1420
group = "me.rosillogames"
15-
version = "6.1.1"
21+
version = "6.1.2"
1622
description = "EggWars Remastered"
1723

1824
repositories {
@@ -44,7 +50,7 @@ dependencies {
4450
implementation 'org.jetbrains:annotations:23.0.0'
4551

4652
//Spigot API
47-
compileOnly "org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT"
53+
compileOnly "org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT"
4854

4955
//BStats API
5056
implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'

src/main/java/me/rosillogames/eggwars/arena/shop/Offer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public boolean trade(Player player, boolean shift)
5555
boolean hasBought = false;
5656

5757
while (this.canAfford(player))
58-
{//contents must be cloned one by one as well because they are "live" items from inventory
58+
{//stacks must be cloned one by one as well because they are "live" items from inventory
5959
ItemStack[] prev = ItemUtils.copyContents(player.getInventory().getContents());
6060
ItemStack stack = adjustForRecipe(player, this.result, this.colorize);
6161
EquipmentSlot slot = ItemUtils.getTradeSlot(player, stack);

src/main/java/me/rosillogames/eggwars/enums/Versions.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ public enum Versions
1212
V_1_19_R1(true, "v1_19_R1"), //1.19 - 1.19.2
1313
V_1_19_R2(true, "v1_19_R2"), //1.19.3
1414
V_1_19_R3(true, "v1_19_R3"), //1.19.4
15-
V_1_20_R1(true, "v1_20_R1"); //1.20.1
15+
V_1_20_R1(true, "v1_20_R1"), //1.20.1
16+
V_1_20_R2(true, "v1_20_R2"); //1.20.2
1617

17-
public static final String SUPPORTED_TEXT = "1.16.1 - 1.20.1";
18+
public static final String SUPPORTED_TEXT = "1.16.1 - 1.20.2";
1819
private final String[] packageIds;
1920
private final boolean allowed;
2021

src/main/java/me/rosillogames/eggwars/utils/reflection/ReflectionUtils.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ public class ReflectionUtils
2020
{
2121
private static Reflections currentReflections;
2222

23+
public static <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback)
24+
{
25+
try
26+
{
27+
Object obj = world.getClass().getMethod("createEntity", Location.class, Class.class).invoke(world, location, clazz);
28+
return (T)obj.getClass().getMethod("getBukkitEntity").invoke(obj);
29+
}
30+
catch (Exception exception)
31+
{
32+
exception.printStackTrace();
33+
}
34+
35+
return fallback;
36+
}
37+
2338
public static void setArmorStandInvisible(ArmorStand stand)
2439
{
2540
currentReflections.setArmorStandInvisible(stand);
@@ -35,11 +50,6 @@ public static void setItemAge(Item item, int age)
3550
currentReflections.setItemAge(item, age);
3651
}
3752

38-
public static <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback)
39-
{
40-
return currentReflections.createEntity(world, location, clazz, fallback);
41-
}
42-
4353
public static ItemStack parseItemStack(JsonObject json)
4454
{
4555
return currentReflections.parseItemStack(json);
@@ -127,9 +137,11 @@ public static void setReflections(Versions v)
127137
case V_1_19_R3:
128138
currentReflections = new Reflections_1_19((byte)2);
129139
return;
130-
case OTHER:
131140
case V_1_20_R1:
132-
currentReflections = new Reflections_1_20();
141+
currentReflections = new Reflections_1_20(false);
142+
case OTHER:
143+
case V_1_20_R2:
144+
currentReflections = new Reflections_1_20(true);
133145
}
134146
}
135147
}

src/main/java/me/rosillogames/eggwars/utils/reflection/Reflections.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import java.util.List;
44
import javax.annotation.Nullable;
55
import org.bukkit.Bukkit;
6-
import org.bukkit.Location;
76
import org.bukkit.World;
87
import org.bukkit.block.Block;
98
import org.bukkit.block.data.BlockData;
109
import org.bukkit.entity.ArmorStand;
11-
import org.bukkit.entity.Entity;
1210
import org.bukkit.entity.Item;
1311
import org.bukkit.entity.Player;
1412
import org.bukkit.entity.TNTPrimed;
@@ -24,8 +22,6 @@ public interface Reflections
2422

2523
public void setItemAge(Item item, int age);
2624

27-
public <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback);
28-
2925
public ItemStack parseItemStack(JsonObject json);
3026

3127
@Nullable

src/main/java/me/rosillogames/eggwars/utils/reflection/Reflections_1_16.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
import java.util.logging.Level;
1111
import javax.annotation.Nullable;
1212
import org.bukkit.Bukkit;
13-
import org.bukkit.Location;
1413
import org.bukkit.Material;
1514
import org.bukkit.World;
1615
import org.bukkit.block.Block;
1716
import org.bukkit.block.data.BlockData;
1817
import org.bukkit.enchantments.Enchantment;
1918
import org.bukkit.entity.ArmorStand;
20-
import org.bukkit.entity.Entity;
2119
import org.bukkit.entity.Item;
2220
import org.bukkit.entity.Player;
2321
import org.bukkit.entity.TNTPrimed;
@@ -108,22 +106,6 @@ public void setItemAge(Item item, int age)
108106
}
109107
}
110108

111-
@Override
112-
public <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback)
113-
{
114-
try
115-
{
116-
Object obj = world.getClass().getMethod("createEntity", Location.class, Class.class).invoke(world, location, clazz);
117-
fallback = (T)obj.getClass().getMethod("getBukkitEntity").invoke(obj);
118-
}
119-
catch (Exception exception)
120-
{
121-
exception.printStackTrace();
122-
}
123-
124-
return fallback;
125-
}
126-
127109
@Override
128110
public ItemStack parseItemStack(JsonObject json)
129111
{

src/main/java/me/rosillogames/eggwars/utils/reflection/Reflections_1_17.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
import java.util.UUID;
99
import java.util.logging.Level;
1010
import javax.annotation.Nullable;
11-
import org.bukkit.Location;
1211
import org.bukkit.Material;
1312
import org.bukkit.World;
1413
import org.bukkit.block.Block;
1514
import org.bukkit.block.data.BlockData;
1615
import org.bukkit.enchantments.Enchantment;
1716
import org.bukkit.entity.ArmorStand;
18-
import org.bukkit.entity.Entity;
1917
import org.bukkit.entity.Item;
2018
import org.bukkit.entity.Player;
2119
import org.bukkit.entity.TNTPrimed;
@@ -61,22 +59,6 @@ public void setItemAge(Item item, int age)
6159
}
6260
}
6361

64-
@Override
65-
public <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback)
66-
{
67-
try
68-
{
69-
Object obj = world.getClass().getMethod("createEntity", Location.class, Class.class).invoke(world, location, clazz);
70-
fallback = (T)obj.getClass().getMethod("getBukkitEntity").invoke(obj);
71-
}
72-
catch (Exception exception)
73-
{
74-
exception.printStackTrace();
75-
}
76-
77-
return fallback;
78-
}
79-
8062
@Override
8163
public ItemStack parseItemStack(JsonObject json)
8264
{

src/main/java/me/rosillogames/eggwars/utils/reflection/Reflections_1_18.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
import java.util.UUID;
99
import java.util.logging.Level;
1010
import javax.annotation.Nullable;
11-
import org.bukkit.Location;
1211
import org.bukkit.Material;
1312
import org.bukkit.World;
1413
import org.bukkit.block.Block;
1514
import org.bukkit.block.data.BlockData;
1615
import org.bukkit.enchantments.Enchantment;
1716
import org.bukkit.entity.ArmorStand;
18-
import org.bukkit.entity.Entity;
1917
import org.bukkit.entity.Item;
2018
import org.bukkit.entity.Player;
2119
import org.bukkit.entity.TNTPrimed;
@@ -72,22 +70,6 @@ public void setItemAge(Item item, int age)
7270
}
7371
}
7472

75-
@Override
76-
public <T extends Entity> T createEntity(World world, Location location, Class<? extends Entity> clazz, T fallback)
77-
{
78-
try
79-
{
80-
Object obj = world.getClass().getMethod("createEntity", Location.class, Class.class).invoke(world, location, clazz);
81-
fallback = (T)obj.getClass().getMethod("getBukkitEntity").invoke(obj);
82-
}
83-
catch (Exception exception)
84-
{
85-
exception.printStackTrace();
86-
}
87-
88-
return fallback;
89-
}
90-
9173
@Override
9274
public ItemStack parseItemStack(JsonObject json)
9375
{

0 commit comments

Comments
 (0)