mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fix title logic
This commit is contained in:
parent
c891abce09
commit
7e34d9e20a
@ -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) {
|
||||
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();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, 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);
|
||||
return;
|
||||
} catch (Throwable ignored) {}
|
||||
}
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_180();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
Loading…
Reference in New Issue
Block a user