mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fix title logic
This commit is contained in:
parent
c891abce09
commit
7e34d9e20a
@ -1,22 +1,32 @@
|
|||||||
package com.plotsquared.bukkit.titles;
|
package com.plotsquared.bukkit.titles;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitVersion;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class DefaultTitle_111 extends AbstractTitle {
|
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
|
@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 {
|
if (valid) {
|
||||||
final Player playerObj = ((BukkitPlayer) player).player;
|
try {
|
||||||
TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out);
|
final Player playerObj = ((BukkitPlayer) player).player;
|
||||||
title.send(playerObj);
|
TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out);
|
||||||
} catch (Throwable ignored) {
|
title.send(playerObj);
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_110();
|
return;
|
||||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
} 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.intellectualcrafters.plot.util.AbstractTitle;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
|
||||||
public class DefaultTitle_110 extends AbstractTitle {
|
public class DefaultTitle_180 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) {
|
Loading…
Reference in New Issue
Block a user