Skip to content

Commit

Permalink
fix mappings code handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 6, 2019
1 parent 7563b2a commit e787f6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Expand Up @@ -69,8 +69,8 @@ public static JavaPlugin getJavaPlugin() {
return javaPlugin;
}

public String getNmsMappingsCode() {
return null;
public boolean isCorrectMappingsCode() {
return true;
}

public abstract Sidebar createSidebar(Player player);
Expand Down
17 changes: 6 additions & 11 deletions plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -59,7 +59,6 @@
import net.aufdemrand.denizencore.objects.dList;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.objects.dScript;
import net.aufdemrand.denizencore.objects.properties.Property;
import net.aufdemrand.denizencore.objects.properties.PropertyParser;
import net.aufdemrand.denizencore.scripts.ScriptBuilder;
import net.aufdemrand.denizencore.scripts.ScriptEntry;
Expand All @@ -85,7 +84,6 @@
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 @@ -347,15 +345,12 @@ public void onEnable() {
return;
}

String mappingsCode = NMSHandler.getInstance().getNmsMappingsCode();
if (mappingsCode != null) {
if (!((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().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.getInstance().isCorrectMappingsCode()) {
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
Expand Down
Expand Up @@ -31,6 +31,7 @@
import org.bukkit.block.data.Powerable;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_13_R2.util.CraftMagicNumbers;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
Expand Down Expand Up @@ -59,8 +60,8 @@ public class Handler_v1_13_R2 extends NMSHandler {
private final ProfileEditor profileEditor = new ProfileEditor_v1_13_R2();

@Override
public String getNmsMappingsCode() {
return "00ed8e5c39debc3ed194ad7c5645cc45";
public boolean isCorrectMappingsCode() {
return ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("00ed8e5c39debc3ed194ad7c5645cc45");
}

@Override
Expand Down

0 comments on commit e787f6b

Please sign in to comment.