-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f809f7
commit a6a5292
Showing
13 changed files
with
324 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module-library" exported=""> | ||
<library> | ||
<CLASSES> | ||
<root url="jar://$MODULE_DIR$/../../Dependencies/spigot-api-1.20.1.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
</component> | ||
</module> |
This file contains 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,10 @@ | ||
rules: | ||
- "§e" | ||
- "§e§l▬▬▬▬▬▬▬▬▬▬▬▬ §6§lServer Rules §e§l▬▬▬▬▬▬▬▬▬▬▬▬" | ||
- "§7➤ §b1. §fRespect all players. Harassment or abuse is not tolerated." | ||
- "§7➤ §b2. §fNo griefing or stealing. Play fair." | ||
- "§7➤ §b3. §fNo hacking or cheating. Use only approved mods." | ||
- "§7➤ §b4. §fNo spamming or advertising in chat." | ||
- "§7➤ §b5. §fKeep the chat appropriate for all ages." | ||
- "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" | ||
- "§e" |
This file contains 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,14 @@ | ||
name: JRules | ||
version: 1.0 | ||
author: JobLessGod | ||
main: com.joblessgod.jrules.JRules | ||
api-version: 1.14 | ||
description: A flexible and powerful rule-based system for managing game interactions and automations. | ||
commands: | ||
rule: | ||
description: Manage and execute game rules. | ||
usage: </commands> | ||
aliases: [rules, guideline, policy] | ||
jrules: | ||
description: Reloads the JRules configuration. | ||
usage: /<command> reload |
This file contains 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,60 @@ | ||
package com.joblessgod.jrules.Commands; | ||
|
||
import com.joblessgod.jrules.JRules; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.List; | ||
|
||
public class Rules implements CommandExecutor { | ||
private final JRules plugin; | ||
|
||
public Rules(JRules plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if (cmd.getName().equalsIgnoreCase("JRules")) { | ||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) { | ||
// Reload the configuration | ||
plugin.reloadConfig(); | ||
|
||
// Send feedback to the command sender | ||
sender.sendMessage("§aJRules configuration reloaded successfully!"); | ||
} else { | ||
// Incorrect usage | ||
sender.sendMessage("§cUsage: /JRules reload"); | ||
} | ||
return true; | ||
} | ||
|
||
if (!(sender instanceof Player)) { | ||
sender.sendMessage("Only players can run this command!"); | ||
return true; // Exit early since it's a non-player | ||
} | ||
|
||
if (cmd.getName().equalsIgnoreCase("rule")) { | ||
Player player = (Player) sender; | ||
|
||
// Fetch the list of rules from the config | ||
List<String> rules = this.plugin.getConfig().getStringList("rules"); | ||
|
||
// Check if the rules list is empty | ||
if (rules.isEmpty()) { | ||
player.sendMessage("§cNo rules have been set yet!"); | ||
return true; | ||
} | ||
|
||
// Send each rule to the player | ||
for (String rule : rules) { | ||
player.sendMessage(rule); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
This file contains 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 com.joblessgod.jrules; | ||
|
||
import com.joblessgod.jrules.Commands.Rules; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public final class JRules extends JavaPlugin { | ||
|
||
@Override | ||
public void onEnable() { | ||
|
||
getCommand("rule").setExecutor(new Rules(this)); | ||
getCommand("JRules").setExecutor(new Rules(this)); | ||
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[JRules] plugin has enabled!"); | ||
saveDefaultConfig(); // saves config file | ||
} | ||
|
||
public void onDisable() { | ||
getServer().getConsoleSender().sendMessage(ChatColor.RED + "[JRules] plugin has disabled!"); | ||
} | ||
|
||
} |
This file contains 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,24 @@ | ||
package com.joblessgod.jrules; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Listener; | ||
|
||
import java.util.List; | ||
|
||
public class RuleListener implements Listener { | ||
|
||
private final JRules plugin; | ||
|
||
public RuleListener(JRules plugin) { | ||
this.plugin = plugin; | ||
Player Player = null; | ||
Player player = (Player); | ||
|
||
// grab the config value | ||
List<String> rules = this.plugin.getConfig().getStringList("rules"); | ||
// Send each rule from the list | ||
for (String rule : rules) { | ||
player.sendMessage(rule); | ||
} | ||
} | ||
} |
This file contains 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,10 @@ | ||
rules: | ||
- "§e" | ||
- "§e§l▬▬▬▬▬▬▬▬▬▬▬▬ §6§lServer Rules §e§l▬▬▬▬▬▬▬▬▬▬▬▬" | ||
- "§7➤ §b1. §fRespect all players. Harassment or abuse is not tolerated." | ||
- "§7➤ §b2. §fNo griefing or stealing. Play fair." | ||
- "§7➤ §b3. §fNo hacking or cheating. Use only approved mods." | ||
- "§7➤ §b4. §fNo spamming or advertising in chat." | ||
- "§7➤ §b5. §fKeep the chat appropriate for all ages." | ||
- "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" | ||
- "§e" |
This file contains 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,14 @@ | ||
name: JRules | ||
version: 1.0 | ||
author: JobLessGod | ||
main: com.joblessgod.jrules.JRules | ||
api-version: 1.14 | ||
description: A flexible and powerful rule-based system for managing game interactions and automations. | ||
commands: | ||
rule: | ||
description: Manage and execute game rules. | ||
usage: </commands> | ||
aliases: [rules, guideline, policy] | ||
jrules: | ||
description: Reloads the JRules configuration. | ||
usage: /<command> reload |