mirror of
https://github.com/SPAWNRYS-ban/FUCK-CustomDiscs.git
synced 2025-12-10 05:19:43 +05:00
Bugfix: Spaces cannot be used in disc names
This commit is contained in:
@@ -11,6 +11,6 @@ mod_id=customdiscsplugin
|
||||
# Target an older API to make it compatible with older versions of Simple Voice Chat
|
||||
voicechat_api_version=2.3.3
|
||||
|
||||
plugin_version=2.2.1
|
||||
plugin_version=2.2.2
|
||||
maven_group=me.Navoei.customdiscsplugin
|
||||
archives_base_name=custom-discs
|
||||
@@ -14,7 +14,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package me.Navoei.customdiscsplugin;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@@ -26,7 +24,7 @@ import java.util.Objects;
|
||||
|
||||
public class HopperManager implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHopperPickupFromOtherSource(InventoryMoveItemEvent event) {
|
||||
|
||||
if (event.getDestination().getLocation() == null) return;
|
||||
@@ -62,7 +60,7 @@ public class HopperManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHopperPickupItem(InventoryPickupItemEvent event) {
|
||||
|
||||
if (!Objects.requireNonNull(event.getInventory().getLocation()).getChunk().isLoaded()) return;
|
||||
@@ -97,7 +95,7 @@ public class HopperManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemPlayerToHopper(InventoryClickEvent event) {
|
||||
|
||||
if (event.getClickedInventory() == null) return;
|
||||
@@ -182,7 +180,7 @@ public class HopperManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
|
||||
if (Objects.requireNonNull(event.getInventory()).getLocation() == null) return;
|
||||
@@ -204,7 +202,7 @@ public class HopperManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
for (BlockState blockState : event.getChunk().getTileEntities()) {
|
||||
if (blockState instanceof Jukebox) {
|
||||
@@ -215,7 +213,7 @@ public class HopperManager implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onJukeboxPlace(BlockPlaceEvent event) {
|
||||
if (!event.getBlock().getType().equals(Material.JUKEBOX)) return;
|
||||
|
||||
@@ -223,7 +221,7 @@ public class HopperManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHopperPlace(BlockPlaceEvent event) {
|
||||
if (!event.getBlock().getType().equals(Material.HOPPER)) return;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CreateCommand extends SubCommand {
|
||||
@Override
|
||||
public void perform(Player player, String[] args) {
|
||||
if (isMusicDisc(player)) {
|
||||
if (args.length == 3) {
|
||||
if (args.length >= 3) {
|
||||
|
||||
if (!player.hasPermission("customdiscs.create")) {
|
||||
player.sendMessage(ChatColor.RED + "You do not have permission to execute this command!");
|
||||
@@ -94,10 +94,8 @@ public class CreateCommand extends SubCommand {
|
||||
player.sendMessage("Your filename is: " + ChatColor.GRAY + songname);
|
||||
player.sendMessage("Your custom name is: " + ChatColor.GRAY + customName(readQuotes(args)));
|
||||
|
||||
} else if (args.length < 3) {
|
||||
player.sendMessage(ChatColor.RED + "Insufficient arguments! ( /customdisc create <filename> \"Custom Lore\" )");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Too many arguments! ( /customdisc create <filename> \"Custom Lore\" )");
|
||||
player.sendMessage(ChatColor.RED + "Insufficient arguments! ( /customdisc create <filename> \"Custom Lore\" )");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You are not holding a music disc in your main hand!");
|
||||
|
||||
@@ -13,16 +13,19 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -32,7 +35,7 @@ import java.util.Objects;
|
||||
|
||||
public class JukeBox implements Listener{
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onInsert(PlayerInteractEvent event) throws IOException {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@@ -69,7 +72,7 @@ public class JukeBox implements Listener{
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEject(PlayerInteractEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@@ -85,7 +88,7 @@ public class JukeBox implements Listener{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onJukeboxBreak(BlockBreakEvent event) {
|
||||
|
||||
Block block = event.getBlock();
|
||||
@@ -96,8 +99,8 @@ public class JukeBox implements Listener{
|
||||
stopDisc(block, player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJukeBoxExplode(EntityExplodeEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onJukeboxExplode(EntityExplodeEvent event) {
|
||||
|
||||
for (Block explodedBlock : event.blockList()) {
|
||||
if (explodedBlock.getType() == Material.JUKEBOX) {
|
||||
|
||||
Reference in New Issue
Block a user