Skip to content

Commit

Permalink
patch for latest spigot nms revision
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 28, 2018
1 parent 52ea4cb commit 7aeb6ae
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Expand Up @@ -68,6 +68,10 @@ public static JavaPlugin getJavaPlugin() {
return javaPlugin;
}

public String getNmsMappingsCode() {
return null;
}

public abstract Sidebar createSidebar(Player player);

public abstract BlockLight createBlockLight(Location location, int lightLevel, long ticks);
Expand Down
14 changes: 13 additions & 1 deletion plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -87,6 +87,7 @@
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_13_R2.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -337,13 +338,24 @@ public NotableManager notableManager() {
public void onEnable() {
if (!NMSHandler.initialize(this)) {
getLogger().warning("-------------------------------------");
getLogger().warning("Denizen is not compatible with this Spigot version! Deactivating Denizen!");
getLogger().warning("This build of Denizen is not compatible with this Spigot version! Deactivating Denizen!");
getLogger().warning("-------------------------------------");
getServer().getPluginManager().disablePlugin(this);
startedSuccessful = false;
return;
}

String mappingsCode = NMSHandler.getInstance().getNmsMappingsCode();
if (mappingsCode != null) {
if (!CraftMagicNumbers.MAPPINGS_VERSION.equals(mappingsCode)) {
getLogger().warning("-------------------------------------");
getLogger().warning("This build of Denizen was built for a different Spigot revision! This may potentially cause issues."
+ " If you are experiencing trouble, update Denizen and Spigot both to latest builds!"
+ " If this message appears with both Denizen and Spigot fully up-to-date, contact the Denizen team (via GitHub, Spigot, or Discord) to request an update be built.");
getLogger().warning("-------------------------------------");
}
}

if (NMSHandler.getVersion().isAtMost(NMSVersion.v1_11_R1)) { // TODO: 1.12 update
logInterceptor = new LogInterceptor();
}
Expand Down
Expand Up @@ -56,6 +56,11 @@ public class Handler_v1_13_R2 extends NMSHandler {

private final ProfileEditor profileEditor = new ProfileEditor_v1_13_R2();

@Override
public String getNmsMappingsCode() {
return "00ed8e5c39debc3ed194ad7c5645cc45";
}

@Override
public Thread getMainThread() {
return ((CraftServer) Bukkit.getServer()).getServer().primaryThread;
Expand Down
Expand Up @@ -221,8 +221,8 @@ public void resetExperience(Player player) {

@Override
public boolean showSignEditor(Player player, Location location) {
TileEntity tileEntity = ((CraftWorld) location.getWorld()).getTileEntityAt(location.getBlockX(),
location.getBlockY(), location.getBlockZ());
TileEntity tileEntity = ((CraftWorld) location.getWorld()).getHandle().getTileEntity(new BlockPosition(location.getBlockX(),
location.getBlockY(), location.getBlockZ()));
if (tileEntity instanceof TileEntitySign) {
TileEntitySign sign = (TileEntitySign) tileEntity;
// Prevent client crashing by sending current state of the sign
Expand Down

0 comments on commit 7aeb6ae

Please sign in to comment.