Fix several issues from #10
This commit is contained in:
parent
e6ba317789
commit
d55b6e8f5a
|
@ -16,6 +16,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
// @TODO: Add more config options
|
||||
/*
|
||||
* Change Log:
|
||||
* - Fix /esgive command runner from getting kicked with "Illegal Characters" error.
|
||||
* - Fix systems that were placed on the walls.
|
||||
*/
|
||||
public final class EnergeticStorage extends JavaPlugin implements Listener {
|
||||
private static EnergeticStorage plugin;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static net.md_5.bungee.api.ChatColor.STRIP_COLOR_PATTERN;
|
||||
|
||||
public class ESGiveCommand implements TabExecutor {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
|
@ -33,14 +35,14 @@ public class ESGiveCommand implements TabExecutor {
|
|||
tab.addAll(Arrays.asList("1k", "4k", "16k", "64k"));
|
||||
} else if (args[0].equals("system")) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
tab.add(player.getDisplayName());
|
||||
tab.add(ChatColor.stripColor(player.getDisplayName()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (args[0].equals("drive")) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
tab.add(player.getDisplayName());
|
||||
tab.add(ChatColor.stripColor(player.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +99,8 @@ public class ESGiveCommand implements TabExecutor {
|
|||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.getInventory().addItem(ItemConstructor.createSystemBlock());
|
||||
|
||||
sender.sendMessage(Reference.PREFIX + ChatColor.GREEN + "Gave an ES System to " + player.getDisplayName());
|
||||
} else {
|
||||
sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Supply a player to run this command!");
|
||||
sender.sendMessage(generateCommandUsage(args));
|
||||
|
@ -131,6 +135,8 @@ public class ESGiveCommand implements TabExecutor {
|
|||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.getInventory().addItem(ItemConstructor.createDrive(size, 0, 0));
|
||||
|
||||
sender.sendMessage(Reference.PREFIX + ChatColor.GREEN + "Gave an ES Drive to " + player.getDisplayName());
|
||||
} else {
|
||||
sender.sendMessage(Reference.PREFIX + ChatColor.RED + "Supply a player to run this command!");
|
||||
sender.sendMessage(generateCommandUsage(args));
|
||||
|
|
|
@ -282,7 +282,7 @@ public class ESSystemSecurityGUI implements InventoryHolder, Listener {
|
|||
}
|
||||
} else {
|
||||
// At main menu
|
||||
if (slot == 0) {
|
||||
if (slot == 0) { // Back
|
||||
Reference.ES_TERMINAL_GUI.openInventory(player, openSystem);
|
||||
} else if (slot == 3) { // Add player
|
||||
new AnvilGUI.Builder()
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BlockBreakListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onBlockBreakListener(BlockBreakEvent event) {
|
||||
if (event.getBlock().getType() == Material.PLAYER_HEAD) {
|
||||
if (event.getBlock().getType() == Material.PLAYER_HEAD || event.getBlock().getType() == Material.PLAYER_WALL_HEAD) {
|
||||
Block block = event.getBlock();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BlockPlaceListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (event.getBlock().getType() == Material.PLAYER_HEAD) {
|
||||
if (event.getBlock().getType() == Material.PLAYER_HEAD || event.getBlock().getType() == Material.PLAYER_WALL_HEAD) {
|
||||
Block block = event.getBlock();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class PlayerInteractListener implements Listener {
|
|||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getHand() == EquipmentSlot.HAND) {
|
||||
if (event.getClickedBlock().getType() == Material.PLAYER_HEAD) {
|
||||
if (event.getClickedBlock().getType() == Material.PLAYER_HEAD || event.getClickedBlock().getType() == Material.PLAYER_WALL_HEAD) {
|
||||
Block block = event.getClickedBlock();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
|
Loading…
Reference in New Issue