Titles are now exclusive to paper servers

This commit is contained in:
MattBDev 2019-05-10 22:42:07 -04:00
parent f232334bcc
commit a841b4ea86
4 changed files with 26 additions and 30 deletions

View file

@ -1,17 +1,19 @@
repositories { repositories {
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" }
maven { url = "https://repo.codemc.org/repository/maven-public" } maven { url "https://repo.codemc.org/repository/maven-public" }
maven { url 'http://repo.onarandombox.com/content/groups/public'} maven { url 'http://repo.onarandombox.com/content/groups/public'}
maven { url 'https://papermc.io/repo/repository/maven-public/' }
mavenLocal() mavenLocal()
} }
dependencies { dependencies {
implementation project(':Core') implementation project(':Core')
compile project(':Core') compile project(':Core')
compile 'com.destroystokyo.paper:paper-api:1.14-R0.1-SNAPSHOT'
implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT' implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT'
implementation 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT' implementation 'org.spigotmc:spigot-api:1.14-R0.1-SNAPSHOT'
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT')
compile("net.milkbowl.vault:VaultAPI:1.7") { compile("net.milkbowl.vault:VaultAPI:1.7") {
exclude module: 'bukkit' exclude module: 'bukkit'

View file

@ -132,8 +132,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public void onEnable() { @Override public void onEnable() {
if (PlotSquared.get().IMP.getServerVersion()[1] < 13) { if (PlotSquared.get().IMP.getServerVersion()[1] < 13) {
PlotSquared.log("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); System.out.println(
PlotSquared.log("Please check the download page for the link to the legacy versions."); "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
System.out
.println("Please check the download page for the link to the legacy versions.");
Bukkit.shutdown(); Bukkit.shutdown();
return; return;
} }
@ -152,7 +154,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads"); System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads");
System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/"); System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/");
System.out.println("[P2] NOTE: This is only a recommendation"); System.out.println("[P2] NOTE: This is only a recommendation");
System.out.println("[P2] both Spigot and CraftBukkit are still supported."); System.out.println("[P2] both Spigot and CraftBukkit are still supported (excluding titles).");
System.out System.out
.println("[P2] ==============================================================="); .println("[P2] ===============================================================");
} }
@ -705,12 +707,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
@Override public UUIDHandlerImplementation initUUIDHandler() { @Override public UUIDHandlerImplementation initUUIDHandler() {
boolean checkVersion = false;
try {
OfflinePlayer.class.getDeclaredMethod("getUniqueId");
checkVersion = true;
} catch (Throwable ignore) {
}
final UUIDWrapper wrapper; final UUIDWrapper wrapper;
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) { if (Settings.UUID.FORCE_LOWERCASE) {
@ -719,23 +715,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
wrapper = new OfflineUUIDWrapper(); wrapper = new OfflineUUIDWrapper();
} }
Settings.UUID.OFFLINE = true; Settings.UUID.OFFLINE = true;
} else if (checkVersion) { } else {
wrapper = new DefaultUUIDWrapper(); wrapper = new DefaultUUIDWrapper();
Settings.UUID.OFFLINE = false; Settings.UUID.OFFLINE = false;
} else {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
} }
if (!checkVersion) { if (Bukkit.getVersion().contains("git-Spigot")) {
PlotSquared.log(Captions.PREFIX PlotSquared.log(Captions.PREFIX
+ " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); + " &c[WARN] Titles are Paper only feature. Titles will be disabled.");
Settings.TITLES = false; Settings.TITLES = false;
} else { } else {
AbstractTitle.TITLE_CLASS = new DefaultTitle();
if (wrapper instanceof DefaultUUIDWrapper if (wrapper instanceof DefaultUUIDWrapper
|| wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) { || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
Settings.UUID.NATIVE_UUID_PROVIDER = true; Settings.UUID.NATIVE_UUID_PROVIDER = true;
@ -798,8 +786,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
@Override public AbstractTitle initTitleManager() { @Override public AbstractTitle initTitleManager() {
if (Bukkit.getVersion().contains("git-Spigot")) {
PlotSquared.log(Captions.PREFIX
+ " &c[WARN] Titles are Paper only feature. Titles will be disabled.");
Settings.TITLES = false;
return null;
}
// Already initialized in UUID handler // Already initialized in UUID handler
return AbstractTitle.TITLE_CLASS; return new DefaultTitle();
} }
@Override @Nullable public PlotPlayer wrapPlayer(final Object player) { @Override @Nullable public PlotPlayer wrapPlayer(final Object player) {

View file

@ -3,17 +3,17 @@ package com.github.intellectualsites.plotsquared.bukkit.titles;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class DefaultTitle extends AbstractTitle { public class DefaultTitle extends AbstractTitle {
@Override @Override
public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {
try { //Titles are now a Paper Exclusive feature.
if (Bukkit.getVersion().contains("git-Paper")) {
final Player playerObj = ((BukkitPlayer) player).player; final Player playerObj = ((BukkitPlayer) player).player;
TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out); playerObj.sendTitle(head, sub, in, delay, out);
title.send(playerObj);
} catch (Throwable ignored) {
} }
} }
} }

View file

@ -27,9 +27,9 @@ public class Settings extends Config {
@Final public static String PLATFORM; // These values are set from P2 before loading @Final public static String PLATFORM; // These values are set from P2 before loading
@Comment("Show additional information in console") public static boolean DEBUG = true; @Comment("Show additional information in console") public static boolean DEBUG = true;
@Comment({"The big annoying text that appears when you enter a plot", @Comment({"[PAPER ONLY] The big annoying text that appears when you enter a plot",
"For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`"}) "For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`"})
public static boolean TITLES = true; public static boolean TITLES = false;
@Create // This value will be generated automatically @Create // This value will be generated automatically
public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null; public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null;