Skip to content

38 survey features#47

Open
george112n wants to merge 102 commits intodevelopfrom
38-survey-features
Open

38 survey features#47
george112n wants to merge 102 commits intodevelopfrom
38-survey-features

Conversation

@george112n
Copy link
Member

Added a survey

…eparate and runs after the main network checks.
- When teleporting the region switch didn't activate due to an inverted if-statement.
- Region inactivity was not working correctly due to a invalid config reference.
- Certain gui's would break when switching server failed (for example if the server is offline), the gui is now always closed when switching server, even on fail.
George112n and others added 25 commits February 12, 2026 21:33
…e Network plugin, allowing standalone mode to use features such as Discord and Tab.

Removed the static socket handler.
Split the chat listener, sending and other chat features to prevent circular references.
No longer needs workarounds for standalone mode for joining.
Discord can be used in standalone mode.
Tab can be used in standalone mode.
Focus can be used in standalone mode.
Moderation can be used in standalone mode.
Nick can be used in standalone mode.
Staff chat can be used in standalone mode.
# Conflicts:
#	Network-API/src/main/java/net/bteuk/network/api/PlotAPI.java
#	Plugin/src/main/java/net/bteuk/network/Network.java
#	Plugin/src/main/java/net/bteuk/network/api/impl/PlotAPIImpl.java
#	Plugin/src/main/java/net/bteuk/network/commands/Where.java
#	Plugin/src/main/java/net/bteuk/network/utils/SwitchServer.java
#	Regions/src/main/java/net/bteuk/network/regions/RegionUser.java
#	Regions/src/main/java/net/bteuk/network/regions/listener/AbstractMoveListener.java
#	Regions/src/main/java/net/bteuk/network/regions/listener/RegionMoveListener.java
#	Regions/src/main/java/net/bteuk/network/regions/listener/RegionTeleportListener.java
# Conflicts:
#	Core/pom.xml
#	Network-API/pom.xml
#	PaperCore/pom.xml
#	Plugin/pom.xml
#	Plugin/src/main/java/net/bteuk/network/Network.java
#	Plugin/src/main/java/net/bteuk/network/sql/GlobalSQL.java
#	Regions/pom.xml
#	Regions/src/main/java/net/bteuk/network/regions/listener/RegionMoveListener.java
#	Regions/src/main/java/net/bteuk/network/regions/listener/RegionTeleportListener.java
#	pom.xml
# Conflicts:
#	Core/pom.xml
#	Network-API/pom.xml
#	PaperCore/pom.xml
#	Plugin/pom.xml
#	Regions/pom.xml
#	pom.xml
@george112n george112n self-assigned this Mar 15, 2026
@george112n george112n linked an issue Mar 15, 2026 that may be closed by this pull request
@george112n george112n changed the base branch from main to develop March 15, 2026 19:06
if (args.length == 0) {
SurveyBook.openSurvey(user, globalSQL);
} else if (args.length == 1) {
if (args[0].equalsIgnoreCase("save")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This if could be combined in the above else if.

if (surveyBook == null)
return;

SurveyBook.AnswerOption answerOption = SurveyBook.AnswerOption.valueOf(args[0].toUpperCase());
Copy link
Contributor

Choose a reason for hiding this comment

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

This will throw an exception if a wrong value is used, given that this command can be run by a player this is a realistic scenario.

case Q3_YOUTUBE_LONG -> surveyBook.getSurvey().setBSocialsYoutubeLongform(bYes);
case Q3_INSTAGRAM -> surveyBook.getSurvey().setBSocialsInstagram(bYes);
case CHANGE_PAGE -> {
int toPage = Integer.parseInt(args[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also throw an exception if the command is manually entered.

*/
@AllArgsConstructor
@NoArgsConstructor
public class Survey {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can put @Getter and @Setter annotation at class level.
It would be good practice to make the fields private instead of package private.

.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/survey " + option.name() + " Y"));
if (bYSelected)
component = component.append(Y.decorate(TextDecoration.BOLD).decorate(TextDecoration.UNDERLINED));
else
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer if curly braces were used in cases such as this given that there are multiple lines of code under the else, while only the first is in the 'block', this can be confusing and isn't ideal for reading. There are a few other locations where this has been done.

For the if block it's less of an issue since the else is a good divider, although I'd still advise against it.

user.sendMessage(ChatUtils.success("Thank you! Survey has been saved!"));
}

public enum AnswerOption {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this enum is used outside of the file it is in it would be good practice to create a separate file for it, although in that case with a more descriptive name.

user.player.openBook(books[iCurrentPage]);
}

public void unregister() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is never called, I'd assume it should be when the user disconnects from the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Survey Features

2 participants