Skip to content

Commit

Permalink
Merge pull request #2575 from tal5/1.20.3
Browse files Browse the repository at this point in the history
Initial 1.20.3 update
  • Loading branch information
mcmonkey4eva committed Dec 6, 2023
2 parents 472aab5 + 0c806f9 commit 5806d3e
Show file tree
Hide file tree
Showing 43 changed files with 155 additions and 160 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -3,7 +3,7 @@ The Denizen Scripting Language - Spigot Impl

An implementation of the Denizen Scripting Language for Spigot servers, with strong Citizens interlinks to emphasize the power of using Denizen with NPCs!

**Version 1.2.9**: Compatible with Spigot 1.17.1, 1.18.2, 1.19.4, and 1.20.2!
**Version 1.3.0**: Compatible with Spigot 1.17.1, 1.18.2, 1.19.4, and 1.20.3!

**Learn about Denizen from the Beginner's guide:** https://guide.denizenscript.com/guides/background/index.html

Expand Down Expand Up @@ -45,7 +45,7 @@ An implementation of the Denizen Scripting Language for Spigot servers, with str
<dependency>
<groupId>com.denizenscript</groupId>
<artifactId>denizen</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
<exclusions>
Expand Down
2 changes: 1 addition & 1 deletion dist/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.denizenscript</groupId>
<artifactId>denizen-parent</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion paper/pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen-paper</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<repositories>
<repository>
Expand Down
4 changes: 2 additions & 2 deletions plugin/pom.xml
Expand Up @@ -5,7 +5,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<name>Denizen</name>
<description>Scriptable Minecraft and Citizens2</description>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.3-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -6,13 +6,13 @@
<groupId>com.denizenscript</groupId>
<artifactId>denizen-parent</artifactId>
<packaging>pom</packaging>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
<BUILD_CLASS>CUSTOM</BUILD_CLASS>
<DENIZEN_VERSION>1.2.9</DENIZEN_VERSION>
<DENIZEN_VERSION>1.3.0</DENIZEN_VERSION>
</properties>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion v1_17/pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen-v1_17</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion v1_18/pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen-v1_18</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion v1_19/pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen-v1_19</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
14 changes: 7 additions & 7 deletions v1_20/pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.denizenscript</groupId>
<artifactId>denizen-v1_20</artifactId>
<version>1.2.9-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand All @@ -19,13 +19,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.3-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
Expand All @@ -45,9 +45,9 @@
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.20.3-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.20.3-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -60,8 +60,8 @@
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.20.3-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.20.3-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand Down
Expand Up @@ -64,19 +64,19 @@
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.boss.BossBar;
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_20_R2.boss.CraftBossBar;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventory;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventoryCustom;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R2.persistence.CraftPersistentDataContainer;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftChatMessage;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftLocation;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_20_R3.boss.CraftBossBar;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventory;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryCustom;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R3.persistence.CraftPersistentDataContainer;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftChatMessage;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftLocation;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
Expand Down Expand Up @@ -146,7 +146,7 @@ public void undisableAsyncCatcher() {

@Override
public boolean isCorrectMappingsCode() {
return ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("3478a65bfd04b15b431fe107b3617dfc");
return ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("60a2bb6bf2684dc61c56b90d7c41bddc");
}

@Override
Expand Down
Expand Up @@ -9,7 +9,7 @@ public class ReflectionMappingsInfo {
public static String AdvancementList_tasks = "(MISSING)"; // TODO: 1.20.2

// net.minecraft.world.level.block.state.BlockBehaviour
public static String BlockBehaviour_explosionResistance = "aF";
public static String BlockBehaviour_explosionResistance = "aH";

// net.minecraft.core.MappedRegistry
public static String MappedRegistry_frozen = "l";
Expand All @@ -30,11 +30,11 @@ public class ReflectionMappingsInfo {
public static String LivingEntity_setLivingEntityFlag_method = "c";

// net.minecraft.world.entity.player.Player
public static String Player_DATA_PLAYER_ABSORPTION_ID = "e";
public static String Player_DATA_PLAYER_ABSORPTION_ID = "d";
public static String Player_DATA_PLAYER_MODE_CUSTOMISATION = "bM";

// net.minecraft.server.level.ServerPlayer
public static String ServerPlayer_respawnForced = "cU";
public static String ServerPlayer_respawnForced = "cW";

// net.minecraft.world.entity.monster.EnderMan
public static String EnderMan_DATA_CREEPY = "bV";
Expand Down Expand Up @@ -78,7 +78,6 @@ public class ReflectionMappingsInfo {
public static String ServerGamePacketListenerImpl_awaitingTeleport = "C";
public static String ServerGamePacketListenerImpl_chunkSender = "f";


// net.minecraft.server.network.ServerCommonPacketListenerImpl
public static String ServerCommonPacketListenerImpl_connection = "c";

Expand Down Expand Up @@ -143,5 +142,4 @@ public class ReflectionMappingsInfo {

// net.minecraft.server.level.ServerLevel
public static String ServerLevel_sleepStatus = "O";

}
Expand Up @@ -7,16 +7,15 @@
import net.minecraft.advancements.*;
import net.minecraft.advancements.critereon.ImpossibleTrigger;
import net.minecraft.network.protocol.game.ClientboundUpdateAdvancementsPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.PlayerAdvancements;
import net.minecraft.server.ServerAdvancementManager;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftNamespacedKey;
import org.bukkit.entity.Player;

import java.util.*;
Expand All @@ -25,7 +24,7 @@ public class AdvancementHelperImpl extends AdvancementHelper {

private static final String IMPOSSIBLE_KEY = "impossible";
private static final Map<String, Criterion<?>> IMPOSSIBLE_CRITERIA = Collections.singletonMap(IMPOSSIBLE_KEY, new Criterion(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
private static final String[][] IMPOSSIBLE_REQUIREMENTS = new String[][]{{IMPOSSIBLE_KEY}};
private static final List<List<String>> IMPOSSIBLE_REQUIREMENTS = List.of(List.of(IMPOSSIBLE_KEY));

public static ServerAdvancementManager getAdvancementDataWorld() {
return ((CraftServer) Bukkit.getServer()).getServer().getAdvancements();
Expand Down Expand Up @@ -115,7 +114,7 @@ public void grantPartial(com.denizenscript.denizen.nms.util.Advancement advancem
Collections.singletonMap(nmsAdvancement.id(), progress)));
}
else {
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(asResourceLocation(advancement.key));
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(CraftNamespacedKey.toMinecraft(advancement.key));
for (int i = 0; i < len; i++) {
((CraftPlayer) player).getHandle().getAdvancements().award(nmsAdvancement, IMPOSSIBLE_KEY + i);
}
Expand All @@ -139,7 +138,7 @@ public void grant(com.denizenscript.denizen.nms.util.Advancement advancement, Pl
Collections.singletonMap(nmsAdvancement.id(), progress)));
}
else {
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(asResourceLocation(advancement.key));
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(CraftNamespacedKey.toMinecraft(advancement.key));
((CraftPlayer) player).getHandle().getAdvancements().award(nmsAdvancement, IMPOSSIBLE_KEY);
}
}
Expand All @@ -149,11 +148,11 @@ public void revoke(com.denizenscript.denizen.nms.util.Advancement advancement, P
if (advancement.temporary) {
PacketHelperImpl.send(player, new ClientboundUpdateAdvancementsPacket(false,
Collections.emptySet(),
Collections.singleton(asResourceLocation(advancement.key)),
Collections.singleton(CraftNamespacedKey.toMinecraft(advancement.key)),
Collections.emptyMap()));
}
else {
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(asResourceLocation(advancement.key));
AdvancementHolder nmsAdvancement = getAdvancementDataWorld().advancements.get(CraftNamespacedKey.toMinecraft(advancement.key));
((CraftPlayer) player).getHandle().getAdvancements().revoke(nmsAdvancement, IMPOSSIBLE_KEY);
}
}
Expand All @@ -172,31 +171,26 @@ public void update(Player player) {
}

private static AdvancementHolder asNMSCopy(com.denizenscript.denizen.nms.util.Advancement advancement) {
ResourceLocation key = asResourceLocation(advancement.key);
AdvancementHolder parent = advancement.parent != null
? getAdvancementDataWorld().advancements.get(asResourceLocation(advancement.parent))
? getAdvancementDataWorld().advancements.get(CraftNamespacedKey.toMinecraft(advancement.parent))
: null;
DisplayInfo display = new DisplayInfo(CraftItemStack.asNMSCopy(advancement.icon),
Handler.componentToNMS(FormattedTextHelper.parse(advancement.title, ChatColor.WHITE)), Handler.componentToNMS(FormattedTextHelper.parse(advancement.description, ChatColor.WHITE)),
asResourceLocation(advancement.background), FrameType.valueOf(advancement.frame.name()),
Optional.ofNullable(advancement.background).map(CraftNamespacedKey::toMinecraft), AdvancementType.valueOf(advancement.frame.name()),
advancement.toast, advancement.announceToChat, advancement.hidden);
display.setLocation(advancement.xOffset, advancement.yOffset);
Map<String, Criterion<?>> criteria = IMPOSSIBLE_CRITERIA;
String[][] requirements = IMPOSSIBLE_REQUIREMENTS;
List<List<String>> requirements = IMPOSSIBLE_REQUIREMENTS;
if (advancement.length > 1) {
criteria = new HashMap<>();
requirements = new String[advancement.length][];
requirements = new ArrayList<>(advancement.length);
for (int i = 0; i < advancement.length; i++) {
criteria.put(IMPOSSIBLE_KEY + i, new Criterion(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
requirements[i] = new String[] { IMPOSSIBLE_KEY + i };
requirements.set(i, List.of(IMPOSSIBLE_KEY + i));
}
}
AdvancementRequirements reqs = new AdvancementRequirements(requirements);
Advancement adv = new Advancement(parent == null ? Optional.empty() : Optional.of(parent.id()), Optional.of(display), AdvancementRewards.EMPTY, criteria, reqs, false); // TODO: 1.20: do we want to ever enable telemetry?
return new AdvancementHolder(key, adv);
}

private static ResourceLocation asResourceLocation(NamespacedKey key) {
return key != null ? new ResourceLocation(key.getNamespace(), key.getKey()) : null;
return new AdvancementHolder(CraftNamespacedKey.toMinecraft(advancement.key), adv);
}
}
Expand Up @@ -2,9 +2,9 @@

import com.denizenscript.denizen.nms.abstracts.AnimationHelper;
import net.minecraft.world.entity.Entity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPolarBear;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPolarBear;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.IronGolem;
Expand Down
Expand Up @@ -40,15 +40,15 @@
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Skull;
import org.bukkit.craftbukkit.v1_20_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.*;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R2.tag.CraftBlockTag;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftLocation;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.v1_20_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.*;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R3.tag.CraftBlockTag;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftLocation;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;

import java.lang.invoke.MethodHandle;
Expand Down
Expand Up @@ -17,8 +17,8 @@
import net.minecraft.world.level.levelgen.Heightmap;
import org.bukkit.World;
import org.bukkit.Chunk;
import org.bukkit.craftbukkit.v1_20_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.Field;
Expand Down
Expand Up @@ -19,8 +19,8 @@
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Scoreboard;
Expand Down

0 comments on commit 5806d3e

Please sign in to comment.