Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Add basic nations functionality #1

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0b586a5
basic nations
Jan 7, 2024
96444de
add invites and accepts
Jan 7, 2024
17a55b3
add kick
Jan 7, 2024
9952674
chore: reformat
Jan 7, 2024
1aaddc3
Revert "chore: reformat"
Jan 7, 2024
37392e7
resign: chore: reformat
Jan 7, 2024
f6b874b
Add better help
Jan 7, 2024
da97c59
Switch to aqua colours
Jan 7, 2024
4c87b9f
forgot a return after disbanding
Jan 7, 2024
57c350a
Add a no nations message
Jan 7, 2024
4b64053
add translations
Jan 7, 2024
7b7b2af
hotfix: nations not saving if there aren't any created
Jan 7, 2024
c92a0b6
Finish translation
Jan 7, 2024
801b749
try to add IC supprt
Jan 7, 2024
bf1800a
add our own chat handler
Jan 7, 2024
8e49043
optimise imports
Jan 7, 2024
f79e1db
Add Javadocs
Jan 9, 2024
69483d4
reformat code
Jan 9, 2024
2f2d7c1
add cloudnodeMSG support
Jan 9, 2024
eaa0f8c
allow hex and minecraft-colors only
Jan 10, 2024
fd8e408
show nation-based command only if a player is inside a nation
Jan 10, 2024
c98b096
add an exclamation point to errors
Jan 10, 2024
e188e60
don't show create and join if a player is in a nation
Jan 10, 2024
c39aaf5
add force delete, and message reloading
Jan 10, 2024
c993664
autocomplete /n join & force-delete
Jan 10, 2024
17c2a4f
duplicate keys, bruh
Jan 10, 2024
5b2c4a5
add nations in tablist
Jan 10, 2024
0e9c709
make nations 16 chars max
Jan 10, 2024
c99a62a
add missing keys before loading
Jan 10, 2024
8c11ca0
chore: reformat code
Jan 10, 2024
ec88dfb
add join/quit messages
Jan 10, 2024
0206d7b
Update NationsCommand.java
Jan 10, 2024
d499a80
no `implNote` support in javadocs
Jan 10, 2024
8e920ee
Add hover information to /n list
Jan 11, 2024
fc49c38
Annotate with @NotNull
Jan 12, 2024
2cdc3cc
reformat code
Jan 12, 2024
83598b2
code cleanup
Jan 12, 2024
1a0484b
construct it only once
Jan 12, 2024
30e69a1
Add invite cancellation
Jan 12, 2024
2a5df20
bump to JDK 17
Jan 12, 2024
653eb6a
forgot a crlf
Jan 12, 2024
a1d8d11
enhanced switch
Jan 12, 2024
856e09f
update hex regex
Jan 12, 2024
57ebf65
add leave as an alias to quit
Jan 12, 2024
ce1f37b
make sendMessage yield true
Jan 12, 2024
2769a56
OP's already have the permission
Jan 12, 2024
44c2f5c
Merge branch 'master' into feature/nations
Jan 12, 2024
c4fc1b3
remove unused
Jan 12, 2024
98ebea2
missing space
Jan 12, 2024
89d361d
add plugin version info at no arguments
Jan 21, 2024
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
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand All @@ -23,8 +23,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>16</source>
<target>16</target>
kai-gitt marked this conversation as resolved.
Show resolved Hide resolved
</configuration>
</plugin>
<plugin>
Expand Down
51 changes: 50 additions & 1 deletion src/main/java/pro/cloudnode/smp/nations/Nations.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,69 @@
package pro.cloudnode.smp.nations;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.plugin.java.JavaPlugin;
import pro.cloudnode.smp.nations.commands.NationsCommand;
import pro.cloudnode.smp.nations.listeners.ChatMessageListener;
import pro.cloudnode.smp.nations.listeners.PlayerConnectionListener;
import pro.cloudnode.smp.nations.locale.Messages;
import pro.cloudnode.smp.nations.util.NationManager;

import java.util.Objects;

public final class Nations extends JavaPlugin {

public static NationManager nationManager;

public static NationManager getNationManager() {
return nationManager;
}

/**
* Translate a message to a component and replace placeholders
*
* @param message the message to translate
* @param args the arguments to replace placeholders with
* @return the translated component
*/
public static Component t(Messages message, Object... args) {
return MiniMessage.miniMessage().deserialize(message.replacePlaceholders(args));
}

/**
* Translate a message to a string and replace placeholders
*
* @param message the message to translate
* @param args the arguments to replace placeholders with
* @return the translated string
*/
public static String ts(Messages message, Object... args) {
return message.replacePlaceholders(args);
}
kai-gitt marked this conversation as resolved.
Show resolved Hide resolved

@Override
public void onEnable() {
// save messages.yml if it doesn't exist
Messages.save();
Messages.addMissingDefaults();
Messages.load();

// load nations
nationManager = new NationManager(this);
nationManager.load();

// register commands
Objects.requireNonNull(this.getCommand("nations")).setExecutor(new NationsCommand(this));
Objects.requireNonNull(this.getCommand("nations")).setTabCompleter(new NationsCommand(this));

// register chat listener
getServer().getPluginManager().registerEvents(new ChatMessageListener(), this);
getServer().getPluginManager().registerEvents(new PlayerConnectionListener(), this);

}

@Override
public void onDisable() {

nationManager.save();
}
}
Loading