Fix title logic

This commit is contained in:
Jesse Boyd 2016-11-30 21:26:52 +11:00
parent c891abce09
commit 7e34d9e20a
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 18 additions and 8 deletions

View File

@ -1,22 +1,32 @@
package com.plotsquared.bukkit.titles;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitVersion;
import org.bukkit.entity.Player;
@SuppressWarnings("deprecation")
public class DefaultTitle_111 extends AbstractTitle {
private final boolean valid;
public DefaultTitle_111() {
this.valid = PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0);
}
@Override
public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {
if (valid) {
try {
final Player playerObj = ((BukkitPlayer) player).player;
TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out);
title.send(playerObj);
} catch (Throwable ignored) {
AbstractTitle.TITLE_CLASS = new DefaultTitle_110();
return;
} catch (Throwable ignored) {}
}
AbstractTitle.TITLE_CLASS = new DefaultTitle_180();
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
}
}
}

View File

@ -4,7 +4,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.bukkit.object.BukkitPlayer;
public class DefaultTitle_110 extends AbstractTitle {
public class DefaultTitle_180 extends AbstractTitle {
@Override
public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {