Search in sources :

Example 61 with CommandSender

use of net.md_5.bungee.api.CommandSender in project solinia3-core by mixxit.

the class CommandListDisguises method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!(sender instanceof Player) && !(sender instanceof CommandSender))
        return false;
    if (!sender.isOp() && !sender.hasPermission("solinia.listdisguises")) {
        sender.sendMessage("You do not have permission to access this command");
        return false;
    }
    try {
        if (args.length == 0) {
            // Return all
            for (SoliniaDisguise entity : StateManager.getInstance().getConfigurationManager().getSoliniaDisguises()) {
                TextComponent textComponent = new TextComponent();
                String title = "DisguiseId: " + ChatColor.GOLD + entity.getId() + ChatColor.RESET + " - " + entity.getDisguiseName();
                textComponent.setText(title);
                String transfertext = "/editdisguise" + entity.getId() + "";
                textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, transfertext));
                sender.spigot().sendMessage(textComponent);
            }
            return true;
        }
        if (args.length > 0 && args[0].equals(".criteria")) {
            try {
                ChatUtils.sendFilterByCriteria(StateManager.getInstance().getConfigurationManager().getSoliniaDisguises(), sender, args, SoliniaDisguise.class);
                return true;
            } catch (CoreStateInitException e) {
                // TODO Auto-generated catch block
                sender.sendMessage(e.getMessage());
                e.printStackTrace();
            }
        }
        // Filter for name
        for (SoliniaDisguise entity : StateManager.getInstance().getConfigurationManager().getSoliniaDisguises()) {
            if (entity.getDisguiseName().toUpperCase().contains(args[0].toUpperCase())) {
                TextComponent textComponent = new TextComponent();
                String title = "DisguiseID: " + ChatColor.GOLD + entity.getId() + ChatColor.RESET + " - " + entity.getDisguiseName();
                textComponent.setText(title);
                String transfertext = "/editdisguise " + entity.getId() + "";
                textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, transfertext));
                sender.spigot().sendMessage(textComponent);
            }
        }
    } catch (CoreStateInitException e) {
        sender.sendMessage(e.getMessage());
    }
    return true;
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) Player(org.bukkit.entity.Player) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) CommandSender(org.bukkit.command.CommandSender) SoliniaDisguise(com.solinia.solinia.Models.SoliniaDisguise)

Example 62 with CommandSender

use of net.md_5.bungee.api.CommandSender in project solinia3-core by mixxit.

the class SoliniaNPC method sendNpcSettingsToSender.

@Override
public void sendNpcSettingsToSender(CommandSender sender) throws CoreStateInitException {
    sender.sendMessage(ChatColor.RED + "NPC Settings for " + ChatColor.GOLD + getName() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- id: " + ChatColor.GOLD + getId() + ChatColor.RESET + " " + "name: " + ChatColor.GOLD + getName() + ChatColor.RESET);
    if (getRaceid() != 0) {
        sender.sendMessage("- raceid: " + ChatColor.GOLD + getRaceid() + " (" + StateManager.getInstance().getConfigurationManager().getRace(getRaceid()).getName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- raceid: " + ChatColor.GOLD + getRaceid() + " (No Race)" + ChatColor.RESET);
    }
    if (getClassid() != 0) {
        sender.sendMessage("- classid: " + ChatColor.GOLD + getClassid() + " (" + StateManager.getInstance().getConfigurationManager().getClassObj(getClassid()).getName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- classid: " + ChatColor.GOLD + getClassid() + " (No Class)" + ChatColor.RESET);
    }
    sender.sendMessage(ChatColor.RED + "STATS" + ChatColor.RESET);
    sender.sendMessage("- level: " + ChatColor.GOLD + getLevel() + ChatColor.RESET + " " + "ac: " + ChatColor.GOLD + getAC() + ChatColor.RESET + " " + "forcedmaxhp: " + ChatColor.GOLD + getForcedMaxHp());
    sender.sendMessage("- hpregenrate: " + ChatColor.GOLD + getHpRegenRate() + ChatColor.RESET + " " + "manaregenrate: " + ChatColor.GOLD + getManaRegenRate() + ChatColor.RESET + " " + " basemana: " + ChatColor.GOLD + getMana());
    sender.sendMessage("- avoidancerating: " + ChatColor.GOLD + getAvoidanceRating() + ChatColor.RESET + " " + "accuracyrating: " + ChatColor.GOLD + getNPCDefaultAccuracyRating() + ChatColor.RESET);
    sender.sendMessage("- mindmg: " + ChatColor.GOLD + getMinInternalDmg() + ChatColor.RESET + " " + "maxdmg: " + ChatColor.GOLD + getMaxInternalDmg() + ChatColor.RESET + " atk: " + ChatColor.GOLD + getAtk() + ChatColor.RESET);
    sender.sendMessage("fireresist: " + ChatColor.GOLD + getInternalFireresist() + ChatColor.RESET + " coldresist: " + ChatColor.GOLD + getInternalColdresist() + ChatColor.RESET + " magicresist: " + ChatColor.GOLD + getInternalMagicresist() + ChatColor.RESET + " poisonresist: " + ChatColor.GOLD + getInternalPoisonresist() + ChatColor.RESET + " diseaseresist: " + ChatColor.GOLD + getInternalDiseaseresist() + ChatColor.RESET);
    sender.sendMessage("- canarearampage: " + ChatColor.GOLD + canAreaRampage() + ChatColor.RESET);
    sender.sendMessage("- canenrage: " + ChatColor.GOLD + canEnrage() + ChatColor.RESET);
    sender.sendMessage("- canflurry: " + ChatColor.GOLD + canFlurry() + ChatColor.RESET);
    sender.sendMessage("- canquad: " + ChatColor.GOLD + canQuad() + ChatColor.RESET);
    sender.sendMessage("- canrampage: " + ChatColor.GOLD + canRampage() + ChatColor.RESET);
    sender.sendMessage("- cantriple: " + ChatColor.GOLD + canTriple() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage(ChatColor.RED + "SPAWNING" + ChatColor.RESET);
    sender.sendMessage("- eventusable: " + ChatColor.GOLD + isEventUsable() + ChatColor.RESET);
    sender.sendMessage("- timefrom: " + ChatColor.GOLD + getTimefrom() + ChatColor.RESET + "- timeto: " + ChatColor.GOLD + getTimeto() + ChatColor.RESET + " - randomspawn: " + ChatColor.GOLD + isRandomSpawn() + ChatColor.RESET + " chancetorespawnondeath: " + ChatColor.GOLD + getChanceToRespawnOnDeath() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage(ChatColor.RED + "AI" + ChatColor.RESET);
    sender.sendMessage("- canseeinvis: " + ChatColor.GOLD + isCanSeeInvis() + ChatColor.RESET + " undead: " + ChatColor.GOLD + isUndead() + ChatColor.RESET + " " + "plant: " + ChatColor.GOLD + isPlant() + ChatColor.RESET + " " + "animal: " + ChatColor.GOLD + isAnimal() + ChatColor.RESET);
    sender.sendMessage("petcontrollable: " + ChatColor.GOLD + isPetControllable() + ChatColor.RESET + " " + "social: " + ChatColor.GOLD + isSocial());
    sender.sendMessage("- pet: " + ChatColor.GOLD + isCorePet() + ChatColor.RESET + " - racialpet: " + ChatColor.GOLD + this.isRacialPet + ChatColor.RESET);
    sender.sendMessage("- summoner: " + ChatColor.GOLD + isSummoner() + ChatColor.RESET + " - guard: " + ChatColor.GOLD + isGuard() + ChatColor.RESET + " " + "roamer: " + ChatColor.GOLD + isRoamer() + ChatColor.RESET);
    sender.sendMessage("- heroic: " + ChatColor.GOLD + isHeroic() + " " + ChatColor.RESET + "- boss: " + ChatColor.GOLD + isBoss() + ChatColor.RESET + " - raidheroic: " + ChatColor.GOLD + isRaidheroic() + " " + ChatColor.RESET + "raidboss: " + ChatColor.GOLD + isRaidboss());
    sender.sendMessage("- speaksalllanguages: " + ChatColor.GOLD + isSpeaksAllLanguages() + ChatColor.RESET + " banker: " + ChatColor.GOLD + isBanker() + ChatColor.RESET);
    sender.sendMessage("- randomchattriggertext: " + ChatColor.GOLD + getRandomchatTriggerText());
    sender.sendMessage("- deathgrantstitle: " + ChatColor.GOLD + getDeathGrantsTitle() + ChatColor.RESET);
    sender.sendMessage("- killtriggertext: " + ChatColor.GOLD + getKillTriggerText());
    sender.sendMessage("- teleportattack: " + ChatColor.GOLD + isTeleportAttack() + " " + ChatColor.RESET + " teleportattacklocation: " + ChatColor.GOLD + getTeleportAttackLocation() + ChatColor.RESET);
    if (getFactionid() != 0) {
        sender.sendMessage("- factionid: " + ChatColor.GOLD + getFactionid() + " (" + StateManager.getInstance().getConfigurationManager().getFaction(getFactionid()).getName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- factionid: " + ChatColor.GOLD + getFactionid() + " (No Faction)" + ChatColor.RESET);
    }
    if (getMerchantid() != 0) {
        sender.sendMessage("- merchantid: " + ChatColor.GOLD + getMerchantid() + " (" + StateManager.getInstance().getConfigurationManager().getNPCMerchant(getMerchantid()).getName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- merchantid: " + ChatColor.GOLD + getMerchantid() + " (No Merchant Table)" + ChatColor.RESET);
    }
    sender.sendMessage("----------------------------");
    sender.sendMessage(ChatColor.RED + "APPEARANCE" + ChatColor.RESET);
    sender.sendMessage("- mctype: " + ChatColor.GOLD + getMctype() + ChatColor.RESET);
    if (getDisguiseId() != 0) {
        sender.sendMessage("- disguiseid: " + ChatColor.GOLD + getDisguiseId() + " (" + StateManager.getInstance().getConfigurationManager().getDisguise(getDisguiseId()).getDisguiseName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- disguiseid: " + ChatColor.GOLD + getDisguiseId() + " (No Disguise)" + ChatColor.RESET);
    }
    TextComponent tc = new TextComponent("- customhead: " + ChatColor.GOLD + isCustomhead() + ChatColor.RESET + " - customheaddata: " + ChatColor.GOLD + "<hover to see>" + ChatColor.RESET);
    if (this.customheaddata != null && this.customheaddata.length() > 0)
        tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(this.getCustomheaddata()).create()));
    sender.spigot().sendMessage(tc);
    sender.sendMessage("- upsidedown: " + ChatColor.GOLD + isUpsidedown() + ChatColor.RESET + " " + "burning: " + ChatColor.GOLD + isBurning() + ChatColor.RESET + " " + "invisible: " + ChatColor.GOLD + isInvisible() + ChatColor.RESET);
    sender.sendMessage(ChatColor.RED + "EQUIPMENT" + ChatColor.RESET);
    if (getLoottableid() != 0) {
        sender.sendMessage("- loottableid: " + ChatColor.GOLD + getLoottableid() + " (" + StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid()).getName() + ")" + ChatColor.RESET);
    } else {
        sender.sendMessage("- loottableid: " + ChatColor.GOLD + getLoottableid() + " (No Loot Table)" + ChatColor.RESET);
    }
    sender.sendMessage("- handitem: " + ChatColor.GOLD + getHanditem() + ChatColor.RESET + " " + "offhanditem: " + ChatColor.GOLD + getOffhanditem() + ChatColor.RESET);
    sender.sendMessage("- headitem: " + ChatColor.GOLD + getHeaditem() + ChatColor.RESET + " " + "chestitem: " + ChatColor.GOLD + getChestitem() + ChatColor.RESET);
    sender.sendMessage("- legsitem: " + ChatColor.GOLD + getLegsitem() + ChatColor.RESET + " " + "feetitem: " + ChatColor.GOLD + getFeetitem() + ChatColor.RESET);
    sender.sendMessage(ChatColor.RED + "MISC" + ChatColor.RESET);
    if (getNpcSpellList() > 0) {
        NPCSpellList npcSpellList = StateManager.getInstance().getConfigurationManager().getNPCSpellList(getNpcSpellList());
        sender.sendMessage("- npcspelllist: " + ChatColor.GOLD + npcSpellList.getName() + " [" + getNpcSpellList() + "]");
    } else {
        sender.sendMessage("- npcspelllist: " + ChatColor.GOLD + getNpcSpellList() + " (Defaults to class spell list)");
    }
    sender.sendMessage("----------------------------");
    if (getLoottableid() != 0) {
        sender.sendMessage(ChatColor.RED + "LOOTTABLE: " + ChatColor.RESET + "[" + getLoottableid() + "] - " + "(" + StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid()).getName() + ")");
        ISoliniaLootTable loottable = StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid());
        for (ISoliniaLootTableEntry le : StateManager.getInstance().getConfigurationManager().getLootTable(loottable.getId()).getEntries()) {
            ISoliniaLootDrop ld = StateManager.getInstance().getConfigurationManager().getLootDrop(le.getLootdropid());
            sender.sendMessage("- LOOTDROP: " + ChatColor.GOLD + ld.getName().toUpperCase() + ChatColor.RESET + "[" + ld.getId() + "]:");
        }
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder) ISoliniaLootDrop(com.solinia.solinia.Interfaces.ISoliniaLootDrop)

Example 63 with CommandSender

use of net.md_5.bungee.api.CommandSender in project solinia3-core by mixxit.

the class SoliniaItem method sendItemSettingsToSender.

@Override
public void sendItemSettingsToSender(CommandSender sender) throws CoreStateInitException {
    sender.sendMessage(ChatColor.RED + "Item Settings for " + ChatColor.GOLD + getDisplayname() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- id: " + ChatColor.GOLD + getId() + ChatColor.RESET + " basename: " + ChatColor.GOLD + getBasename() + ChatColor.RESET + " - minlevel: " + ChatColor.GOLD + getMinLevel() + ChatColor.RESET);
    sender.sendMessage("- displayname: " + ChatColor.GOLD + getDisplayname() + ChatColor.RESET + " tier: " + ChatColor.GOLD + getTier() + ChatColor.RESET);
    sender.sendMessage("- lastupdated: " + ChatColor.GOLD + this.getLastUpdatedTimeAsString() + ChatColor.RESET + " appearanceid: " + ChatColor.GOLD + this.getAppearanceId() + ChatColor.RESET);
    sender.sendMessage("- worth: " + ChatColor.GOLD + getWorth() + ChatColor.RESET + " inspirationworth: " + ChatColor.GOLD + getInspirationWorth() + ChatColor.RESET + " placeable: " + ChatColor.GOLD + isPlaceable() + ChatColor.RESET);
    sender.sendMessage("- awardsinspiration: " + ChatColor.GOLD + getAwardsInspiration() + ChatColor.RESET);
    sender.sendMessage("- color (blocktype): " + ChatColor.GOLD + getColor() + ChatColor.RESET + " dye (armour color): " + ChatColor.GOLD + getDye() + ChatColor.RESET);
    String leathercolor = "NONE";
    if (getLeatherRgbDecimal() > 0) {
        Color colorTmp = Color.fromRGB(getLeatherRgbDecimal());
        leathercolor = ColorUtil.fromRGB(colorTmp.getRed(), colorTmp.getGreen(), colorTmp.getBlue()) + "(Closest)" + ChatColor.RESET;
    }
    sender.sendMessage("- requiredweaponskilltype: " + ChatColor.GOLD + getRequiredWeaponSkillType() + ChatColor.RESET);
    sender.sendMessage("- leatherrgbdecimal: " + ChatColor.GOLD + getLeatherRgbDecimal() + ChatColor.RESET + leathercolor + " See: https://bit.ly/2i02I8k");
    sender.sendMessage("- reagent: " + ChatColor.GOLD + isReagent() + ChatColor.RESET + " neverdrop: " + ChatColor.GOLD + isNeverDrop() + ChatColor.RESET);
    sender.sendMessage("- temporary: " + ChatColor.GOLD + isTemporary() + ChatColor.RESET + " - consumable: " + ChatColor.GOLD + isConsumable() + ChatColor.RESET);
    sender.sendMessage("- consumablerequirenotquestflag: " + ChatColor.GOLD + getConsumableRequireNotQuestFlag() + ChatColor.RESET + " " + " consumablerequirequestflag: " + ChatColor.GOLD + getConsumableRequireQuestFlag() + ChatColor.RESET);
    sender.sendMessage("- consumablerequireinzone: " + ChatColor.GOLD + this.getConsumableRequireInZone() + ChatColor.RESET);
    sender.sendMessage("- bandage: " + ChatColor.GOLD + isBandage() + ChatColor.RESET + " languageprimer: " + ChatColor.GOLD + getLanguagePrimer() + ChatColor.RESET);
    sender.sendMessage("- augmentation: " + ChatColor.GOLD + isAugmentation() + ChatColor.RESET + "- distiller: " + ChatColor.GOLD + isDistiller() + ChatColor.RESET);
    sender.sendMessage("- discoverer: " + ChatColor.GOLD + getDiscoverer() + ChatColor.RESET + " - artifact: " + ChatColor.GOLD + isArtifact() + ChatColor.RESET + " Found: (" + isArtifactFound() + ")" + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- acceptsaugmentationslottype: " + ChatColor.GOLD + getAcceptsAugmentationSlotType() + ChatColor.RESET);
    sender.sendMessage("- augmentationfitsslottype: " + ChatColor.GOLD + this.getAugmentationFitsSlotType().name() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- hpregen: " + ChatColor.GOLD + getHpregen() + ChatColor.RESET + " mpregen: " + ChatColor.GOLD + getMpregen() + ChatColor.RESET);
    sender.sendMessage("- ac: " + ChatColor.GOLD + getAC() + ChatColor.RESET + "hp: " + ChatColor.GOLD + getHp() + ChatColor.RESET + " mana: " + ChatColor.GOLD + getMana() + ChatColor.RESET);
    sender.sendMessage("- attack: " + this.getAttack() + " damage: " + ChatColor.GOLD + getDefinedItemDamage() + ChatColor.RESET + " weapondelay: " + ChatColor.GOLD + getWeaponDelay() + ChatColor.RESET + " baneundead: " + ChatColor.GOLD + getBaneUndead() + ChatColor.RESET);
    sender.sendMessage("- abilityid: " + ChatColor.GOLD + getAbilityid() + ChatColor.RESET + " - weaponabilityid: " + ChatColor.GOLD + getWeaponabilityid() + ChatColor.RESET + " focuseffectid: " + ChatColor.GOLD + getFocusEffectId() + ChatColor.RESET);
    sender.sendMessage("- attackspeedpct: " + ChatColor.GOLD + getAttackspeed() + "%" + ChatColor.RESET + " procrate: " + ChatColor.GOLD + getProcRate() + ChatColor.RESET);
    sender.sendMessage("- strength: " + ChatColor.GOLD + getStrength() + ChatColor.RESET + " - stamina: " + ChatColor.GOLD + getStamina() + ChatColor.RESET + " - agility: " + ChatColor.GOLD + getAgility() + ChatColor.RESET + " - dexterity: " + ChatColor.GOLD + getDexterity() + ChatColor.RESET);
    sender.sendMessage("- intelligence: " + ChatColor.GOLD + getIntelligence() + ChatColor.RESET + " - wisdom: " + ChatColor.GOLD + getWisdom() + ChatColor.RESET + " - charisma: " + ChatColor.GOLD + getCharisma() + ChatColor.RESET);
    sender.sendMessage("- MR: " + ChatColor.GOLD + getMagicResist() + ChatColor.RESET + " CR: " + ChatColor.GOLD + getColdResist() + ChatColor.RESET + " FR: " + ChatColor.GOLD + getFireResist() + ChatColor.RESET + " DR: " + ChatColor.GOLD + getDiseaseResist() + ChatColor.RESET + " PR: " + ChatColor.GOLD + getPoisonResist() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- skillmodtype: " + ChatColor.GOLD + getSkillModType().toString() + ChatColor.RESET + " skillmodvalue: " + ChatColor.GOLD + getSkillModValue() + ChatColor.RESET);
    sender.sendMessage("- skillmodtype2: " + ChatColor.GOLD + getSkillModType2().toString() + ChatColor.RESET + " skillmodvalue2: " + ChatColor.GOLD + getSkillModValue2() + ChatColor.RESET);
    sender.sendMessage("- skillmodtype3: " + ChatColor.GOLD + getSkillModType3().toString() + ChatColor.RESET + " skillmodvalue3: " + ChatColor.GOLD + getSkillModValue3() + ChatColor.RESET);
    sender.sendMessage("- skillmodtype4: " + ChatColor.GOLD + getSkillModType4().toString() + ChatColor.RESET + " skillmodvalue4: " + ChatColor.GOLD + getSkillModValue4() + ChatColor.RESET);
    sender.sendMessage("----------------------------");
    sender.sendMessage("- equipmentslot: " + ChatColor.GOLD + getEquipmentSlot().name() + ChatColor.RESET + " itemtype: " + ChatColor.GOLD + getItemType().name() + ChatColor.RESET);
    sender.sendMessage("- identifymessage: " + ChatColor.GOLD + getIdentifyMessage() + ChatColor.RESET);
    sender.sendMessage("- makeshotzone: " + ChatColor.GOLD + this.isMakesHotzone() + ChatColor.RESET + " bookauthor: " + ChatColor.GOLD + getBookAuthor() + ChatColor.RESET);
    String allowedClassNames = "";
    for (String classname : this.getAllowedClassNamesUpper()) {
        allowedClassNames += classname + ",";
    }
    sender.sendMessage("- allowedclassnames: " + allowedClassNames.trim());
    String allowedRaceNames = "";
    for (String racename : this.getAllowedRaceNamesUpper()) {
        allowedRaceNames += racename + ",";
    }
    sender.sendMessage("- allowedracenames: " + allowedRaceNames.trim());
}
Also used : Color(org.bukkit.Color) ChatColor(net.md_5.bungee.api.ChatColor)

Example 64 with CommandSender

use of net.md_5.bungee.api.CommandSender in project solinia3-core by mixxit.

the class CommandPersonality method sendPersonality.

private void sendPersonality(CommandSender sender, int characterId) {
    try {
        ISoliniaPlayer solPlayer = StateManager.getInstance().getConfigurationManager().getCharacterById(characterId);
        solPlayer.getPersonality();
        sender.sendMessage(ChatColor.GOLD + "IDEALS" + ChatColor.RESET);
        if (solPlayer.getPersonality().getIdealId() > 0) {
            sender.sendMessage("- " + solPlayer.getPersonality().getIdeal().description + " ");
        } else {
            TextComponent tc = new TextComponent();
            tc.setText("- You have no ideal set");
            TextComponent tc2 = new TextComponent();
            tc2.setText(ChatColor.AQUA + "[Click to Select]" + ChatColor.RESET);
            String changetext = "/personality ideal";
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc.addExtra(tc2);
            sender.spigot().sendMessage(tc);
        }
        sender.sendMessage(ChatColor.GOLD + "TRAITS" + ChatColor.RESET);
        if (solPlayer.getPersonality().getFirstTraitId() > 0) {
            sender.sendMessage("- " + solPlayer.getPersonality().getFirstTrait().description + " ");
        } else {
            TextComponent tc = new TextComponent();
            tc.setText("- You have no first trait set");
            TextComponent tc2 = new TextComponent();
            tc2.setText(ChatColor.AQUA + "[Click to Select]" + ChatColor.RESET);
            String changetext = "/personality trait";
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc.addExtra(tc2);
            sender.spigot().sendMessage(tc);
        }
        if (solPlayer.getPersonality().getSecondTraitId() > 0) {
            sender.sendMessage("- " + solPlayer.getPersonality().getSecondTrait().description + " ");
        } else {
            TextComponent tc = new TextComponent();
            tc.setText("- You have no second trait set");
            TextComponent tc2 = new TextComponent();
            tc2.setText(ChatColor.AQUA + "[Click to Select]" + ChatColor.RESET);
            String changetext = "/personality trait";
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc.addExtra(tc2);
            sender.spigot().sendMessage(tc);
        }
        sender.sendMessage(ChatColor.GOLD + "BONDS" + ChatColor.RESET);
        if (solPlayer.getPersonality().getBondId() > 0) {
            sender.sendMessage("- " + solPlayer.getPersonality().getBond().description + " ");
        } else {
            TextComponent tc = new TextComponent();
            tc.setText("- You have no bond set");
            TextComponent tc2 = new TextComponent();
            tc2.setText(ChatColor.AQUA + "[Click to Select]" + ChatColor.RESET);
            String changetext = "/personality bond";
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc.addExtra(tc2);
            sender.spigot().sendMessage(tc);
        }
        sender.sendMessage(ChatColor.GOLD + "FLAWS" + ChatColor.RESET);
        if (solPlayer.getPersonality().getFlawId() > 0) {
            sender.sendMessage("- " + solPlayer.getPersonality().getFlaw().description + " ");
        } else {
            TextComponent tc = new TextComponent();
            tc.setText("- You have no flaw set");
            TextComponent tc2 = new TextComponent();
            tc2.setText(ChatColor.AQUA + "[Click to Select]" + ChatColor.RESET);
            String changetext = "/personality flaw";
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc.addExtra(tc2);
            sender.spigot().sendMessage(tc);
        }
        sender.sendMessage(ChatColor.GOLD + "CUSTOM" + ChatColor.RESET);
        for (String customTrait : solPlayer.getPersonality().getCustomPersonalityTraits()) {
            sender.sendMessage("- " + customTrait);
        }
        sender.sendMessage(ChatColor.GOLD + "BACKSTORY:" + ChatColor.RESET);
        if (solPlayer.getBackStory() != null && !solPlayer.getBackStory().equals("")) {
            sender.sendMessage("- " + solPlayer.getBackStory());
        } else {
            sender.sendMessage("- You have no backstory set - set with /personality backstory <backstory>");
        }
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 65 with CommandSender

use of net.md_5.bungee.api.CommandSender in project solinia3-core by mixxit.

the class CommandPersonality method sendTraitChoices.

public void sendTraitChoices(CommandSender sender) {
    try {
        sender.sendMessage(ChatColor.GOLD + "TRAITS:" + ChatColor.RESET);
        TextComponent tc = new TextComponent();
        tc.setText(ChatColor.AQUA + "[Click-to-Select] " + ChatColor.RESET);
        for (Trait trait : StateManager.getInstance().getConfigurationManager().getTraits()) {
            TextComponent tc2 = new TextComponent();
            int maxLength = 6;
            if (trait.description.length() < 6)
                maxLength = trait.description.length();
            tc2.setText("[" + trait.description.substring(0, maxLength) + "..] ");
            String changetext = "/personality trait " + trait.id;
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(trait.description).create()));
            tc.addExtra(tc2);
        }
        sender.spigot().sendMessage(tc);
    } catch (CoreStateInitException e) {
        sender.sendMessage("Choices are not available right now");
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) Trait(com.solinia.solinia.Models.Trait) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Aggregations

TextComponent (net.md_5.bungee.api.chat.TextComponent)44 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)24 ClickEvent (net.md_5.bungee.api.chat.ClickEvent)23 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)21 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)18 Player (org.bukkit.entity.Player)17 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)15 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)10 CommandSender (net.md_5.bungee.api.CommandSender)9 ArrayList (java.util.ArrayList)7 ChatColor (net.md_5.bungee.api.ChatColor)6 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)6 CommandSender (org.bukkit.command.CommandSender)5 ISoliniaItem (com.solinia.solinia.Interfaces.ISoliniaItem)4 ISoliniaRace (com.solinia.solinia.Interfaces.ISoliniaRace)4 HashMap (java.util.HashMap)4 ISoliniaClass (com.solinia.solinia.Interfaces.ISoliniaClass)3 ChatSender (at.pcgamingfreaks.Bungee.Message.Sender.ChatSender)2 SendMethod (at.pcgamingfreaks.Bungee.Message.Sender.SendMethod)2 CommandHandler (com.Ben12345rocks.AdvancedCore.Objects.CommandHandler)2