From 6e2256ffcf7612ff4385d00c812bcebe1867e3ab Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 3 Mar 2016 09:08:43 +1100 Subject: [PATCH] Update titles --- .../com/plotsquared/bukkit/BukkitMain.java | 4 +-- .../bukkit/titles/DefaultTitle_19.java | 27 +++++++++++++++++++ .../bukkit/util/block/FastQueue_1_9.java | 6 ++++- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_19.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 205eca913..fd474f62a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -22,7 +22,7 @@ import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.listeners.*; import com.plotsquared.bukkit.listeners.worldedit.WEListener; -import com.plotsquared.bukkit.titles.DefaultTitle; +import com.plotsquared.bukkit.titles.DefaultTitle_19; import com.plotsquared.bukkit.util.*; import com.plotsquared.bukkit.util.block.*; import com.plotsquared.bukkit.uuid.*; @@ -471,7 +471,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { Settings.TITLES = false; FlagManager.removeFlag(FlagManager.getFlag("titles")); } else { - AbstractTitle.TITLE_CLASS = new DefaultTitle(); + AbstractTitle.TITLE_CLASS = new DefaultTitle_19(); if (wrapper instanceof DefaultUUIDWrapper || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) { Settings.TWIN_MODE_UUID = true; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_19.java b/Bukkit/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_19.java new file mode 100644 index 000000000..b00b942a9 --- /dev/null +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_19.java @@ -0,0 +1,27 @@ +package com.plotsquared.bukkit.titles; + +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.AbstractTitle; +import com.intellectualcrafters.plot.util.TaskManager; +import com.plotsquared.bukkit.object.BukkitPlayer; +import org.bukkit.entity.Player; + +public class DefaultTitle_19 extends AbstractTitle { + @Override + public void sendTitle(final PlotPlayer player, final String head, final String sub, final int in, final int delay, final int out) { + try { + final Player playerObj = ((BukkitPlayer) player).player; + playerObj.sendTitle(head,sub); + TaskManager.runTaskLater(new Runnable() { + @Override + public void run() { + playerObj.resetTitle(); + } + }, delay); + } + catch (Throwable e) { + AbstractTitle.TITLE_CLASS = new DefaultTitle(); + AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out); + } + } +} diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java index f93e13ed0..194e3febc 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java @@ -396,7 +396,11 @@ public class FastQueue_1_9 extends SlowQueue { } public boolean isSolid(int i) { - return i != 0 && Material.getMaterial(i).isOccluding(); + if (i != 0) { + Material material = Material.getMaterial(i); + return material != null && Material.getMaterial(i).isOccluding(); + } + return false; } public int getId(int[][] sections, int x, int y, int z) {