Remove IslandSethome.java
This commit is contained in:
parent
f863fbc56e
commit
17d0cb4c5f
|
|
@ -16,7 +16,6 @@ public class IslandCommand extends PlayerSubCommand {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
registerSubCommand(new IslandGo(plugin)); // TODO -- Add some more output
|
registerSubCommand(new IslandGo(plugin)); // TODO -- Add some more output
|
||||||
registerSubCommand(new IslandSethome(plugin)); // Todo -- Add some more output
|
|
||||||
registerSubCommand(new IslandRestart(plugin)); // TODO -- Add IslandRestartCommand
|
registerSubCommand(new IslandRestart(plugin)); // TODO -- Add IslandRestartCommand
|
||||||
registerSubCommand(new IslandAccept(plugin));
|
registerSubCommand(new IslandAccept(plugin));
|
||||||
registerSubCommand(new IslandDeny(plugin));
|
registerSubCommand(new IslandDeny(plugin));
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.alttd.cometskyblock.commands.island;
|
|
||||||
|
|
||||||
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
|
||||||
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
|
||||||
import com.alttd.cometskyblock.configuration.MessageConfiguration;
|
|
||||||
import com.alttd.cometskyblock.island.IslandPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class IslandSethome extends PlayerSubCommand {
|
|
||||||
|
|
||||||
public IslandSethome(CometSkyBlockPlugin plugin) {
|
|
||||||
super(plugin, "sethome");
|
|
||||||
}
|
|
||||||
// TODO -- Finish sethome command
|
|
||||||
@Override
|
|
||||||
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
|
||||||
MessageConfiguration.Commands.Island.SetHome setHome = plugin.messagesConfiguration().get().commands().island().setHome();
|
|
||||||
if (!islandPlayer.islandOwner()) {
|
|
||||||
// You must be island owner to do this command.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!player.getWorld().getUID().equals(islandPlayer.islandUUID())) {
|
|
||||||
// You must be on your island to use this command.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (player.getFallDistance() > 0 || player.isFlying()) {
|
|
||||||
// You can't use this command when falling
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
player.getWorld().setSpawnLocation(player.getLocation());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -8,6 +8,22 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||||
@SuppressWarnings({"CanBeFinal", "FieldMayBeFinal"})
|
@SuppressWarnings({"CanBeFinal", "FieldMayBeFinal"})
|
||||||
public class MessageConfiguration implements Configuration {
|
public class MessageConfiguration implements Configuration {
|
||||||
|
|
||||||
|
|
||||||
|
private Island island = new Island();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Island {
|
||||||
|
|
||||||
|
String notIslandOwner = "<red>You must be the island owner to do this!";
|
||||||
|
String notOnIsland = "<red>You must be on your island to do this!";
|
||||||
|
String notFallingOrFlying = "<red>You can not do this while falling!";
|
||||||
|
|
||||||
|
SetHome setHome = new SetHome();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class SetHome {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Commands commands = new Commands();
|
private Commands commands = new Commands();
|
||||||
@ConfigSerializable @Getter
|
@ConfigSerializable @Getter
|
||||||
public static class Commands {
|
public static class Commands {
|
||||||
|
|
@ -41,12 +57,6 @@ public class MessageConfiguration implements Configuration {
|
||||||
String challenges = "Opens the challenges menu.";
|
String challenges = "Opens the challenges menu.";
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHome setHome = new SetHome();
|
|
||||||
@ConfigSerializable @Getter
|
|
||||||
public static class SetHome {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Restart restart = new Restart();
|
Restart restart = new Restart();
|
||||||
@ConfigSerializable @Getter
|
@ConfigSerializable @Getter
|
||||||
public static class Restart {
|
public static class Restart {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
package com.alttd.cometskyblock.island.gui;
|
package com.alttd.cometskyblock.island.gui;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.configuration.MessageConfiguration;
|
||||||
import com.alttd.cometskyblock.gui.GUIInventory;
|
import com.alttd.cometskyblock.gui.GUIInventory;
|
||||||
import com.alttd.cometskyblock.island.Island;
|
import com.alttd.cometskyblock.island.Island;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SettingsGUI extends GUIInventory {
|
public class SettingsGUI extends GUIInventory {
|
||||||
|
|
||||||
public SettingsGUI(Island island) {
|
public SettingsGUI(Island island) {
|
||||||
|
|
@ -21,6 +28,26 @@ public class SettingsGUI extends GUIInventory {
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
makeMenuBar();
|
makeMenuBar();
|
||||||
|
// setHome
|
||||||
|
addButton(10, createMenuButton(Material.GRASS_BLOCK, "Set your IslandSpawn location!", List.of(
|
||||||
|
"<white>This sets your island spawn location to your current location."
|
||||||
|
),event -> {
|
||||||
|
MessageConfiguration.Island islandMessages = CometSkyBlockPlugin.instance().messagesConfiguration().get().island();
|
||||||
|
IslandPlayer islandPlayer = IslandPlayer.getIslandPlayer(player.getUniqueId());
|
||||||
|
if (!islandPlayer.islandOwner()) {
|
||||||
|
player.sendRichMessage(islandMessages.notIslandOwner());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.getWorld().getUID().equals(islandPlayer.islandUUID())) {
|
||||||
|
player.sendRichMessage(islandMessages.notOnIsland());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (player.getFallDistance() > 0 || player.isFlying()) {
|
||||||
|
player.sendRichMessage(islandMessages.notFallingOrFlying());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.getWorld().setSpawnLocation(player.getLocation());
|
||||||
|
}));
|
||||||
super.decorate(player);
|
super.decorate(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user