add coinflip command, add mvp to config, prevent maps with too few player slots from being polled
This commit is contained in:
parent
d3dd613b7e
commit
0a994a78e9
|
@ -6,6 +6,7 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
|||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -37,6 +38,22 @@ public class MiscCommands implements Commands {
|
|||
this.identityProvider = identityProvider;
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "coinflip" },
|
||||
desc = "Flip a Coin",
|
||||
flags = "b",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("coinflip")
|
||||
public void coinFlip(final CommandContext args, final CommandSender sender) throws CommandException {
|
||||
if (args.hasFlag('b')) {
|
||||
Bukkit.broadcastMessage(ChatColor.AQUA + (Math.random() < 0.5 ? "Heads" : "Tails"));
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.AQUA + (Math.random() < 0.5 ? "Heads" : "Tails"));
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "sudo" },
|
||||
usage = "<player> [command... (rand|mode|near|color|*)=value]",
|
||||
|
|
|
@ -263,6 +263,7 @@ poll.disabled = Polls are disabled on this server!
|
|||
poll.map.alreadyset = A map has already been set!
|
||||
poll.map.restarting = You cannot set a map because a restart is queued!
|
||||
poll.map.notallowed = You are not allowed to set that map!
|
||||
poll.map.toomanyplayers = There are too many players online to set that map!
|
||||
poll.tutorialmessage = Use {0}/vote [yes|no] {1}to vote
|
||||
|
||||
announce.online = Announced server as online
|
||||
|
|
|
@ -30,6 +30,12 @@ public class Config {
|
|||
return getConfiguration().getInt("minimum-players", 1);
|
||||
}
|
||||
|
||||
public static class MVP {
|
||||
public static boolean enabled() {
|
||||
return getConfiguration().getBoolean("mvp.enabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Token {
|
||||
public static boolean enabled() {
|
||||
return getConfiguration().getBoolean("tokens.enabled", true);
|
||||
|
|
|
@ -160,6 +160,10 @@ public class PollCommands implements Commands {
|
|||
throw newCommandException(sender, new TranslatableComponent("poll.map.notallowed"));
|
||||
}
|
||||
|
||||
if (PGM.get().getServer().getOnlinePlayers().size() * 4 / 5 > nextMap.getDocument().max_players()) {
|
||||
throw newCommandException(sender, new TranslatableComponent("poll.map.toomanyplayers"));
|
||||
}
|
||||
|
||||
startPoll(new PollNextMap(PGM.getPollManager(), Bukkit.getServer(), sender, initiator.getName(), PGM.getMatchManager(), nextMap));
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class HighlightListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void matchEnd(MatchEndEvent event) {
|
||||
if (Config.MVP.enabled()) {
|
||||
StatsUserFacet bestPlayerStats = null;
|
||||
MatchPlayer bestPlayer = null;
|
||||
double bestPlayerPoints = 0;
|
||||
|
@ -101,3 +102,4 @@ public class HighlightListener implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class TokenListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void handleMatchEndEvent(final MatchEndEvent event) {
|
||||
if (Config.Token.enabled()) {
|
||||
Match match = event.getMatch();
|
||||
//use the same playtime rules as raindrops
|
||||
boolean applyCutoff = Comparables.greaterThan(match.getLength(), RaindropConstants.TEAM_REWARD_CUTOFF);
|
||||
|
@ -74,3 +75,4 @@ public class TokenListener implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,9 @@ tokens:
|
|||
losing-chance: 0.001
|
||||
sn-chance: 0.25
|
||||
|
||||
mvp:
|
||||
enabled: true
|
||||
|
||||
poll:
|
||||
enabled: true
|
||||
maps:
|
||||
|
|
Loading…
Reference in New Issue