mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
Fixes #151
This commit is contained in:
parent
b10553923a
commit
f72b50d4f8
@ -44,6 +44,8 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -102,6 +104,10 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(final InventoryClickEvent event) {
|
public void onInventoryClick(final InventoryClickEvent event) {
|
||||||
final Player player = (Player) event.getWhoClicked();
|
final Player player = (Player) event.getWhoClicked();
|
||||||
|
Inventory inv = event.getInventory();
|
||||||
|
if (inv == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!event.getInventory().getName().equals(ChatColor.RED + "Plot Jukebox")) {
|
if (!event.getInventory().getName().equals(ChatColor.RED + "Plot Jukebox")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -126,7 +132,8 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
RecordMeta meta = null;
|
RecordMeta meta = null;
|
||||||
for (final RecordMeta m : RecordMeta.metaList) {
|
for (final RecordMeta m : RecordMeta.metaList) {
|
||||||
if (m.getMaterial() == event.getCurrentItem().getType()) {
|
ItemStack item = event.getCurrentItem();
|
||||||
|
if (item != null && m.getMaterial() == item.getType()) {
|
||||||
meta = m;
|
meta = m;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -134,11 +141,13 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
if (meta == null) {
|
if (meta == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (meta != null) {
|
||||||
for (final Player p : plotPlayers) {
|
for (final Player p : plotPlayers) {
|
||||||
p.playEffect(p.getLocation(), Effect.RECORD_PLAY, meta.getMaterial());
|
p.playEffect(p.getLocation(), Effect.RECORD_PLAY, meta.getMaterial());
|
||||||
MainUtil.sendMessage(pp, C.RECORD_PLAY.s().replaceAll("%player", player.getName()).replaceAll("%name", meta.toString()));
|
MainUtil.sendMessage(pp, C.RECORD_PLAY.s().replaceAll("%player", player.getName()).replaceAll("%name", meta.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onInteract(final BlockDamageEvent event) {
|
public void onInteract(final BlockDamageEvent event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user