public void gameStart(CommandContext context) { if (UserManager.getInstance().getUser(context.asPlayer().getUniqueId()) .orElseThrow(() -> new RuntimeException("An offline player executed a command.")).getParticipation() != Participation.ADMIN) { context.send(colour("&cInsufficient permissions.")); return; } if (!(context.getSender() instanceof Player)) { context.send(colour("&cThis command is only accessible for players.")); return; } if (GameState.current() != GameState.LOBBY) { context.send(colour("&cAlready started.")); return; } GameState.setGameWorld(((Player) context.getSender()).getWorld()); GameState.STARTING.setCurrent(); MainConfiguration configuration = UHC.getInstance().getMainConfig(); int time = configuration.getWorldBorderShrinkTime(); int size = configuration.getWorldBorderFinalShrinkSize(); List<String> toSend = Arrays.asList( "&e---[ And the game begins! ]---", "&bThere'll be a 10 minute grace period.", "&bAttacking other players during that period is illegal.", "&bThe world border will shrink for " + time + "min, until it is " + size + "x" + size + ".", "&bCheck the rules by doing &a/rules&b."); Bukkit.getServer().getOnlinePlayers().forEach(player -> { toSend.forEach(curs -> player.sendMessage(UHC.getInstance().getFormatter().centerString(colour(curs)))); player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BASEDRUM, SoundCategory.MASTER, 1f, 1f); }); }
@Override public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) { if (location == null || sound == null) { return; } cn.nukkit.level.sound.Sound nukkitSound = PokkitSound.toNukkit(location, sound, pitch); if (nukkitSound == null) { return; } nukkit.level.addSound(nukkitSound, nukkit); }
@Override public void playSound(Location location, String soundString, SoundCategory category, float volume, float pitch) { if (location == null || soundString == null) { return; } try { Sound sound = Sound.valueOf(soundString.replace("minecraft:", "").toUpperCase()); playSound(location, sound, volume, pitch); } catch (IllegalArgumentException e) { // Ignore non-existing sound } }
@Override public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) { TaskManager.IMP.sync(new RunnableVal<Object>() { @Override public void run(Object value) { parent.playSound(location, sound, category, volume, pitch); } }); }
@Override public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) { TaskManager.IMP.sync(new RunnableVal<Object>() { @Override public void run(Object value) { parent.playSound(location, sound, category, volume, pitch); } }); }
public PlaysoundEvent(Instruction instruction) throws InstructionParseException { super(instruction); sound = instruction.next(); location = instruction.getLocation(instruction.getOptional("location")); String category = instruction.getOptional("category"); if (category != null) { soundCategoty = instruction.getEnum(category, SoundCategory.class); } else { soundCategoty = SoundCategory.MASTER; } volume = (float) instruction.getDouble(instruction.getOptional("volume"), 1D); pitch = (float) instruction.getDouble(instruction.getOptional("pitch"), 1D); }
@Override public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
@Override public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
@Override public void stopSound(Sound sound, SoundCategory category) { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
@Override public void stopSound(String sound, SoundCategory category) { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
public SoundHolder(Sound sound, SoundCategory category, float volume, float pitch) { this.sound = sound; this.category = category; this.volume = volume; this.pitch = pitch; }
public SoundHolder(Sound sound, float volume, float pitch) { this(sound, SoundCategory.MASTER, volume, pitch); }
public SoundCategory getCategory() { return category; }
public void setCategory(SoundCategory category) { this.category = category; }
@Override public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) { // TODO Auto-generated method stub }
@Override public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) { // TODO Auto-generated method stub }
@Override public void playSound(Location location, Sound sound, float volume, float pitch) { playSound(location, sound, SoundCategory.NEUTRAL, volume, pitch); }
@Override public void playSound(Location location, String soundString, float volume, float pitch) { playSound(location, soundString, SoundCategory.NEUTRAL, volume, pitch); }
@Override public void stopSound(Sound sound, SoundCategory category) { // Silently unsupported! }
@Override public void stopSound(String sound, SoundCategory category) { // Silently unsupported! }
@Override public void playSound(Location arg0, Sound arg1, SoundCategory arg2, float arg3, float arg4) { throw new UnsupportedOperationException(); }
@Override public void playSound(Location arg0, String arg1, SoundCategory arg2, float arg3, float arg4) { throw new UnsupportedOperationException(); }
@Override public void stopSound(Sound arg0, SoundCategory arg1) { throw new UnsupportedOperationException(); }
@Override public void stopSound(String arg0, SoundCategory arg1) { throw new UnsupportedOperationException(); }
@Override public void playSound(Location arg0, Sound arg1, SoundCategory arg2, float arg3, float arg4) { }
@Override public void playSound(Location arg0, String arg1, SoundCategory arg2, float arg3, float arg4) { }
@Override public void stopSound(Sound arg0, SoundCategory arg1) { }
@Override public void stopSound(String arg0, SoundCategory arg1) { }