Skip to content

Commit

Permalink
added support for version 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
jonagamerpro1234 committed Jun 12, 2023
1 parent 0da919d commit 24257e8
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 53 deletions.
8 changes: 4 additions & 4 deletions CustomJoinAndQuitMessagesOld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>CustomJoinAndQuitMessagesOld</artifactId>
<version>1.7.10-beta</version>
<version>1.7.12-beta</version>

<properties>
<java.version>8</java.version>
Expand Down Expand Up @@ -144,13 +144,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -178,7 +178,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.1.0</version>
<version>9.2.0</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static void setEnabled(String version) {
sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&aSuccessfully activated&d]");
sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]");
sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]");
sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20");
sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8 &3- &a1.20&3| &eComing Soon -> &c1.21");
sendEnable(prefix, "&5 <||============================================----");
}

Expand All @@ -139,7 +139,7 @@ public static void setDisabled(String version) {
sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&cSuccessfully disabled&c]");
sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]");
sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]");
sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20");
sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8 &3- &a1.20&3| &eComing Soon -> &c1.21");
sendEnable(prefix, "&5 <|| &a* &eThanks for using CustomJoinAndQuitMessage &c<3");
sendEnable(prefix, "&5 <||============================================----");
}
Expand Down
3 changes: 2 additions & 1 deletion CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# ● For more information you can visit the CustomJoinAndQuitMessages Wiki
#
# ● Wiki [Working Progress]: ---
# ● Spigot: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-1-19-4.57006/
#
default:

Expand Down Expand Up @@ -61,7 +62,7 @@ default:
Command: '/say <name> hello server'

# |Url| Clicking on the chat opens a link
Url: 'https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/'
Url: 'https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-1-19-4.57006/'

# |Suggest-Command| Clicking on the chat suggests a command that you define in the config
Suggest-Command: '/msg <name>'
Expand Down
2 changes: 1 addition & 1 deletion CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: "${version}"
author: jonagamerpro1234
api-version: 1.13
prefix: CustomJoinAndQuitMessages
website: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-x-1-19-x.57006/
website: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-1-19-4.57006/
loadbefore: [ Essentials ]
softdepend: [
PlaceholderAPI, DiscordSRV,
Expand Down
9 changes: 7 additions & 2 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<version>24.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -103,5 +103,10 @@
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jss.commandapi</groupId>
<artifactId>command-api</artifactId>
<version>0.0.3-alpha</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public void onDisable() {
}

public void reloadAllFiles(){

reloadConfig();
preConfigLoader.loadConfigs();
preConfigLoader.loadLangs();
}

private void registerListener(Listener @NotNull ...listeners){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package jss.customjoinandquitmessage.commands;

import jss.commandapi.SubCommand;
import jss.customjoinandquitmessage.CustomJoinAndQuitMessage;
import jss.customjoinandquitmessage.commands.subcommands.DisplayCommand;
import jss.customjoinandquitmessage.commands.subcommands.HelpCommand;
import jss.customjoinandquitmessage.commands.subcommands.InfoCommand;
import jss.customjoinandquitmessage.commands.subcommands.ReloadCommand;
import jss.customjoinandquitmessage.commands.utils.SubCommand;
import jss.customjoinandquitmessage.files.utils.Settings;
import jss.customjoinandquitmessage.utils.Utils;
import org.bukkit.command.Command;
Expand All @@ -29,13 +30,12 @@ public void register(){
pluginCommand.setExecutor(this);
pluginCommand.setTabCompleter(this);

subCommands.addAll(Arrays.asList(new HelpCommand(), new ReloadCommand(), new InfoCommand()));
subCommands.addAll(Arrays.asList(new HelpCommand(), new ReloadCommand(), new InfoCommand(), new DisplayCommand()));
}

@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String @NotNull [] args) {
if(args.length >= 1){
// execute subcommand

for(SubCommand s : getSubCommands()){
if (args[0].equalsIgnoreCase(s.name())){
if (s.isEnabled()){
Expand All @@ -45,7 +45,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
return true;
}

if (s.requiresPermission() && !sender.hasPermission(s.permission())) {
if (!sender.isOp() || (s.requiresPermission() && !sender.hasPermission("cjm." + s.permission()))) {
Utils.sendColorMessage(sender, Settings.lang_nopermission);
return true;
}
Expand All @@ -67,7 +67,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
return true;
}

@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String alias, String @NotNull [] args) {
List<String> listOptions = new ArrayList<>();
String lastArgs = args.length != 0 ? args[args.length - 1] : "";
Expand All @@ -84,6 +83,12 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
listOptions.add("help");
listOptions.add("reload");
break;
case 2:
if(args[0].equalsIgnoreCase("reload")){
listOptions.add("config");
listOptions.add("lang");
}
break;
}

return Utils.setLimitTab(listOptions, lastArgs);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package jss.customjoinandquitmessage.commands.subcommands;

import jss.customjoinandquitmessage.commands.utils.SubCommand;
import jss.commandapi.SubCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

Expand All @@ -11,27 +11,27 @@ public String name() {
return "display";
}

@Override
public String permission() {
return null;
return "command.display";
}

public boolean requiresPermission() {
return true;
}

public void onCommand(CommandSender sender, String[] args) {
public boolean onCommand(CommandSender sender, String[] args) {
if(!(sender instanceof Player)){

}
return true;
}

public boolean allowConsole() {
return false;
}

public boolean isEnabled() {
return false;
return true;
}

public String disabledMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package jss.customjoinandquitmessage.commands.subcommands;

import jss.customjoinandquitmessage.commands.utils.SubCommand;
import jss.commandapi.SubCommand;
import jss.customjoinandquitmessage.files.utils.Settings;
import jss.customjoinandquitmessage.utils.Utils;
import org.bukkit.command.CommandSender;
Expand All @@ -11,18 +11,19 @@ public String name() {
return "help";
}

public String permission(){
public String permission() {
return "command.help";
}

public boolean requiresPermission() {
return true;
}

public void onCommand(CommandSender sender, String[] args) {
public boolean onCommand(CommandSender sender, String[] args) {
for (String s : Settings.lang_helpCommand) {
Utils.sendColorMessage(sender, s);
}
return true;
}

public boolean allowConsole() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package jss.customjoinandquitmessage.commands.subcommands;

import jss.customjoinandquitmessage.commands.utils.SubCommand;
import jss.commandapi.SubCommand;
import jss.customjoinandquitmessage.files.utils.Settings;
import org.bukkit.command.CommandSender;

Expand All @@ -10,7 +10,6 @@ public String name() {
return "info";
}

@Override
public String permission() {
return null;
}
Expand All @@ -19,8 +18,9 @@ public boolean requiresPermission() {
return false;
}

public void onCommand(CommandSender sender, String[] args) {
public boolean onCommand(CommandSender sender, String[] args) {

return true;
}

public boolean allowConsole() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
package jss.customjoinandquitmessage.commands.subcommands;

import jss.customjoinandquitmessage.commands.utils.SubCommand;
import jss.commandapi.SubCommand;
import jss.customjoinandquitmessage.CustomJoinAndQuitMessage;
import jss.customjoinandquitmessage.files.utils.Settings;
import jss.customjoinandquitmessage.utils.Utils;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class ReloadCommand extends SubCommand {

private static final CustomJoinAndQuitMessage plugin = CustomJoinAndQuitMessage.get();

public String name() {
return "reload";
}

@Override
public String permission() {
return null;
return "command.reload";
}

public boolean requiresPermission() {
return true;
}

public void onCommand(CommandSender sender, String[] args) {
public boolean onCommand(CommandSender sender, String @NotNull [] args) {
if (args.length >= 1){

if(args[0].equalsIgnoreCase("config")){

Utils.sendColorMessage(sender, Settings.lang_reloadCommand);
return true;
}

if (args[0].equalsIgnoreCase("lang")){

Utils.sendColorMessage(sender, Settings.lang_reloadCommand);
return true;
}
Utils.sendColorMessage(sender, Settings.lang_unknownArguments);
return true;
}

plugin.reloadAllFiles();
Utils.sendColorMessage(sender, Settings.lang_reloadCommand);
return true;
}

public boolean allowConsole() {
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ permissions:
cjm.update: true
cjm.command.reload: true
cjm.command.help: true
cjm.command.display: true
cjm.command.tabcomplete: true
default: op
cjm.update:
Expand All @@ -38,3 +39,6 @@ permissions:
cjm.command.tabcomplete:
description: allows you to see the list of available commands
default: op
cjm.command.display:
description: ----
default: op

0 comments on commit 24257e8

Please sign in to comment.