Skip to content
This repository was archived by the owner on Nov 25, 2019. It is now read-only.

Cleanup polls code #67

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ac68036
Cleanup polls code
cswhite2000 Jan 7, 2018
7081fe7
More cleanup of the polls code
cswhite2000 Jan 7, 2018
97fa414
Make PollKick use an off record punishment
cswhite2000 Jan 7, 2018
a38db72
fix compilation error
cswhite2000 Jan 8, 2018
3c74a30
Fix name not showing up correctly in PollKick
cswhite2000 Jan 8, 2018
01173c4
Improve polls some more
cswhite2000 Jan 25, 2018
88b1b43
Reduce max players on the bungee
Electroid Jul 28, 2018
fd60b83
Fix players moving lobby minecarts
AustinLMayes Aug 20, 2018
d6f82e1
Minor legacy flag fixes and fix extra quotes in chat
ShinyDialga Jul 27, 2018
72b6e3b
Warn players if there are no games
AustinLMayes Aug 19, 2018
ecfa7e1
Fix 1 day holidays
AustinLMayes Aug 19, 2018
aabd320
Make poll votes clickable
AustinLMayes Aug 19, 2018
4a5fdac
Fix poll status messages not showing
cswhite2000 Aug 27, 2018
d55c8b0
Fix portal spam in lobbies
AustinLMayes Aug 29, 2018
f1fb481
Fix staff in observers not being able to read team chat
cswhite2000 Sep 1, 2018
2b97f9d
Make some perms default to false
cswhite2000 Sep 1, 2018
293429f
Fix headless horseman
AustinLMayes Sep 20, 2018
7c710de
Add RepeatingRunnable
AustinLMayes Sep 20, 2018
a01e595
Add vector rotation utils
AustinLMayes Sep 20, 2018
4d39fff
Add ghost gizmo
AustinLMayes Sep 20, 2018
6ac16cc
Generify HalloweenGizmo, add global purchase perm
AustinLMayes Sep 20, 2018
eefbc94
Temporary fix missed assumption in gizmo permissions check
PotatoStealer Sep 24, 2018
3338afa
Temporarily fix double jump
AustinLMayes Oct 12, 2018
a2249f9
Remove zombie hitboxes due to buggy behavior
ShinyDialga Oct 12, 2018
e37fef4
Disable token mutation GUI when polls are diabled
AustinLMayes Oct 22, 2018
4d53d4b
Merge remote-tracking branch 'upstream/master'
AustinLMayes Nov 20, 2018
54026c7
Update polls cleanup
AustinLMayes Nov 21, 2018
ed5f267
Update polls cleanup
AustinLMayes Nov 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ public BaseComponent screen(Punishment punishment) {

parts.addAll(Components.repeat(Components::blank, 3));

parts.add(new Component(new TranslatableComponent("punishment.screen.rules", Links.rulesLink())));

parts.add(new Component(new TranslatableComponent("punishment.screen.appeal", Links.appealLink())));
if (!punishment.off_record()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(punishment.off_record()) {
     // parts.add("off_record");
} else {
     // parts.add("others");
}

parts.add(new Component(new TranslatableComponent("punishment.screen.rules", Links.rulesLink())));

parts.add(new Component(new TranslatableComponent("punishment.screen.appeal", Links.appealLink())));
} else {
parts.add(new Component(new TranslatableComponent("punishment.screen.off_record")));
}
return Components.join(Components.newline(), parts);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package tc.oc.commons.bukkit.tokens;

import com.sk89q.minecraft.util.commands.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import tc.oc.api.bukkit.users.BukkitUserStore;
import tc.oc.api.docs.PlayerId;
import tc.oc.api.users.CreditTokensRequest;
import tc.oc.api.users.UserService;
import tc.oc.commons.bukkit.commands.CommandUtils;
import tc.oc.commons.bukkit.util.SyncPlayerExecutorFactory;
import tc.oc.api.docs.User;

Expand All @@ -23,6 +26,10 @@ public static User getUser(Player player) {
return userStore.getUser(player);
}

public static User getUser(CommandSender sender) throws CommandException {
return getUser(CommandUtils.senderToPlayer(sender));
}

public static void giveMapTokens(PlayerId playerId, int count) {
playerExecutorFactory.queued(playerId).callback(
userService.creditTokens(playerId, CreditTokensRequest.maps(count)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ punishment.screen.SUSPENSION = You were suspended by a staff member {0}
punishment.screen.UNKNOWN = You were issued an unknown punishment by a staff member {0}
punishment.screen.rules = Read our server rules at {0}
punishment.screen.appeal = or contest your punishment at {0}
punishment.screen.off_record = This is not a real punishment
punishment.action.WARN = warned
punishment.action.KICK = kicked
punishment.action.BAN = banned
Expand Down
12 changes: 11 additions & 1 deletion Commons/core/src/main/i18n/templates/pgm/PGMErrors.properties
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,14 @@ rating.lowParticipation = Sorry, you haven't participated in this match enough t
rating.whilePlaying = To rate the map while playing, type {0}
rating.sameRating = You have already rated this map a {0}.

huddle.globalChatDisabled = Global chat is disabled during team huddle
huddle.globalChatDisabled = Global chat is disabled during team huddle

poll.vote.invalidValue = Accepted values: yes|no
poll.noPollRunning = There is currently no poll running!
poll.kick.exempt = You cannot poll kick this player!
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.already.running = Another poll is already running!
10 changes: 5 additions & 5 deletions Commons/core/src/main/i18n/templates/pgm/PGMMessages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ item.locked = This item cannot be removed from its slot

stats.hotbar = {0} kills ({1} streak) {2} deaths {3} K/D

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.vote.for = You have voted for the current poll
poll.vote.against = You have voted against the current poll
poll.tutorialmessage = Use {0}/vote [yes|no] {1}to vote
poll.kick.success = {0} has been kicked!
poll.veto = Poll vetoed by {0}


announce.online = Announced server as online
announce.offline = Announced server as offline
Expand Down
12 changes: 0 additions & 12 deletions PGM/src/main/java/tc/oc/pgm/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ public static double setNextTokenChange() {

}

public static class Poll {
public static Path getPollAbleMapPath() {
Path pollPath = Paths.get(getConfiguration().getString("poll.maps.path", "default.txt"));
if(!pollPath.isAbsolute()) pollPath = PGM.getMatchManager().getPluginDataFolder().resolve(pollPath);
return pollPath;
}

public static boolean enabled() {
return getConfiguration().getBoolean("poll.enabled", true);
}
}

public static class Broadcast {
public static boolean title() {
return getConfiguration().getBoolean("broadcast.title", true);
Expand Down
24 changes: 4 additions & 20 deletions PGM/src/main/java/tc/oc/pgm/PGM.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import tc.oc.api.util.Permissions;
import tc.oc.commons.bukkit.channels.ChannelCommands;
import tc.oc.commons.bukkit.inject.BukkitPluginManifest;
import tc.oc.commons.bukkit.inventory.Slot;
import tc.oc.commons.bukkit.logging.MapdevLogger;
Expand All @@ -20,7 +21,6 @@
import tc.oc.minecraft.logging.BetterRaven;
import tc.oc.pgm.antigrief.CraftingProtect;
import tc.oc.pgm.commands.MapCommands;
import tc.oc.pgm.commands.PollCommands;
import tc.oc.pgm.commands.RotationControlCommands;
import tc.oc.pgm.commands.RotationEditCommands;
import tc.oc.pgm.events.ConfigLoadEvent;
Expand All @@ -38,9 +38,8 @@
import tc.oc.pgm.match.MatchManager;
import tc.oc.pgm.match.MatchPlayer;
import tc.oc.pgm.menu.gui.SettingMenuHelper;
import tc.oc.pgm.pollablemaps.PollableMaps;
import tc.oc.pgm.polls.PollListener;
import tc.oc.pgm.polls.PollManager;
import tc.oc.pgm.polls.PollBlacklist;
import tc.oc.pgm.polls.commands.PollCommands;
import tc.oc.pgm.start.StartCommands;
import tc.oc.pgm.tablist.MatchTabManager;
import tc.oc.pgm.timelimit.TimeLimitCommands;
Expand Down Expand Up @@ -88,18 +87,6 @@ public Logger getRootMapLogger() {
return mapdevLogger;
}

private PollManager pollManager;

public static PollManager getPollManager() {
return pgm == null ? null : pgm.pollManager;
}

private PollableMaps pollableMaps;

public static PollableMaps getPollableMaps() {
return pgm == null ? null : pgm.pollableMaps;
}

public MapLibrary getMapLibrary() {
return mapLibrary;
}
Expand Down Expand Up @@ -136,9 +123,6 @@ public void onEnable() {
return;
}

this.pollManager = new PollManager(this);
this.pollableMaps = new PollableMaps();

this.registerListeners();

// cycle match in 0 ticks so it loads after other plugins are done
Expand Down Expand Up @@ -194,6 +178,7 @@ public void reloadConfig() {

private void setupCommands() {
commands.register(MapCommands.class);
commands.register(ChannelCommands.class);
commands.register(PollCommands.class);
commands.register(RotationEditCommands.RotationEditParent.class);
commands.register(RotationControlCommands.RotationControlParent.class);
Expand All @@ -205,7 +190,6 @@ private void setupCommands() {
}

private void registerListeners() {
this.registerEvents(new PollListener(this.pollManager, this.matchManager));
this.registerEvents(new FormattingListener());
this.registerEvents(new CraftingProtect());
this.registerEvents(new ObjectivesFireworkListener());
Expand Down
5 changes: 2 additions & 3 deletions PGM/src/main/java/tc/oc/pgm/PGMManifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;
Expand All @@ -35,6 +34,7 @@
import tc.oc.pgm.match.MatchPlayerEventRouter;
import tc.oc.pgm.module.MatchModulesManifest;
import tc.oc.pgm.mutation.command.MutationCommands;
import tc.oc.pgm.polls.PollManifest;
import tc.oc.pgm.restart.RestartListener;
import tc.oc.pgm.rotation.DynamicRotationListener;
import tc.oc.pgm.settings.Settings;
Expand Down Expand Up @@ -63,6 +63,7 @@ protected void configure() {
install(new MatchAnalyticsManifest());

install(new ListingManifest());
install(new PollManifest());

bind(MatchManager.class);
bind(MatchLoader.class);
Expand All @@ -82,7 +83,6 @@ protected void configure() {

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);
Expand All @@ -104,7 +104,6 @@ protected void configure() {
facets.register(InterfaceListener.class);

requestStaticInjection(State.class);
requestStaticInjection(PollCommands.class);
requestStaticInjection(MatchFooterTabEntry.class);
}
}
Loading