-
Notifications
You must be signed in to change notification settings - Fork 0
38 survey features #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
george112n
wants to merge
104
commits into
develop
Choose a base branch
from
38-survey-features
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
36c58cf
Adding a NetworkAPI module for external plugins to access the Network…
LM-Wolfert 277302c
Expanding api and started splitting off regions.
LM-Wolfert ff7d818
Started splitting movement listener in network and region, reworked c…
LM-Wolfert 0eb59ea
Split the movement and teleport listener, region code is completely s…
LM-Wolfert 83fb302
More progress fixing stuff for new structure.
LM-Wolfert 7411a7b
Timer API and region user adding/removing.
LM-Wolfert 3748be8
Rework command manager, migrating commands.
LM-Wolfert b58d070
Converting more commands.
LM-Wolfert b6bf5ba
distance includes y, so use custom distance
LM-Wolfert 31a88a6
Completed command migration.
LM-Wolfert a21f0a1
Migrate event manager.
LM-Wolfert c401f3f
Started gui migration, added BTEUKLIB as gui manager.
LM-Wolfert 03a4ef7
Migrated all plot system gui's.
LM-Wolfert a250872
Migrated all region and staff gui's.
LM-Wolfert fdd81ed
Finished migrating the gui's.
LM-Wolfert 154b287
Fix remaining compiler errors, commented out code that is unused/broken.
LM-Wolfert 3643672
Update version, regions only use plotAPI if plot system is enabled.
LM-Wolfert 536e1b6
Fixing issues.
LM-Wolfert 84133c3
Making sure region related functions are only used if enabled in config.
LM-Wolfert d2e9fa1
Bug fixes:
LM-Wolfert acb9218
Bug fixes: order of initialisation, took SocketHandler out of CustomC…
LM-Wolfert 650ce86
Update t-- to 1.21.4 release version, no longer requiring custom bteu…
LM-Wolfert 6660906
Add registerEvent to the EventAPI to allow other plugins to use the e…
LM-Wolfert e23f8e6
PlotAPI expansion and publish javadocs.
LM-Wolfert e48dac8
Move some plotsystem stuff to API to make is accessible.
LM-Wolfert be2de40
Network impl of getEventAPI
LM-Wolfert 0ad912b
Expand API for plotsystem.
LM-Wolfert fae3957
Fix compiler error.
LM-Wolfert a5af8bd
More plot system api methods.
LM-Wolfert cd774e4
More plot system api methods.
LM-Wolfert 653ed8c
Impl
LM-Wolfert faa7ec0
Removed type column from events.
LM-Wolfert f9d9426
More api methods.
LM-Wolfert 4cb0a3c
Expand plotAPI added implementation for all plot api methods.
LM-Wolfert 66ae8e9
More API
LM-Wolfert 9cc10b0
Some more API and fixed plotsystem events.
LM-Wolfert 0031bb7
Some more plot api methods.
LM-Wolfert a195adc
Only use PlotAPI in api, not PlotSQL.
LM-Wolfert 209469c
Fix compiler errors.
LM-Wolfert 96f5dce
RoleAPI for the plotsystem.
LM-Wolfert 0e7609f
Send discord message in ChatAPI
LM-Wolfert b2bca83
Naming convention API
LM-Wolfert 99dfad6
More PlotAPI methods for verification.
LM-Wolfert 0c82879
PlotAPI methods for inactivity.
LM-Wolfert dc37a50
Small fixes and gui improvements.
LM-Wolfert 7542ab2
Region menu button should still show in the plotsystem.
LM-Wolfert 82ce283
Fix sql query bug.
LM-Wolfert d38e47f
Fixed some events still using the old format.
LM-Wolfert 68692b8
Fixed tips and lobby portal timer interval.
LM-Wolfert b5a2c63
Fixed issue with review button in staff menu not working and issue wi…
LM-Wolfert 0fce990
When teleporting to a player check if they are online, so if they hav…
LM-Wolfert 1c7147a
Fix SQL query to get plot reviewer.
LM-Wolfert c9f7440
Fix SQL query for feedback book reviewer.
LM-Wolfert ec92fc8
Make timer delay in milliseconds instead of ticks.
LM-Wolfert 8952f4c
Also update the display name on the player.
LM-Wolfert fca33ec
/nick to change displayname (except in direct messages)
LM-Wolfert af91051
Default displayname always white, added tabcompleter for reset.
LM-Wolfert af22010
Add /nick reset <name> for mods to reset the nickname of another player.
LM-Wolfert 2dafaa9
Bugfixes and tabcompleter for /nick reset
LM-Wolfert 4632f80
Add provisions to allow more configuration of who can claim regions, …
2634579
Bugfix with updating feedback while verifying a plot.
LM-Wolfert 61ac8e9
Socket Handler changes to fix bugs in standalone mode.
bbed462
If in standalone mode, now calls to create a new user if not already …
c6e47f5
Now allows for opening of the tutorial gui even if no tutorial server…
f70a0b8
Fixes to remove 'starter tutorial redo' and 'next tutorial' options f…
5426724
Fix to conditional statement so that /st will always open the staff m…
75f7af9
Merge remote-tracking branch 'origin/feature/modular' into feature/mo…
e1f1692
Set command preprocess priority to low as a workaround for a T+- bug,…
LM-Wolfert dbbf42b
Merge remote-tracking branch 'main/feature/modular' into feature/modular
LM-Wolfert a65c87d
Reorder Connect, Chat and RegionManager initialisation to ensure corr…
ab0f599
Merge remote-tracking branch 'origin/feature/modular' into feature/mo…
b4bd736
Add standalone getter to NetworkAPI, so that Plotsystem or other plug…
1f6850a
Fix parent version
f0f05af
Remove the duplicate 'locationExists/hasLocation'
b1214f3
Fix for switch server - now serverAPI is enabled to maintain compatib…
be9f903
Fix to allow /where in Plot world under single-server plotsystem setup.
63682e1
Fix the registering of new region entered, and fix the handling of of…
a5e4a07
Fix return button in verified review menu not showing if you have nev…
LM-Wolfert 646f2cd
In standalone mode proxy functionality will be handled directly by th…
LM-Wolfert d2dc85c
Fix head in tab and enable chat listener.
LM-Wolfert 89b529a
Merge remote-tracking branch 'origin/develop' into feature/modular
7731d6c
Merge remote-tracking branch 'main/feature/modular' into feature/stan…
LM-Wolfert 220bd26
Update dependencies and update jitpack to only build the api module.
LM-Wolfert 9569bd7
Update jitpack to include papercore.
LM-Wolfert 6e05eb3
Fix database query in plot api.
LM-Wolfert 9b5a723
#38 Added Survey feature
c70c800
Add DB insert pathway mechanism for new surveys
f82895e
Update plugin version to 1.10.0
39fb2b1
Update config version to 1.10.0
1fff228
Bug fixes and added underline to selection
f98f350
SQL bug fixes
9d6aa09
Remove unneeded components
f803b0f
Remove all listener logic and associated components
b65b9dd
Remove all listener logic and associated components
5830ee4
Merge remote-tracking branch 'origin/38-survey-features' into 38-surv…
b3f231f
Implemented a custom page changing mechanism in order to maintain pag…
3e38fcc
Changed menu item slightly
131a0bf
Reformatting based on code standards
60a25a6
Say thank you after saving
cae148b
Merge branch 'develop' into 38-survey-features
4483ceb
Merge remote-tracking branch 'origin/develop' into 38-survey-features
1f7c7c7
Fix building command initialisation again
b6400d6
Changes after review
a1e3540
Move the AnswerOption enum outside of the SurveyBook class
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
Plugin/src/main/java/net/bteuk/network/commands/Survey.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| package net.bteuk.network.commands; | ||
|
|
||
| import io.papermc.paper.command.brigadier.CommandSourceStack; | ||
| import lombok.extern.java.Log; | ||
| import net.bteuk.network.CustomChat; | ||
| import net.bteuk.network.Network; | ||
| import net.bteuk.network.core.Time; | ||
| import net.bteuk.network.lib.dto.UserUpdate; | ||
| import net.bteuk.network.lib.utils.ChatUtils; | ||
| import net.bteuk.network.socket.MessageSender; | ||
| import net.bteuk.network.sql.GlobalSQL; | ||
| import net.bteuk.network.survey.SurveyAnswerOption; | ||
| import net.bteuk.network.survey.SurveyBook; | ||
| import net.bteuk.network.utils.NetworkUser; | ||
| import org.bukkit.entity.Player; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| import java.util.logging.Level; | ||
|
|
||
| @Log | ||
| public class Survey extends AbstractCommand { | ||
|
|
||
| private final Network instance; | ||
| private final GlobalSQL globalSQL; | ||
|
|
||
| public Survey(Network instance, GlobalSQL globalSQL) { | ||
| this.instance = instance; | ||
| this.globalSQL = globalSQL; | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(@NotNull CommandSourceStack stack, String @NonNull [] args) { | ||
|
|
||
| // Check if the sender is a player. | ||
| Player player = getPlayer(stack); | ||
| if (player == null) { | ||
| return; | ||
| } | ||
|
|
||
| NetworkUser user = instance.getUser(player); | ||
|
|
||
| // If u is null, cancel. | ||
| if (user == null) { | ||
| log.severe("User " + player.getName() + " can not be found!"); | ||
| player.sendMessage(ChatUtils.error("User can not be found, please relog!")); | ||
| return; | ||
| } | ||
|
|
||
| if (args.length == 0) { | ||
| SurveyBook.openSurvey(user, globalSQL); | ||
| } else if (args.length == 1 && args[0].equalsIgnoreCase("save")) { | ||
| SurveyBook surveyBook = SurveyBook.getOpenSurvey(user); | ||
| if (surveyBook != null) { | ||
| surveyBook.saveSurvey(); | ||
| } | ||
| } else if (args.length == 2) { | ||
| SurveyBook surveyBook = SurveyBook.getOpenSurvey(user); | ||
| if (surveyBook == null) | ||
| return; | ||
|
|
||
| SurveyAnswerOption answerOption; | ||
|
|
||
| try { | ||
| answerOption = SurveyAnswerOption.valueOf(args[0].toUpperCase()); | ||
| } | ||
| catch (IllegalArgumentException e) { | ||
| log.log(Level.WARNING, "Invalid answer option at command survey: " + args[0], e); | ||
| return; | ||
| } | ||
|
|
||
| boolean bYes = args[1].equals("Y"); | ||
| switch (answerOption) { | ||
| case Q1_BTUK -> surveyBook.getSurvey().setBFoundViaBTUK(bYes); | ||
| case Q1_BTE -> surveyBook.getSurvey().setBFoundViaBTE(bYes); | ||
| case Q1_BTUK_EXTERNAL -> surveyBook.getSurvey().setBFoundViaBTUKExternal(bYes); | ||
| case Q1_BTE_EXTERNAL -> surveyBook.getSurvey().setBFoundViaBTEExternal(bYes); | ||
| case Q1_FRIEND -> surveyBook.getSurvey().setBFoundViaFriend(bYes); | ||
| case Q2_TIKTOK -> surveyBook.getSurvey().setBMediumTiktok(bYes); | ||
| case Q2_YT_SHORT -> surveyBook.getSurvey().setBMediumYoutubeShorts(bYes); | ||
| case Q2_YT_LONG -> surveyBook.getSurvey().setBMediumYoutubeLongform(bYes); | ||
| case Q2_INSTAGRAM -> surveyBook.getSurvey().setBMediumInstagram(bYes); | ||
| case Q2_SEARCH -> surveyBook.getSurvey().setBSearchEngineBrowsing(bYes); | ||
| case Q2_ONLINE_NEWS -> surveyBook.getSurvey().setBOnlineNews(bYes); | ||
| case Q2_TV_NEWS -> surveyBook.getSurvey().setBTVNews(bYes); | ||
| case Q2_NEWSPAPER -> surveyBook.getSurvey().setBPhysicalNewspaper(bYes); | ||
| case Q3_TIKTOK -> surveyBook.getSurvey().setBSocialsTiktok(bYes); | ||
| case Q3_YOUTUBE_SHORTS -> surveyBook.getSurvey().setBSocialsYoutubeShorts(bYes); | ||
| case Q3_YOUTUBE_LONG -> surveyBook.getSurvey().setBSocialsYoutubeLongform(bYes); | ||
| case Q3_INSTAGRAM -> surveyBook.getSurvey().setBSocialsInstagram(bYes); | ||
| case CHANGE_PAGE -> { | ||
| try { | ||
| int toPage = Integer.parseInt(args[1]); | ||
| surveyBook.changePage(toPage); | ||
| } | ||
| catch (NumberFormatException e) { | ||
| log.log(Level.WARNING, "Invalid page number: " + args[1], e); | ||
| } | ||
| } | ||
| } | ||
| surveyBook.updateSurveyBooks(); | ||
| surveyBook.openCurrentPage(); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String getLabel() { | ||
| return "survey"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getDescription() { | ||
| return "Complete the UK Survey"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package net.bteuk.network.survey; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.Setter; | ||
|
|
||
| import java.sql.Timestamp; | ||
|
|
||
| /** | ||
| * Stores survey answers | ||
| */ | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| @Getter | ||
| @Setter | ||
| public class Survey { | ||
| private boolean isExisting; | ||
|
|
||
| Timestamp SurveyCompleted; | ||
| Timestamp SurveyLastEdited; | ||
| boolean bFoundViaBTUK; | ||
| boolean bFoundViaBTE; | ||
| boolean bFoundViaBTUKExternal; | ||
| boolean bFoundViaBTEExternal; | ||
| boolean bFoundViaFriend; | ||
|
|
||
| boolean bMediumTiktok; | ||
| boolean bMediumYoutubeShorts; | ||
| boolean bMediumYoutubeLongform; | ||
| boolean bMediumInstagram; | ||
| boolean bSearchEngineBrowsing; | ||
| boolean bOnlineNews; | ||
| boolean bTVNews; | ||
| boolean bPhysicalNewspaper; | ||
|
|
||
| boolean bSocialsTiktok; | ||
| boolean bSocialsYoutubeShorts; | ||
| boolean bSocialsYoutubeLongform; | ||
| boolean bSocialsInstagram; | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
Plugin/src/main/java/net/bteuk/network/survey/SurveyAnswerOption.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package net.bteuk.network.survey; | ||
|
|
||
| public enum SurveyAnswerOption { | ||
| Q1_BTUK, | ||
| Q1_BTE, | ||
| Q1_BTUK_EXTERNAL, | ||
| Q1_BTE_EXTERNAL, | ||
| Q1_FRIEND, | ||
| Q2_TIKTOK, | ||
| Q2_YT_SHORT, | ||
| Q2_YT_LONG, | ||
| Q2_INSTAGRAM, | ||
| Q2_SEARCH, | ||
| Q2_ONLINE_NEWS, | ||
| Q2_TV_NEWS, | ||
| Q2_NEWSPAPER, | ||
| Q3_TIKTOK, | ||
| Q3_YOUTUBE_SHORTS, | ||
| Q3_YOUTUBE_LONG, | ||
| Q3_INSTAGRAM, | ||
| CHANGE_PAGE | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.