Search in sources :

Example 71 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class JuggernautMechanic method minigameStart.

@EventHandler
private void minigameStart(StartMinigameEvent event) {
    if (event.getMinigame().getMechanic() == this) {
        Minigame mgm = event.getMinigame();
        mgm.getScoreboardManager().registerNewTeam("juggernaut");
        mgm.getScoreboardManager().getTeam("juggernaut").setPrefix(ChatColor.RED.toString());
        MinigamePlayer j = assignNewJuggernaut(event.getPlayers(), null);
        JuggernautModule.getMinigameModule(event.getMinigame()).setJuggernaut(j);
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) Minigame(au.com.mineauz.minigames.minigame.Minigame) EventHandler(org.bukkit.event.EventHandler)

Example 72 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MenuItemList method onDoubleClick.

@Override
public ItemStack onDoubleClick() {
    MinigamePlayer ply = getContainer().getViewer();
    ply.setNoClose(true);
    ply.getPlayer().closeInventory();
    ply.sendInfoMessage("Enter the name of the option into chat for " + getName() + ", the menu will automatically reopen in 10s if nothing is entered.");
    ply.setManualEntry(this);
    if (MinigameUtils.listToString(options).getBytes().length > 16000) {
        ply.sendInfoMessage("Unfortunately there are too many options to provide a list in game. Perhaps use the WIKI");
    } else {
        ply.sendInfoMessage("Possible Options: " + MinigameUtils.listToString(options));
    }
    getContainer().startReopenTimer(10);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer)

Example 73 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MenuItemPotionAdd method onClick.

@Override
public ItemStack onClick() {
    MinigamePlayer ply = getContainer().getViewer();
    ply.setNoClose(true);
    ply.getPlayer().closeInventory();
    ply.sendInfoMessage("Enter a potion using the syntax below into chat, the menu will automatically reopen in 30s if nothing is entered.");
    ply.sendInfoMessage("PotionName, level, duration (duration can be \"inf\")");
    ply.setManualEntry(this);
    getContainer().startReopenTimer(30);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer)

Example 74 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MenuItemString method onDoubleClick.

@Override
public ItemStack onDoubleClick() {
    MinigamePlayer ply = getContainer().getViewer();
    ply.setNoClose(true);
    ply.getPlayer().closeInventory();
    ply.sendMessage("Enter string value into chat for " + getName() + ", the menu will automatically reopen in 20s if nothing is entered.", MinigameMessageType.INFO);
    if (allowNull) {
        ply.sendInfoMessage("Enter \"null\" to remove the string value");
    }
    ply.setManualEntry(this);
    getContainer().startReopenTimer(20);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer)

Example 75 with MinigamePlayer

use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.

the class MinigameManager method sendMinigameMessage.

public void sendMinigameMessage(final Minigame minigame, final String message, MinigameMessageType type, final List<MinigamePlayer> exclude) {
    if (!minigame.getShowPlayerBroadcasts()) {
        return;
    }
    String finalMessage;
    if (type == null) {
        type = MinigameMessageType.INFO;
    }
    switch(type) {
        case ERROR:
            finalMessage = ChatColor.RED + "[Minigames] " + ChatColor.WHITE;
            break;
        case INFO:
        default:
            finalMessage = ChatColor.AQUA + "[Minigames] " + ChatColor.WHITE;
            break;
    }
    finalMessage += message;
    final List<MinigamePlayer> sendto = new ArrayList<>();
    Collections.copy(minigame.getPlayers(), sendto);
    sendto.addAll(minigame.getSpectators());
    if (exclude != null) {
        sendto.removeAll(exclude);
    }
    for (final MinigamePlayer pl : sendto) {
        pl.sendInfoMessage(finalMessage);
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer)

Aggregations

MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)134 EventHandler (org.bukkit.event.EventHandler)46 Minigame (au.com.mineauz.minigames.minigame.Minigame)40 ArrayList (java.util.ArrayList)25 Team (au.com.mineauz.minigames.minigame.Team)24 OfflineMinigamePlayer (au.com.mineauz.minigames.objects.OfflineMinigamePlayer)15 Player (org.bukkit.entity.Player)15 Location (org.bukkit.Location)11 ItemStack (org.bukkit.inventory.ItemStack)8 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)7 Menu (au.com.mineauz.minigames.menu.Menu)5 TeamColor (au.com.mineauz.minigames.minigame.TeamColor)5 List (java.util.List)5 PotionEffect (org.bukkit.potion.PotionEffect)5 ResourcePack (au.com.mineauz.minigames.objects.ResourcePack)4 Material (org.bukkit.Material)4 Sign (org.bukkit.block.Sign)4 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)3 MenuItem (au.com.mineauz.minigames.menu.MenuItem)2 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)2