Search in sources :

Example 1 with TextInput

use of com.earth2me.essentials.textreader.TextInput in project Essentials by drtshock.

the class Commandrules method run.

@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
    if (sender.isPlayer()) {
        ess.getUser(sender.getPlayer()).setDisplayNick();
    }
    final IText input = new TextInput(sender, "rules", true, ess);
    final IText output = new KeywordReplacer(input, sender, ess);
    final TextPager pager = new TextPager(output);
    pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender);
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) TextPager(com.earth2me.essentials.textreader.TextPager) IText(com.earth2me.essentials.textreader.IText) TextInput(com.earth2me.essentials.textreader.TextInput)

Example 2 with TextInput

use of com.earth2me.essentials.textreader.TextInput in project Essentials by drtshock.

the class Commandcustomtext method run.

@Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
    if (sender.isPlayer()) {
        ess.getUser(sender.getPlayer()).setDisplayNick();
    }
    final IText input = new TextInput(sender, "custom", true, ess);
    final IText output = new KeywordReplacer(input, sender, ess);
    final TextPager pager = new TextPager(output);
    String chapter = commandLabel;
    String page;
    if (commandLabel.equalsIgnoreCase("customtext") && args.length > 0 && !NumberUtil.isInt(commandLabel)) {
        chapter = args[0];
        page = args.length > 1 ? args[1] : null;
    } else {
        page = args.length > 0 ? args[0] : null;
    }
    pager.showPage(chapter, page, null, sender);
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) TextPager(com.earth2me.essentials.textreader.TextPager) IText(com.earth2me.essentials.textreader.IText) TextInput(com.earth2me.essentials.textreader.TextInput)

Example 3 with TextInput

use of com.earth2me.essentials.textreader.TextInput in project Essentials by EssentialsX.

the class SignInfo method onSignInteract.

@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
    final Trade charge = getTrade(sign, 3, ess);
    charge.isAffordableFor(player);
    String chapter = sign.getLine(1);
    String page = sign.getLine(2);
    final IText input;
    try {
        player.setDisplayNick();
        input = new TextInput(player.getSource(), "info", true, ess);
        final IText output = new KeywordReplacer(input, player.getSource(), ess);
        final TextPager pager = new TextPager(output);
        pager.showPage(chapter, page, null, player.getSource());
    } catch (IOException ex) {
        throw new SignException(ex.getMessage(), ex);
    }
    charge.charge(player);
    Trade.log("Sign", "Info", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
    return true;
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) Trade(com.earth2me.essentials.Trade) TextPager(com.earth2me.essentials.textreader.TextPager) IText(com.earth2me.essentials.textreader.IText) IOException(java.io.IOException) TextInput(com.earth2me.essentials.textreader.TextInput)

Example 4 with TextInput

use of com.earth2me.essentials.textreader.TextInput in project Essentials by EssentialsX.

the class Commandrules method run.

@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
    if (sender.isPlayer()) {
        ess.getUser(sender.getPlayer()).setDisplayNick();
    }
    final IText input = new TextInput(sender, "rules", true, ess);
    final IText output = new KeywordReplacer(input, sender, ess);
    final TextPager pager = new TextPager(output);
    pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender);
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) TextPager(com.earth2me.essentials.textreader.TextPager) IText(com.earth2me.essentials.textreader.IText) TextInput(com.earth2me.essentials.textreader.TextInput)

Example 5 with TextInput

use of com.earth2me.essentials.textreader.TextInput in project Essentials by drtshock.

the class SignInfo method onSignInteract.

@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
    final Trade charge = getTrade(sign, 3, ess);
    charge.isAffordableFor(player);
    String chapter = sign.getLine(1);
    String page = sign.getLine(2);
    final IText input;
    try {
        player.setDisplayNick();
        input = new TextInput(player.getSource(), "info", true, ess);
        final IText output = new KeywordReplacer(input, player.getSource(), ess);
        final TextPager pager = new TextPager(output);
        pager.showPage(chapter, page, null, player.getSource());
    } catch (IOException ex) {
        throw new SignException(ex.getMessage(), ex);
    }
    charge.charge(player);
    Trade.log("Sign", "Info", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
    return true;
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) Trade(com.earth2me.essentials.Trade) TextPager(com.earth2me.essentials.textreader.TextPager) IText(com.earth2me.essentials.textreader.IText) IOException(java.io.IOException) TextInput(com.earth2me.essentials.textreader.TextInput)

Aggregations

IText (com.earth2me.essentials.textreader.IText)12 KeywordReplacer (com.earth2me.essentials.textreader.KeywordReplacer)12 TextInput (com.earth2me.essentials.textreader.TextInput)12 TextPager (com.earth2me.essentials.textreader.TextPager)12 IOException (java.io.IOException)4 Trade (com.earth2me.essentials.Trade)2 Player (org.bukkit.entity.Player)2