Compare commits

...

2 commits

Author SHA1 Message Date
Telesphoreo 7a614324f2 Fix startup errors 2022-06-05 22:47:06 -05:00
Telesphoreo 831c167153 Update for 1.2 2022-06-05 22:22:54 -05:00
6 changed files with 93 additions and 62 deletions

View file

@ -0,0 +1,49 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Plexus Code Style" version="1">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Plexus Code Style" />
</state>
</component>

View file

@ -9,7 +9,7 @@ For those who are wanting to contribute, we fully encourage doing so. There are
3. Create a new branch that describes the new feature, enhancement, or bug fix. For example, this is good: `feature/add-xyz`. This is bad: `fix-this-lol`.
4. Write the code that addresses your change.
- Keep in mind that it **must** be formatted correctly. If you are using IntelliJ, there is a `codeStyle.xml` file that tells IntelliJ how to format your code. Check this link for information on how to use the file: https://www.jetbrains.com/help/idea/configuring-code-style.html#import-export-schemes
- If you are not using IntelliJ, that is fine. We use Allman style so please format your code accordingly.
- If you are not using IntelliJ, that is fine. We use the Plexus Code Style (which is almost the same as Allman) so please format your code accordingly.
6. Push your changes to your new branch and make a PR based off of that branch.
## Requirements for a PR

View file

@ -19,15 +19,15 @@ dependencies {
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("dev.plex:server:1.1")
compileOnly("dev.plex:api:1.1")
compileOnly("dev.plex:server:1.2-SNAPSHOT")
compileOnly("dev.plex:api:1.2-SNAPSHOT")
compileOnly("dev.morphia.morphia:morphia-core:2.2.6")
compileOnly("org.json:json:20220320")
implementation("org.jetbrains:annotations:23.0.0")
}
group = "dev.plex"
version = "1.1"
version = "1.2-SNAPSHOT"
description = "The Guilds module for Plex"
java {

View file

@ -38,10 +38,10 @@ public class Guilds extends PlexModule
@Override
public void enable()
{
if (getPlex().getStorageType() == StorageType.MONGODB)
if (Plex.get().getStorageType() == StorageType.MONGODB)
{
getPlex().getMongoConnection().getDatastore().getMapper().map(Guild.class);
getPlex().getMongoConnection().getDatastore().ensureIndexes();
Plex.get().getMongoConnection().getDatastore().getMapper().map(Guild.class);
Plex.get().getMongoConnection().getDatastore().ensureIndexes();
}
else
{
@ -55,44 +55,43 @@ public class Guilds extends PlexModule
});
}
this.getPlex().setChatHandler(new ChatHandlerImpl());
Plex.get().setChatHandler(new ChatHandlerImpl());
addDefaultMessage("guildsHelpCommand", "<gradient:gold:yellow>======</gradient>Guild Menu<gradient:gold:yellow>======</gradient><newline><newline>{0}", "0 - The commands list");
addDefaultMessage("guildsCommandDisplay", "<gold>{0} <yellow>{1}", "0 - The command name", "1 - The command description");
addDefaultMessage("guildCommandNotFound", "<red>'<gold>{0}</gold>'<red> is not a valid sub command!", "0 - The sub command");
addDefaultMessage("guildNotFound", "<red>You're currently not a part of a guild!");
addDefaultMessage("guildInThis", "<red>You're currently a part of this guild!");
addDefaultMessage("alreadyInGuild", "<red>You're currently in a guild. Please do <gold>/guild leave<red> if you're a member, or if you're an owner with members, <gold>/guild promote <player><red> then <gold>/guild leave<red>, or just an owner, <gold>/guild disband<red>.");
addDefaultMessage("guildNotOwner", "<red>You're not the owner of this guild!");
addDefaultMessage("guildMemberNotFound", "<red>This guild member could not be found!");
addDefaultMessage("guildOwnerSet", "<green>You have successfully promoted <dark_green>{0}<green> to be the new guild owner. You have been set to a default guild member.");
this.addDefaultMessage("guildsHelpCommand", "<gradient:gold:yellow>======</gradient>Guild Menu<gradient:gold:yellow>======</gradient><newline><newline>{0}", "0 - The commands list");
this.addDefaultMessage("guildsCommandDisplay", "<gold>{0} <yellow>{1}", "0 - The command name", "1 - The command description");
this.addDefaultMessage("guildCommandNotFound", "<red>'<gold>{0}</gold>'<red> is not a valid sub command!", "0 - The sub command");
this.addDefaultMessage("guildNotFound", "<red>You're currently not a part of a guild!");
this.addDefaultMessage("guildInThis", "<red>You're currently a part of this guild!");
this.addDefaultMessage("alreadyInGuild", "<red>You're currently in a guild. Please do <gold>/guild leave<red> if you're a member, or if you're an owner with members, <gold>/guild promote <player><red> then <gold>/guild leave<red>, or just an owner, <gold>/guild disband<red>.");
this.addDefaultMessage("guildNotOwner", "<red>You're not the owner of this guild!");
this.addDefaultMessage("guildMemberNotFound", "<red>This guild member could not be found!");
this.addDefaultMessage("guildOwnerSet", "<green>You have successfully promoted <dark_green>{0}<green> to be the new guild owner. You have been set to a default guild member.");
addDefaultMessage("guildPrefixSet", "<green>You have changed the guild prefix to '<gold>{0}</gold><green>'", "0 - The new prefix");
addDefaultMessage("guildPrefixCleared", "<green>Your guild's prefix has been cleared.");
this.addDefaultMessage("guildPrefixSet", "<green>You have changed the guild prefix to '<gold>{0}</gold><green>'", "0 - The new prefix");
this.addDefaultMessage("guildPrefixCleared", "<green>Your guild's prefix has been cleared.");
addDefaultMessage("guildWarpAlphanumeric", "<red>Warp names may only contain alphabetical and/or numerical characters.");
addDefaultMessage("guildWarpExists", "<red>'<gold>{0}</gold>'<red> is already an existing warp!", "0 - The warp name");
addDefaultMessage("guildWarpNotFound", "<red>'<gold>{0}</gold>'<red> is not a valid warp!", "0 - The warp name");
addDefaultMessage("guildWarpCreated", "<green>You have created a warp called '<dark_green>{0}</dark_green><green>'", "0 - The warp name");
this.addDefaultMessage("guildWarpAlphanumeric", "<red>Warp names may only contain alphabetical and/or numerical characters.");
this.addDefaultMessage("guildWarpExists", "<red>'<gold>{0}</gold>'<red> is already an existing warp!", "0 - The warp name");
this.addDefaultMessage("guildWarpNotFound", "<red>'<gold>{0}</gold>'<red> is not a valid warp!", "0 - The warp name");
this.addDefaultMessage("guildWarpCreated", "<green>You have created a warp called '<dark_green>{0}</dark_green><green>'", "0 - The warp name");
addDefaultMessage("guildHomeRemoved", "<green>You have removed the guild's home!");
addDefaultMessage("guildHomeSet", "<green>You have changed the guild's home!");
addDefaultMessage("guildHomeNotFound", "<red>This guild currently has no home set.");
this.addDefaultMessage("guildHomeRemoved", "<green>You have removed the guild's home!");
this.addDefaultMessage("guildHomeSet", "<green>You have changed the guild's home!");
this.addDefaultMessage("guildHomeNotFound", "<red>This guild currently has no home set.");
addDefaultMessage("guildChatMessage", "<blue>[GUILD] <aqua>{0} <yellow>{1}", "0 - The player name", "1 - The message");
addDefaultMessage("guildChatToggled", "<green>Your chat has been toggled {0}", "0 - On / Off");
addDefaultMessage("guildChatConsoleLog", "<blue>[GUILD - {0}:{1}] <aqua>{2} <yellow>{3}", "0 - The guild name", "1 - The guild unique identifier", "2 - The player name", "3 - The message");
this.addDefaultMessage("guildChatMessage", "<blue>[GUILD] <aqua>{0} <yellow>{1}", "0 - The player name", "1 - The message");
this.addDefaultMessage("guildChatToggled", "<green>Your chat has been toggled {0}", "0 - On / Off");
this.addDefaultMessage("guildChatConsoleLog", "<blue>[GUILD - {0}:{1}] <aqua>{2} <yellow>{3}", "0 - The guild name", "1 - The guild unique identifier", "2 - The player name", "3 - The message");
this.addDefaultMessage("guildNoInvite", "<red>You don't have any pending invitations!");
this.addDefaultMessage("guildNotValidInvite", "<red>You don't have an invite from this guild!");
this.addDefaultMessage("guildInviteExists", "<red>You've already sent an invite to this person!");
this.addDefaultMessage("guildInviteSent", "<green>You have sent an invite to <dark_green>{0}", "0 - The invitee");
this.addDefaultMessage("guildInviteReceived", "<gold>You have received an invite from <yellow>{0}<gold> for the guild <yellow>{1}<newline><newline><green><bold><click:run_command:/guild invite accept {1}>[ACCEPT]<newline><newline><!bold><gold>You may also run <yellow>/guild invite accept {1}<gold> to accept this invite. It will expire in 5 minutes", "0 - The inviter", "1 - The guild name");
this.addDefaultMessage("guildMemberJoined", "<green>{0} has joined the guild!", "0 - The player who joined");
this.addDefaultMessage("guildMemberLeft", "<green>{0} has left the guild!", "0 - The player who left");
this.addDefaultMessage("guildDisbandNeeded", "<red>You need to disband your guild using <gold>/guild disband<red> or promote a new owner using <gold>/guild owner <player>");
this.addDefaultMessage("guildAutoDisbanded", "<green>Auto-disbanding your guild since there were no members");
addDefaultMessage("guildNoInvite", "<red>You don't have any pending invitations!");
addDefaultMessage("guildNotValidInvite", "<red>You don't have an invite from this guild!");
addDefaultMessage("guildInviteExists", "<red>You've already sent an invite to this person!");
addDefaultMessage("guildInviteSent", "<green>You have sent an invite to <dark_green>{0}", "0 - The invitee");
addDefaultMessage("guildInviteReceived", "<gold>You have received an invite from <yellow>{0}<gold> for the guild <yellow>{1}<newline><newline><green><bold><click:run_command:/guild invite accept {1}>[ACCEPT]<newline><newline><!bold><gold>You may also run <yellow>/guild invite accept {1}<gold> to accept this invite. It will expire in 5 minutes", "0 - The inviter", "1 - The guild name");
addDefaultMessage("guildMemberJoined", "<green>{0} has joined the guild!", "0 - The player who joined");
addDefaultMessage("guildMemberLeft", "<green>{0} has left the guild!", "0 - The player who left");
addDefaultMessage("guildDisbandNeeded", "<red>You need to disband your guild using <gold>/guild disband<red> or promote a new owner using <gold>/guild owner <player>");
addDefaultMessage("guildAutoDisbanded", "<green>Auto-disbanding your guild since there were no members");
}
@Override
@ -103,28 +102,6 @@ public class Guilds extends PlexModule
this.getPlex().setChatHandler(new ChatListener.ChatHandlerImpl());
}
private void addDefaultMessage(String message, Object initValue)
{
if (Plex.get().messages.getString(message) == null)
{
Plex.get().messages.set(message, initValue);
Plex.get().messages.save();
PlexLog.debug("'{0}' message added from TFMExtras module", message);
}
}
private void addDefaultMessage(String message, Object initValue, String... comments)
{
if (Plex.get().messages.getString(message) == null)
{
Plex.get().messages.set(message, initValue);
Plex.get().messages.save();
Plex.get().messages.setComments(message, Arrays.asList(comments));
Plex.get().messages.save();
PlexLog.debug("'{0}' message added from Plex-Guilds module", message);
}
}
public static Guilds get()
{
return module;

View file

@ -1,4 +1,4 @@
name: Module-Guilds
main: dev.plex.Guilds
description: The guilds module for Plex
version: 1.1
version: 1.2-SNAPSHOT