Search in sources :

Example 16 with Floor

use of mc.dragons.core.gameobject.floor.Floor in project DragonsOnline by UniverseCraft.

the class FloorCommand method goToFloor.

private void goToFloor(CommandSender sender, String[] args) {
    Floor floor = lookupFloor(sender, args[1]);
    if (floor == null)
        return;
    FloorStatus status = floor.getFloorStatus();
    boolean access = status == FloorStatus.TESTING || hasPermission(sender, PermissionLevel.BUILDER);
    if (!access) {
        sender.sendMessage(ChatColor.RED + "Testers can only teleport to floors that are in testing!");
        return;
    }
    user(sender).sendToFloor(floor.getFloorName(), true);
    sender.sendMessage(ChatColor.GREEN + "Teleported to floor successfully.");
}
Also used : Floor(mc.dragons.core.gameobject.floor.Floor) FloorStatus(mc.dragons.core.gameobject.floor.Floor.FloorStatus)

Example 17 with Floor

use of mc.dragons.core.gameobject.floor.Floor in project DragonsOnline by UniverseCraft.

the class FloorCommand method pushFloor.

private void pushFloor(CommandSender sender, String[] args) {
    if (!requirePermission(sender, PermissionLevel.ADMIN))
        return;
    Floor floor = lookupFloor(sender, args[1]);
    if (floor == null)
        return;
    if (args.length <= 2 || !args[2].equalsIgnoreCase("--confirm")) {
        sender.sendMessage(ChatColor.DARK_RED + "" + ChatColor.UNDERLINE + "/!\\" + ChatColor.RED + " Pushing this floor will copy it into the PRODUCTION STAGING folder. " + "This is an indication that it is ready to be moved to the live production environment. It may be picked up by Apollo Sync at any time. " + ChatColor.BOLD + "Confirm?");
        TextComponent confirm = new TextComponent(ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "[CONFIRM]");
        confirm.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColor.GREEN + "Click to confirm push of floor #" + floor.getLevelMin() + " " + floor.getDisplayName())));
        confirm.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/floor push " + args[1] + " --confirm"));
        sender.spigot().sendMessage(confirm);
        return;
    }
    sender.sendMessage(ChatColor.GREEN + "Pushing floor " + floor.getDisplayName() + "...");
    pushFloor(floor);
    AUDIT_LOG.savePush(floor, user(sender));
    floor.setFloorStatus(FloorStatus.LIVE);
    sender.sendMessage(ChatColor.GREEN + "...Complete! Floor status was changed to LIVE");
    Bukkit.broadcastMessage(ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "[FLOOR PUSH] " + ChatColor.GREEN + "Floor " + floor.getDisplayName() + " was pushed to production staging! Great work everyone");
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) Floor(mc.dragons.core.gameobject.floor.Floor) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) Text(net.md_5.bungee.api.chat.hover.content.Text)

Example 18 with Floor

use of mc.dragons.core.gameobject.floor.Floor in project DragonsOnline by UniverseCraft.

the class FloorCommand method deleteFloor.

private void deleteFloor(CommandSender sender, String[] args) {
    if (!requirePermission(sender, PermissionLevel.ADMIN))
        return;
    Floor floor = lookupFloor(sender, args[1]);
    if (floor == null)
        return;
    if ((floor.isGMLocked() || floor.getFloorStatus() == FloorStatus.LIVE)) {
        sender.sendMessage(ChatColor.RED + "This floor cannot currently be deleted (status: " + floor.getFloorStatus() + ")");
        return;
    }
    registry.removeFromDatabase(floor);
    AUDIT_LOG.saveEntry(floor, user(sender), "Deleted");
    sender.sendMessage(ChatColor.GREEN + "Deleted this floor successfully. World files remain intact. Changes may not fully take effect until a server restart.");
}
Also used : Floor(mc.dragons.core.gameobject.floor.Floor)

Example 19 with Floor

use of mc.dragons.core.gameobject.floor.Floor in project DragonsOnline by UniverseCraft.

the class GoToFloorCommand method listFloors.

private void listFloors(CommandSender sender) {
    sender.sendMessage(ChatColor.GREEN + "Listing all floors:");
    for (GameObject gameObject : registry.getRegisteredObjects(GameObjectType.FLOOR)) {
        Floor floor = (Floor) gameObject;
        sender.sendMessage(ChatColor.GRAY + "- " + floor.getFloorName() + " [" + floor.getWorldName() + "] [Lv " + floor.getLevelMin() + "]");
    }
}
Also used : Floor(mc.dragons.core.gameobject.floor.Floor) GameObject(mc.dragons.core.gameobject.GameObject)

Example 20 with Floor

use of mc.dragons.core.gameobject.floor.Floor in project DragonsOnline by UniverseCraft.

the class GoToFloorCommand method goToFloor.

private void goToFloor(CommandSender sender, String[] args) {
    Floor floor = lookupFloor(sender, args[0]);
    if (floor == null)
        return;
    user(sender).sendToFloor(floor.getFloorName(), true);
    sender.sendMessage(ChatColor.GREEN + "Teleported to floor successfully.");
}
Also used : Floor(mc.dragons.core.gameobject.floor.Floor)

Aggregations

Floor (mc.dragons.core.gameobject.floor.Floor)20 User (mc.dragons.core.gameobject.user.User)4 Document (org.bson.Document)4 GameObject (mc.dragons.core.gameobject.GameObject)3 Player (org.bukkit.entity.Player)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 UUID (java.util.UUID)2 Dragons (mc.dragons.core.Dragons)2 FloorStatus (mc.dragons.core.gameobject.floor.Floor.FloorStatus)2 FloorLoader (mc.dragons.core.gameobject.floor.FloorLoader)2 Region (mc.dragons.core.gameobject.region.Region)2 Bukkit (org.bukkit.Bukkit)2 EventHandler (org.bukkit.event.EventHandler)2 IOException (java.io.IOException)1 BigInteger (java.math.BigInteger)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Path (java.nio.file.Path)1