mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +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) {
|
||||||
|
if (valid) {
|
||||||
try {
|
try {
|
||||||
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);
|
TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out);
|
||||||
title.send(playerObj);
|
title.send(playerObj);
|
||||||
} catch (Throwable ignored) {
|
return;
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_110();
|
} catch (Throwable ignored) {}
|
||||||
|
}
|
||||||
|
AbstractTitle.TITLE_CLASS = new DefaultTitle_180();
|
||||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
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