Fix Rage mutation, allow players to be forced in ffa, prevent map token usage when restart is queued, and fix console being unable to give tokens
This commit is contained in:
parent
2fc7173f9c
commit
eab711f7ef
|
@ -1,6 +1,5 @@
|
|||
package tc.oc.commons.bukkit.tokens;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import tc.oc.api.bukkit.users.BukkitUserStore;
|
||||
import tc.oc.api.docs.PlayerId;
|
||||
|
|
|
@ -53,3 +53,4 @@ permissions:
|
|||
- tablist.edit
|
||||
- server.visibility
|
||||
- ocn.developer
|
||||
- tokens.give
|
||||
|
|
|
@ -254,6 +254,7 @@ item.locked = This item cannot be removed from its slot
|
|||
stats.hotbar = {0} kills ({1} streak) {2} deaths {3} K/D
|
||||
|
||||
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.tutorialmessage = Use {0}/vote [yes|no] {1}to vote
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import tc.oc.pgm.chat.MatchNameInvalidator;
|
|||
import tc.oc.pgm.chat.MatchUsernameRenderer;
|
||||
import tc.oc.pgm.commands.AdminCommands;
|
||||
import tc.oc.pgm.commands.MatchCommands;
|
||||
import tc.oc.pgm.commands.PollCommands;
|
||||
import tc.oc.pgm.debug.PGMLeakListener;
|
||||
import tc.oc.pgm.development.MapDevelopmentCommands;
|
||||
import tc.oc.pgm.development.MapErrorTracker;
|
||||
|
@ -80,6 +81,7 @@ public final class PGMManifest extends HybridManifest {
|
|||
|
||||
final PluginFacetBinder facets = new PluginFacetBinder(binder());
|
||||
facets.register(AdminCommands.class);
|
||||
facets.register(PollCommands.class);
|
||||
facets.register(MatchNameInvalidator.class);
|
||||
facets.register(MapDevelopmentCommands.class);
|
||||
facets.register(MapErrorTracker.class);
|
||||
|
@ -101,5 +103,6 @@ public final class PGMManifest extends HybridManifest {
|
|||
facets.register(InterfaceListener.class);
|
||||
|
||||
requestStaticInjection(State.class);
|
||||
requestStaticInjection(PollCommands.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import tc.oc.commons.bukkit.tokens.TokenUtil;
|
||||
import tc.oc.commons.core.commands.Commands;
|
||||
import tc.oc.commons.core.formatting.StringUtils;
|
||||
import tc.oc.commons.core.restart.RestartManager;
|
||||
import tc.oc.pgm.PGM;
|
||||
import tc.oc.pgm.map.PGMMap;
|
||||
import tc.oc.pgm.mutation.Mutation;
|
||||
|
@ -25,9 +27,16 @@ import tc.oc.pgm.polls.PollKick;
|
|||
import tc.oc.pgm.polls.PollManager;
|
||||
import tc.oc.pgm.polls.PollMutation;
|
||||
import tc.oc.pgm.polls.PollNextMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static tc.oc.commons.bukkit.commands.CommandUtils.newCommandException;
|
||||
|
||||
public class PollCommands {
|
||||
public class PollCommands implements Commands {
|
||||
|
||||
@Inject
|
||||
private static RestartManager restartManager;
|
||||
|
||||
@Command(
|
||||
aliases = {"poll"},
|
||||
desc = "Poll commands",
|
||||
|
@ -118,6 +127,9 @@ public class PollCommands {
|
|||
)
|
||||
@CommandPermissions("poll.next")
|
||||
public static void pollNext(CommandContext args, CommandSender sender) throws CommandException {
|
||||
if (restartManager.isRestartRequested()) {
|
||||
throw newCommandException(sender, new TranslatableComponent("poll.map.restarting"));
|
||||
}
|
||||
if (PGM.getMatchManager().hasMapSet()) {
|
||||
throw newCommandException(sender, new TranslatableComponent("poll.map.alreadyset"));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package tc.oc.pgm.ffa;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import tc.oc.pgm.PGM;
|
||||
import tc.oc.pgm.commands.CommandUtils;
|
||||
import tc.oc.pgm.match.MatchPlayer;
|
||||
import tc.oc.pgm.teams.Team;
|
||||
|
||||
public class FreeForAllCommands {
|
||||
private FreeForAllCommands() {}
|
||||
|
@ -72,4 +71,18 @@ public class FreeForAllCommands {
|
|||
ChatColor.WHITE + " and overfill is " + ChatColor.AQUA + ffa.getMaxOverfill());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"force"},
|
||||
desc = "Force a player to participate in the match.",
|
||||
usage = "<player>",
|
||||
min = 1,
|
||||
max = 2
|
||||
)
|
||||
@CommandPermissions("pgm.team.force")
|
||||
public static void force(CommandContext args, CommandSender sender) throws CommandException, SuggestException {
|
||||
MatchPlayer player = CommandUtils.findSingleMatchPlayer(args, sender, 0);
|
||||
FreeForAllMatchModule ffa = CommandUtils.getMatchModule(FreeForAllMatchModule.class, sender);
|
||||
ffa.forceJoin(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,32 @@
|
|||
package tc.oc.pgm.mutation.types.other;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import tc.oc.commons.bukkit.item.ItemUtils;
|
||||
import tc.oc.pgm.match.Match;
|
||||
import tc.oc.pgm.mutation.types.MutationModule;
|
||||
import tc.oc.pgm.rage.RageMatchModule;
|
||||
|
||||
public class RageMutation extends MutationModule.Impl {
|
||||
|
||||
RageMatchModule rage;
|
||||
|
||||
public RageMutation(Match match) {
|
||||
super(match);
|
||||
this.rage = match.module(RageMatchModule.class).orElse(new RageMatchModule(match));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerDamage(EntityDamageByEntityEvent event) {
|
||||
rage.handlePlayerDamage(event);
|
||||
if(event.getDamager() instanceof Player && ItemUtils.isWeapon(((Player) event.getDamager()).getItemInHand())) {
|
||||
event.setDamage(1000);
|
||||
} else if(event.getDamager() instanceof Arrow && ((Arrow) event.getDamager()).getShooter() instanceof Player) {
|
||||
event.setDamage(1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
super.disable();
|
||||
rage = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PollListener implements Listener {
|
|||
event.getPoll().executeAction();
|
||||
} else {
|
||||
match.sendMessage(Poll.normalize + "The poll " + event.getPoll().getDescriptionMessage()
|
||||
+ Poll.normalize + " has failed" + Poll.seperator + event.getPoll().formatForAgainst());
|
||||
+ Poll.normalize + " has failed" + Poll.seperator);
|
||||
match.sendMessage(event.getPoll().formatForAgainst());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue