Java 类org.bukkit.Note 实例源码

项目:QuestManager    文件:Party.java   
public void tellMembers(FancyMessage message) {
    if (leader != null) {
        Player l = leader.getPlayer().getPlayer();
        message.send(l);
        l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
        l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
        l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
    }
    if (members.isEmpty()) {
        return;
    }
    for (QuestPlayer qp : members) {
        if (!qp.getPlayer().isOnline()) {
            continue;
        }
        Player p = qp.getPlayer().getPlayer();
        message.send(qp.getPlayer().getPlayer());
        p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
        p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
        p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
    }
}
项目:Uranium    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:SuperiorCraft    文件:MusicPlayer.java   
public static List<Note> translateMusicFileToNotes(String file, int line) {
    ArrayList<Note> notes = new ArrayList<Note>();
    for (String s : readMusicFile(file).get(line).split(" ")) {
        //System.out.println(s);
        //System.out.println(Integer.valueOf(String.valueOf(s.charAt(1))));
        notes.add(Note.natural(Integer.valueOf(String.valueOf(s.charAt(1))), Tone.valueOf(String.valueOf(s.charAt(0)))));
    }
    return notes;
}
项目:kaosEssentials    文件:Core.java   
@EventHandler
public void getEmerald(PlayerPickupItemEvent e){
    Player p = e.getPlayer();
    String uuid = p.getUniqueId().toString();
    if(e.getItem().getItemStack().getType().equals(Material.EMERALD)){
        e.setCancelled(true);
        int amount = e.getItem().getItemStack().getAmount();
        e.getItem().remove();
        setEmeralds(uuid, getEmeralds(uuid)+amount);
        p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.A));
    }
}
项目:MundoSK    文件:EffPlayNoteBlock.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    noteExpression = (Expression<Note>) expressions[0];
    instrumentExpression = (Expression<Instrument>) expressions[1];
    blockExpression = (Expression<Block>) expressions[2];
    return true;
}
项目:SuperiorCraft    文件:MusicPlayer.java   
public static List<Note> translateMusicFileToNotes(String file, int line) {
    ArrayList<Note> notes = new ArrayList<Note>();
    for (String s : readMusicFile(file).get(line).split(" ")) {
        //System.out.println(s);
        //System.out.println(Integer.valueOf(String.valueOf(s.charAt(1))));
        notes.add(Note.natural(Integer.valueOf(String.valueOf(s.charAt(1))), Tone.valueOf(String.valueOf(s.charAt(0)))));
    }
    return notes;
}
项目:ThermosRebased    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:QuestManager    文件:Compass.java   
public static void updateCompass(QuestPlayer qp, boolean silent) {
    if (!qp.getPlayer().isOnline()) {
        return;
    }

    if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getCompassEnabled()) {
        return;
    }

    if (!hasCompass(qp.getPlayer().getPlayer().getInventory())) {
        return;
    }

    Player player = qp.getPlayer().getPlayer();

    Location targ = qp.getCompassTarget();
    if (targ == null) {
        player.setCompassTarget(player.getWorld().getBlockAt(0, 0, 0).getLocation().add(RESET_VECTOR));
    } else {
        player.setCompassTarget(qp.getCompassTarget());
    }

    if (!silent) {
        player.sendMessage(ChatColor.GRAY + "Your compass has been updated" + ChatColor.RESET);
        player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.E));
        player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.G));
        player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.B));
    }
}
项目:QuestManager    文件:JoinPartyAction.java   
@Override
public void onAction() {
    // TODO Auto-generated method stub
    if (leader.getParty() == null) {
        Party party = leader.createParty();
        other.joinParty(party);
    } else {
        other.joinParty(leader.getParty());
    }
    Player p = other.getPlayer().getPlayer();
    p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
    p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
    p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
}
项目:RpgPlus    文件:Sound.java   
public static Note parseNote(String note) {
    Matcher matcher = NOTE_PARSER.matcher(note.toUpperCase());
    if (matcher.matches()) {
        Note.Tone tone = Note.Tone.valueOf(matcher.group(1));
        boolean sharped = !matcher.group(2).isEmpty();
        int octave = matcher.group(3).length();
        try {
            return new Note(octave, tone, sharped);
        } catch (IllegalArgumentException e) {
            throw new LuaError("Invalid note: " + note + ", " + e.getMessage());
        }
    }
    throw new LuaError("Invalid note: " + note);
}
项目:Thermos    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:KCauldron    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:CauldronGit    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Cauldron-Old    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Cauldron-Reloaded    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:FFoKC    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:CraftBukkit    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:MoneyThief    文件:FanfarePlayer.java   
/**
 * Plays a natural note
 *
 * @param player  player
 * @param tone    note
 * @param octave  octave
 * @param instrum instrument
 * @param delay   delay
 */
public void natural(Player player, Tone tone, int octave, Instrument instrum, long delay) {
    final Player play = player;
    final Instrument inst = instrum;
    final Note note = Note.natural(octave, tone);
    final BukkitScheduler scheduler = MoneyThief.plugin.getServer().getScheduler();
    scheduler.scheduleSyncDelayedTask(MoneyThief.plugin, new Runnable() {

        @Override
        public void run() {
            play.playNote(play.getLocation(), inst, note);
        }

    }, delay);
}
项目:MoneyThief    文件:FanfarePlayer.java   
/**
 * Plays a sharp note
 *
 * @param player  player
 * @param tone    note
 * @param octave  octave
 * @param instrum instrument
 * @param delay   delay
 */
public void sharp(Player player, Tone tone, int octave, Instrument instrum, long delay) {
    final Player play = player;
    final Instrument inst = instrum;
    final Note note = Note.sharp(octave, tone);
    final BukkitScheduler scheduler = MoneyThief.plugin.getServer().getScheduler();
    scheduler.scheduleSyncDelayedTask(MoneyThief.plugin, new Runnable() {

        @Override
        public void run() {
            play.playNote(play.getLocation(), inst, note);
        }

    }, delay);
}
项目:MoneyThief    文件:FanfarePlayer.java   
/**
 * Plays a flat note
 *
 * @param player  player
 * @param tone    note
 * @param octave  octave
 * @param instrum instrument
 * @param delay   delay
 */
public void flat(Player player, Tone tone, int octave, Instrument instrum, long delay) {
    final Player play = player;
    final Instrument inst = instrum;
    final Note note = Note.flat(octave, tone);
    final BukkitScheduler scheduler = MoneyThief.plugin.getServer().getScheduler();
    scheduler.scheduleSyncDelayedTask(MoneyThief.plugin, new Runnable() {

        @Override
        public void run() {
            play.playNote(play.getLocation(), inst, note);
        }

    }, delay);
}
项目:Craftbukkit    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Almura-Server    文件:CraftNoteBlock.java   
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Tweakkit-Server    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Cauldron    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:modules-extra    文件:NoteConverter.java   
@Override
public Note fromNode(Node node) throws ConversionException
{
    if (node instanceof ByteNode)
    {
        return new Note(((ByteNode)node).getValue().intValue());
    }
    throw ConversionException.of(this, node, "Note is not a ByteNode!");
}
项目:Pore    文件:NoteConverter.java   
@SuppressWarnings("deprecation")
public static NotePitch of(Note note) {
    if (note == null) {
        return null;
    }
    return NOTES.get(note.getId());
}
项目:SpigotSource    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:Craft-city    文件:CraftNoteBlock.java   
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:MCPBukkit    文件:CraftNoteBlock.java   
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    synchronized (block) {
        if (block.getType() == Material.NOTE_BLOCK) {
            world.getHandle().func_72965_b(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
            return true;
        } else {
            return false;
        }
    }
}
项目:Uranium    文件:CraftNoteBlock.java   
public Note getNote() {
    return new Note(note.note);
}
项目:Uranium    文件:CraftNoteBlock.java   
public void setNote(Note n) {
    note.note = n.getId();
}
项目:MockBukkit    文件:PlayerMock.java   
@Override
public void playNote(Location loc, Instrument instrument, Note note)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:kaosEssentials    文件:Core.java   
private void pstp(Player p){
    p.playNote(p.getLocation(), Instrument.PIANO, Note.sharp(1, Tone.F));
}
项目:MundoSK    文件:ExprNoteOfBlock.java   
@Override
public void change(Block block, Note note, Changer.ChangeMode changeMode) {
    MundoUtil.cast(block.getState(), NoteBlock.class).ifPresent(noteBlock -> noteBlock.setNote(note));
}
项目:MundoSK    文件:ExprNoteOfBlock.java   
@Override
public Note convert(Block block) {
    return MundoUtil.cast(block.getState(), NoteBlock.class).map(NoteBlock::getNote).orElse(null);
}
项目:ThermosRebased    文件:CraftNoteBlock.java   
public Note getNote() {
    return new Note(note.note);
}
项目:ThermosRebased    文件:CraftNoteBlock.java   
public void setNote(Note n) {
    note.note = n.getId();
}
项目:Thermos-Bukkit    文件:NotePlayEvent.java   
public NotePlayEvent(Block block, Instrument instrument, Note note) {
    super(block);
    this.instrument = instrument;
    this.note = note;
}
项目:Thermos-Bukkit    文件:NotePlayEvent.java   
/**
 * Overrides the {@link Note} to be played.
 *
 * @param note the Note. Has no effect if null.
 */
public void setNote(Note note) {
    if (note != null) {
        this.note = note;
    }
}
项目:QuestManager    文件:PartyInviteAction.java   
@Override
public void onAction() {

    if (!other.getPlayer().isOnline() || !leader.getPlayer().isOnline()) {
        return;
    }

    if (other.getParty() != null) {
        leader.getPlayer().getPlayer().sendMessage(PartyInviteAction.DENY_MESSAGE);
        return;
    }

    if (leader.getPlayer().getUniqueId().equals(other.getPlayer().getUniqueId())) {
        leader.getPlayer().getPlayer().sendMessage(PartyInviteAction.SAME_MESSAGE);
        return;
    }

    MenuAction join = new JoinPartyAction(leader, other);
    ChatMenuOption joinOpt = new ChatMenuOption(new PlainMessage("Accept"), join);
    MenuAction deny = new ShowChatMenuAction(new SimpleChatMenu(
            new FancyMessage(other.getPlayer().getName())
                .color(ChatColor.DARK_BLUE)
                .then(" refused your invitation.")), leader.getPlayer().getPlayer());
    ChatMenuOption denyOpt = new ChatMenuOption(new PlainMessage("Deny"), deny);
    PlainMessage body = new PlainMessage(
            new FancyMessage(leader.getPlayer().getName())
                .color(ChatColor.DARK_BLUE)
                .then(" invited you to join their party!")
            );

    ChatMenu menu = new MultioptionChatMenu(body, joinOpt, denyOpt);

    Player op = other.getPlayer().getPlayer();
    menu.show(op);
    op.playNote(op.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
    op.playNote(op.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
    op.playNote(op.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));

    ChatMenu myMenu = new SimpleChatMenu(new FancyMessage("Your invitation has been sent."));
    myMenu.show(leader.getPlayer().getPlayer());
}