Skip to content

Commit

Permalink
uploaded at Spigot
Browse files Browse the repository at this point in the history
  • Loading branch information
joblessgod committed Sep 18, 2024
1 parent 0f809f7 commit a6a5292
Show file tree
Hide file tree
Showing 13 changed files with 324 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/artifacts/JRules_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions JRules.iml
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>
10 changes: 10 additions & 0 deletions out/production/JRules/config.yml
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"
14 changes: 14 additions & 0 deletions out/production/JRules/plugin.yml
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
60 changes: 60 additions & 0 deletions src/com/joblessgod/jrules/Commands/Rules.java
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;
}
}

22 changes: 22 additions & 0 deletions src/com/joblessgod/jrules/JRules.java
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!");
}

}
24 changes: 24 additions & 0 deletions src/com/joblessgod/jrules/RuleListener.java
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);
}
}
}
10 changes: 10 additions & 0 deletions src/config.yml
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"
14 changes: 14 additions & 0 deletions src/plugin.yml
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

0 comments on commit a6a5292

Please sign in to comment.