Added /member mod command
This commit is contained in:
parent
806550a625
commit
718d8d073c
5 changed files with 60 additions and 14 deletions
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.github.milkbowl:VaultAPI:master-8dc0859cba-1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-8dc0859cba-1/VaultAPI-master-8dc0859cba-1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-8dc0859cba-1/VaultAPI-master-8dc0859cba-1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-8dc0859cba-1/VaultAPI-master-8dc0859cba-1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -13,6 +13,7 @@
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class MainPlugin extends JavaPlugin {
|
||||||
TBMCChatAPI.AddCommand(this, UpdatePluginCommand.class);
|
TBMCChatAPI.AddCommand(this, UpdatePluginCommand.class);
|
||||||
TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class);
|
TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class);
|
||||||
TBMCChatAPI.AddCommand(this, PrimeRestartCommand.class);
|
TBMCChatAPI.AddCommand(this, PrimeRestartCommand.class);
|
||||||
|
TBMCChatAPI.AddCommand(this, MemberCommand.class);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);
|
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);
|
||||||
TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fOOC§f", Color.White, "ooc", null));
|
TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fOOC§f", Color.White, "ooc", null));
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package buttondevteam.core;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
import lombok.val;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = true, path = "member")
|
||||||
|
public class MemberCommand extends TBMCCommandBase {
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
if (args.length < 2)
|
||||||
|
return false;
|
||||||
|
final boolean add;
|
||||||
|
if (args[0].equalsIgnoreCase("add"))
|
||||||
|
add = true;
|
||||||
|
else if (args[0].equalsIgnoreCase("remove"))
|
||||||
|
add = false;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(MainPlugin.Instance, () -> {
|
||||||
|
if (MainPlugin.permission == null) {
|
||||||
|
sender.sendMessage("§cError: No permission plugin found!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
val op = Bukkit.getOfflinePlayer(args[1]);
|
||||||
|
if (!op.hasPlayedBefore()) {
|
||||||
|
sender.sendMessage("§cCannot find player or haven't played before.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (add) {
|
||||||
|
if (MainPlugin.permission.playerAddGroup(null, op, "member"))
|
||||||
|
sender.sendMessage("§b" + op.getName() + " added as a member!");
|
||||||
|
else
|
||||||
|
sender.sendMessage("§cFailed to add " + op.getName() + " as a member!");
|
||||||
|
} else {
|
||||||
|
if (MainPlugin.permission.playerRemoveGroup(null, op, "member"))
|
||||||
|
sender.sendMessage("§b" + op.getName() + " removed as a member!");
|
||||||
|
else
|
||||||
|
sender.sendMessage("§bFailed to remove " + op.getName() + " as a member!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[]{ //
|
||||||
|
"06---- Member ----", //
|
||||||
|
"Add or remove server members.", //
|
||||||
|
"Usage: /member <add|remove> <player>" //
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,4 +10,6 @@ commands:
|
||||||
primerestart:
|
primerestart:
|
||||||
description: Restarts the server as soon as nobody is online.
|
description: Restarts the server as soon as nobody is online.
|
||||||
randomtp:
|
randomtp:
|
||||||
description: teleport player to random location within world border. Every five players teleport to the same general area, and then a new general area is randomly selected for the next five players.
|
description: teleport player to random location within world border. Every five players teleport to the same general area, and then a new general area is randomly selected for the next five players.
|
||||||
|
member:
|
||||||
|
description: Add or remove a member
|
Loading…
Reference in a new issue