mirror of
https://github.com/5vl/CorePlugin.git
synced 2025-05-23 21:56:55 +00:00
First commit
This commit is contained in:
commit
31b2cab170
40
java/coreplugin/coreplugin/Core.java
Normal file
40
java/coreplugin/coreplugin/Core.java
Normal file
@ -0,0 +1,40 @@
|
||||
package coreplugin.coreplugin;
|
||||
|
||||
import coreplugin.coreplugin.commands.fly;
|
||||
import coreplugin.coreplugin.commands.gamemodes.GMA;
|
||||
import coreplugin.coreplugin.commands.gamemodes.GMC;
|
||||
import coreplugin.coreplugin.commands.gamemodes.GMS;
|
||||
import coreplugin.coreplugin.commands.gamemodes.GMSP;
|
||||
import coreplugin.coreplugin.commands.heal;
|
||||
import coreplugin.coreplugin.commands.punish.ban;
|
||||
import coreplugin.coreplugin.commands.punish.kick;
|
||||
import coreplugin.coreplugin.commands.punish.unban;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class Core extends JavaPlugin {
|
||||
private static Core instance;
|
||||
@Override
|
||||
public void onEnable() {
|
||||
System.out.println("Core Plugin has been enabled.");
|
||||
instance = this;
|
||||
this.getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
PluginManager plm = org.bukkit.Bukkit.getPluginManager();
|
||||
registerCMD();
|
||||
}
|
||||
public static Core getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private void registerCMD() {
|
||||
getCommand("gmc").setExecutor(new GMC());
|
||||
getCommand("gms").setExecutor(new GMS());
|
||||
getCommand("gma").setExecutor(new GMA());
|
||||
getCommand("gmsp").setExecutor(new GMSP());
|
||||
getCommand("fly").setExecutor(new fly());
|
||||
getCommand("heal").setExecutor(new heal());
|
||||
getCommand("kick").setExecutor(new kick());
|
||||
getCommand("ban").setExecutor(new ban());
|
||||
getCommand("unban").setExecutor(new unban());
|
||||
}
|
||||
}
|
80
java/coreplugin/coreplugin/commands/fly.java
Normal file
80
java/coreplugin/coreplugin/commands/fly.java
Normal file
@ -0,0 +1,80 @@
|
||||
package coreplugin.coreplugin.commands;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class fly implements CommandExecutor {
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (sender.hasPermission("core.fly")) {
|
||||
Player p = (Player) sender;
|
||||
if(s.equalsIgnoreCase("fly")) {
|
||||
if(strings.length > 0) {
|
||||
try {
|
||||
if (strings.length > 1){
|
||||
if (strings[1].equalsIgnoreCase("-s")){
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setAllowFlight(!ps.getAllowFlight());
|
||||
if (ps.getAllowFlight()) {
|
||||
String EnableFlyOther = Core.getInstance().getConfig().getString("EnableFlyOther");
|
||||
p.sendMessage(color(EnableFlyOther + strings[0]));
|
||||
}
|
||||
else {
|
||||
String DisableFlyOther = Core.getInstance().getConfig().getString("DisableFlyOther");
|
||||
p.sendMessage(color(DisableFlyOther + strings[0]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setAllowFlight(!ps.getAllowFlight());
|
||||
String DisableFlyOther = Core.getInstance().getConfig().getString("DisableFlyOther");
|
||||
String EnableFlyOther = Core.getInstance().getConfig().getString("EnableFlyOther");
|
||||
String FlyDisabledOther = Core.getInstance().getConfig().getString("FlyDisabledOther");
|
||||
String FlyEnabledOther = Core.getInstance().getConfig().getString("FlyEnabledOther");
|
||||
if (ps.getAllowFlight()) {
|
||||
p.sendMessage(color(EnableFlyOther + strings[0]));
|
||||
ps.sendMessage(color(FlyEnabledOther + p.getPlayerListName()));
|
||||
} else {
|
||||
p.sendMessage(color(DisableFlyOther + strings[0]));
|
||||
ps.sendMessage(color(FlyDisabledOther + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
}
|
||||
else {
|
||||
p.setAllowFlight(!p.getAllowFlight());
|
||||
String DisableFlySelf = Core.getInstance().getConfig().getString("DisableFlySelf");
|
||||
String EnableFlySelf = Core.getInstance().getConfig().getString("EnableFlySelf");
|
||||
if (p.getAllowFlight()) {
|
||||
p.sendMessage(color(EnableFlySelf));
|
||||
}
|
||||
else {
|
||||
p.sendMessage(color(DisableFlySelf));
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
65
java/coreplugin/coreplugin/commands/gamemodes/GMA.java
Normal file
65
java/coreplugin/coreplugin/commands/gamemodes/GMA.java
Normal file
@ -0,0 +1,65 @@
|
||||
package coreplugin.coreplugin.commands.gamemodes;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GMA implements CommandExecutor {
|
||||
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (sender.hasPermission("core.gma")) {
|
||||
Player p = (Player) sender;
|
||||
if (s.equalsIgnoreCase("gma")) {
|
||||
if (strings.length > 0) {
|
||||
try {
|
||||
if (strings.length > 1){
|
||||
if (strings[1].equalsIgnoreCase("-s")){
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.ADVENTURE);
|
||||
String AdventureSetOther = Core.getInstance().getConfig().getString("AdventureSetOther");
|
||||
p.sendMessage(color(AdventureSetOther + strings[0]));
|
||||
}
|
||||
else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.ADVENTURE);
|
||||
String AdventureSetOther = Core.getInstance().getConfig().getString("AdventureSetOther");
|
||||
String AdventureOther = Core.getInstance().getConfig().getString("AdventureOther");
|
||||
p.sendMessage(color(AdventureSetOther + strings[0]));
|
||||
ps.sendMessage(color(AdventureOther + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
} else {
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
String AdventureSelf = Core.getInstance().getConfig().getString("AdventureSelf");
|
||||
p.sendMessage(color(AdventureSelf));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
65
java/coreplugin/coreplugin/commands/gamemodes/GMC.java
Normal file
65
java/coreplugin/coreplugin/commands/gamemodes/GMC.java
Normal file
@ -0,0 +1,65 @@
|
||||
package coreplugin.coreplugin.commands.gamemodes;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GMC implements CommandExecutor {
|
||||
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (sender.hasPermission("core.gmc")) {
|
||||
Player p = (Player) sender;
|
||||
if (s.equalsIgnoreCase("gmc")) {
|
||||
if (strings.length > 0) {
|
||||
try {
|
||||
if (strings.length > 1){
|
||||
if (strings[1].equalsIgnoreCase("-s")){
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.CREATIVE);
|
||||
String CreativeSetOther = Core.getInstance().getConfig().getString("CreativeSetOther");
|
||||
p.sendMessage(color(CreativeSetOther + strings[0]));
|
||||
}
|
||||
else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.CREATIVE);
|
||||
String CreativeSetOther = Core.getInstance().getConfig().getString("CreativeSetOther");
|
||||
String CreativeOther = Core.getInstance().getConfig().getString("CreativeOther");
|
||||
p.sendMessage(color(CreativeSetOther + strings[0]));
|
||||
ps.sendMessage(color(CreativeOther + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
} else {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
String CreativeSelf = Core.getInstance().getConfig().getString("CreativeSelf");
|
||||
p.sendMessage(color(CreativeSelf));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
65
java/coreplugin/coreplugin/commands/gamemodes/GMS.java
Normal file
65
java/coreplugin/coreplugin/commands/gamemodes/GMS.java
Normal file
@ -0,0 +1,65 @@
|
||||
package coreplugin.coreplugin.commands.gamemodes;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GMS implements CommandExecutor {
|
||||
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (sender.hasPermission("core.gms")) {
|
||||
Player p = (Player) sender;
|
||||
if (s.equalsIgnoreCase("gms")) {
|
||||
if (strings.length > 0) {
|
||||
try {
|
||||
if (strings.length > 1){
|
||||
if (strings[1].equalsIgnoreCase("-s")){
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.SURVIVAL);
|
||||
String SurvivalSetOther = Core.getInstance().getConfig().getString("SurvivalSetOther");
|
||||
p.sendMessage(color(SurvivalSetOther + strings[0]));
|
||||
}
|
||||
else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.SURVIVAL);
|
||||
String SurvivalSetOther = Core.getInstance().getConfig().getString("SurvivalSetOther");
|
||||
String SurvivalOther = Core.getInstance().getConfig().getString("SurvivalOther");
|
||||
p.sendMessage(color(SurvivalSetOther + strings[0]));
|
||||
ps.sendMessage(color(SurvivalOther + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
} else {
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
String SurvivalSelf = Core.getInstance().getConfig().getString("SurvivalSelf");
|
||||
p.sendMessage(color(SurvivalSelf));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
65
java/coreplugin/coreplugin/commands/gamemodes/GMSP.java
Normal file
65
java/coreplugin/coreplugin/commands/gamemodes/GMSP.java
Normal file
@ -0,0 +1,65 @@
|
||||
package coreplugin.coreplugin.commands.gamemodes;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GMSP implements CommandExecutor {
|
||||
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (sender.hasPermission("core.gmsp")) {
|
||||
Player p = (Player) sender;
|
||||
if (s.equalsIgnoreCase("gmsp")) {
|
||||
if (strings.length > 0) {
|
||||
try {
|
||||
if (strings.length > 1){
|
||||
if (strings[1].equalsIgnoreCase("-s")){
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.SPECTATOR);
|
||||
String SetOther = Core.getInstance().getConfig().getString("SpectatorSetOther");
|
||||
p.sendMessage(color(SetOther + strings[0]));
|
||||
}
|
||||
else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(strings[0]);
|
||||
ps.setGameMode(GameMode.SPECTATOR);
|
||||
String SetOther = Core.getInstance().getConfig().getString("SpectatorSetOther");
|
||||
String Other = Core.getInstance().getConfig().getString("SpectatorOther");
|
||||
p.sendMessage(color(SetOther + strings[0]));
|
||||
ps.sendMessage(color(Other + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
} else {
|
||||
p.setGameMode(GameMode.SPECTATOR);
|
||||
String Self = Core.getInstance().getConfig().getString("SpectatorSelf");
|
||||
p.sendMessage(color(Self));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
69
java/coreplugin/coreplugin/commands/heal.java
Normal file
69
java/coreplugin/coreplugin/commands/heal.java
Normal file
@ -0,0 +1,69 @@
|
||||
package coreplugin.coreplugin.commands;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class heal implements CommandExecutor {
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender.hasPermission("core.heal")) {
|
||||
Player p = (Player) sender;
|
||||
if (label.equalsIgnoreCase("heal")) {
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equalsIgnoreCase("-s")) {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
ps.setHealth(20);
|
||||
ps.setFoodLevel(20);
|
||||
String HealOther = Core.getInstance().getConfig().getString("HealOther");
|
||||
p.sendMessage(color(HealOther + args[0]));
|
||||
} else {
|
||||
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidArgument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
ps.setHealth(20);
|
||||
ps.setFoodLevel(20);
|
||||
String HealOther = Core.getInstance().getConfig().getString("HealOther");
|
||||
String HealedOther = Core.getInstance().getConfig().getString("HealedOther");
|
||||
p.sendMessage(color(HealOther + args[0]));
|
||||
ps.sendMessage(color(HealedOther + p.getPlayerListName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
}
|
||||
else if (sender instanceof Player) {
|
||||
p.setHealth(20);
|
||||
p.setFoodLevel(20);
|
||||
String HealSelf = Core.getInstance().getConfig().getString("HealSelf");
|
||||
p.sendMessage(color(HealSelf));
|
||||
}
|
||||
else {
|
||||
String Console = Core.getInstance().getConfig().getString("Console");
|
||||
p.sendMessage(color(Console));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
95
java/coreplugin/coreplugin/commands/punish/ban.java
Normal file
95
java/coreplugin/coreplugin/commands/punish/ban.java
Normal file
@ -0,0 +1,95 @@
|
||||
package coreplugin.coreplugin.commands.punish;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ban implements CommandExecutor {
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender.hasPermission("core.ban")) {
|
||||
Player p = (Player) sender;
|
||||
if (label.equalsIgnoreCase("ban")) {
|
||||
try {
|
||||
String DefaultBan = Core.getInstance().getConfig().getString("DefaultBan");
|
||||
String BroadcastBan = Core.getInstance().getConfig().getString("BroadcastBan");
|
||||
if (args.length == 1) {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
OfflinePlayer po = Bukkit.getOfflinePlayer(args[0]);
|
||||
if (po.isOnline()) {
|
||||
ps.kickPlayer(color(DefaultBan));
|
||||
ps.banPlayer(color(DefaultBan));
|
||||
}
|
||||
else {
|
||||
po.banPlayer(color(DefaultBan));
|
||||
}
|
||||
Bukkit.broadcastMessage(color(args[0] + " " + BroadcastBan + DefaultBan));
|
||||
}
|
||||
else if (args.length > 1) {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
OfflinePlayer po = (Player) Bukkit.getOfflinePlayer(args[0]);
|
||||
if (args[1].equalsIgnoreCase("-s")) {
|
||||
if (args.length > 2) {
|
||||
String BanReasonS = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
|
||||
if (po.isOnline()) {
|
||||
ps.kickPlayer(color(BanReasonS));
|
||||
ps.banPlayer(color(BanReasonS));
|
||||
}
|
||||
else {
|
||||
po.banPlayer(color(BanReasonS));
|
||||
}
|
||||
p.sendMessage(color(args[0] + " " + BroadcastBan + BanReasonS));
|
||||
} else {
|
||||
if (po.isOnline()) {
|
||||
ps.kickPlayer(color(DefaultBan));
|
||||
ps.banPlayer(color(DefaultBan));
|
||||
}
|
||||
else {
|
||||
po.banPlayer(color(DefaultBan));
|
||||
}
|
||||
p.sendMessage(color(args[0] + " " + BroadcastBan + DefaultBan));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String BanReason = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
if (po.isOnline()) {
|
||||
ps.kickPlayer(color(BanReason));
|
||||
ps.banPlayer(color(BanReason));
|
||||
}
|
||||
else {
|
||||
po.banPlayer(color(BanReason));
|
||||
}
|
||||
Bukkit.broadcastMessage(color(args[0] + " " + BroadcastBan + BanReason));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
69
java/coreplugin/coreplugin/commands/punish/kick.java
Normal file
69
java/coreplugin/coreplugin/commands/punish/kick.java
Normal file
@ -0,0 +1,69 @@
|
||||
package coreplugin.coreplugin.commands.punish;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class kick implements CommandExecutor {
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender.hasPermission("core.kick")) {
|
||||
Player p = (Player) sender;
|
||||
if (label.equalsIgnoreCase("kick")) {
|
||||
try {
|
||||
String DefaultKick = Core.getInstance().getConfig().getString("DefaultKick");
|
||||
String BroadcastKick = Core.getInstance().getConfig().getString("BroadcastKick");
|
||||
if (args.length == 1) {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
ps.kickPlayer(color(DefaultKick));
|
||||
Bukkit.broadcastMessage(color(args[0] + " " + BroadcastKick + DefaultKick));
|
||||
}
|
||||
else if (args.length > 1) {
|
||||
Player ps = Bukkit.getPlayer(args[0]);
|
||||
if (args[1].equalsIgnoreCase("-s")) {
|
||||
if (args.length > 2) {
|
||||
String KickReasonS = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
|
||||
ps.kickPlayer(color(KickReasonS));
|
||||
p.sendMessage(color(args[0] + " " + BroadcastKick + KickReasonS));
|
||||
} else {
|
||||
ps.kickPlayer(color(DefaultKick));
|
||||
p.sendMessage(color(args[0] + " " + BroadcastKick + DefaultKick));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String KickReason = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
ps.kickPlayer(color(KickReason));
|
||||
Bukkit.broadcastMessage(color(args[0] + " " + BroadcastKick + KickReason));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
4
java/coreplugin/coreplugin/commands/punish/mute.java
Normal file
4
java/coreplugin/coreplugin/commands/punish/mute.java
Normal file
@ -0,0 +1,4 @@
|
||||
package coreplugin.coreplugin.commands.punish;
|
||||
|
||||
public class mute {
|
||||
}
|
57
java/coreplugin/coreplugin/commands/punish/unban.java
Normal file
57
java/coreplugin/coreplugin/commands/punish/unban.java
Normal file
@ -0,0 +1,57 @@
|
||||
package coreplugin.coreplugin.commands.punish;
|
||||
|
||||
import coreplugin.coreplugin.Core;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class unban implements CommandExecutor {
|
||||
private String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
if (sender.hasPermission("core.unban")) {
|
||||
if (label.equalsIgnoreCase("unban")) {
|
||||
try {
|
||||
String BroadcastUnban = Core.getInstance().getConfig().getString("BroadcastUnban");
|
||||
if (args.length == 1) {
|
||||
OfflinePlayer po = Bukkit.getOfflinePlayer(args[0]);
|
||||
Bukkit.getBanList(BanList.Type.NAME).pardon(po.getName());
|
||||
Bukkit.broadcastMessage(color(args[0] + " " + BroadcastUnban));
|
||||
}
|
||||
else if (args.length == 2) {
|
||||
if (args[1].equals("-s")) {
|
||||
OfflinePlayer po = Bukkit.getOfflinePlayer(args[0]);
|
||||
Bukkit.getBanList(BanList.Type.NAME).pardon(po.getName());
|
||||
p.sendMessage(color(args[0] + " " + BroadcastUnban));
|
||||
}
|
||||
else {
|
||||
String InvalidAgrument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidAgrument));
|
||||
}
|
||||
}
|
||||
else {
|
||||
String InvalidAgrument = Core.getInstance().getConfig().getString("InvalidArgument");
|
||||
p.sendMessage(color(InvalidAgrument));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
String CannotFindPlayer = Core.getInstance().getConfig().getString("CannotFindPlayer");
|
||||
p.sendMessage(color(CannotFindPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
String MissingPermission = Core.getInstance().getConfig().getString("MissingPermission");
|
||||
p.sendMessage(color(MissingPermission));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
4
java/coreplugin/coreplugin/commands/punish/warn.java
Normal file
4
java/coreplugin/coreplugin/commands/punish/warn.java
Normal file
@ -0,0 +1,4 @@
|
||||
package coreplugin.coreplugin.commands.punish;
|
||||
|
||||
public class warn {
|
||||
}
|
45
resources/config.yml
Normal file
45
resources/config.yml
Normal file
@ -0,0 +1,45 @@
|
||||
# Gamemode messages
|
||||
CreativeSelf: '&aYour gamemode has been changed to &cCreative.'
|
||||
CreativeSetOther: '&aYou changed the gamemode to &cCreative &afor: &d' # Last color code is the color that the playername will show in.
|
||||
CreativeOther: '&aYour gamemode has been changed to &cCreative &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
SurvivalSelf: '&aYour gamemode has been changed to &cSurvival.'
|
||||
SurvivalSetOther: '&aYou changed the gamemode to &cSurvival &afor: &d' # Last color code is the color that the playername will show in.
|
||||
SurvivalOther: '&aYour gamemode has been changed to &cSurvival &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
SpectatorSelf: '&aYour gamemode has been changed to &cSpectator.'
|
||||
SpectatorSetOther: '&aYou changed the gamemode to &cSpectator &afor: &d' # Last color code is the color that the playername will show in.
|
||||
SpectatorOther: '&aYour gamemode has been changed to &cSpectator &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
AdventureSelf: '&aYour gamemode has been changed to &cAdventure.'
|
||||
AdventureSetOther: '&aYou changed the gamemode to &cAdventure &afor: &d' # Last color code is the color that the playername will show in.
|
||||
AdventureOther: '&aYour gamemode has been changed to &cAdventure &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
# Fly messages
|
||||
EnableFlySelf: '&aYou have &cenabled &afly.'
|
||||
EnableFlyOther: '&aYou have &cenabled &afly for: &d' # Last color code is the color that the playername will show in.
|
||||
FlyEnabledOther: '&aYour fly has been &cenabled &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
DisableFlySelf: '&aYou have &cdisabled &afly.'
|
||||
DisableFlyOther: '&aYou have &cdisabled &afly for: &d' # Last color code is the color that the playername will show in.
|
||||
FlyDisabledOther: '&aYour fly has been &cdisabled &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
# Heal
|
||||
HealSelf: '&aYou have &chealed &ayourself.'
|
||||
HealOther: '&aYou have &chealed &a:&d' # Last color code is the color that the playername will show in.
|
||||
HealedOther: '&aYou have been &chealed &aby: &d' # Last color code is the color that the playername will show in.
|
||||
|
||||
# Punishments
|
||||
DefaultKick: 'You have been kicked from the server.'
|
||||
BroadcastKick: 'has been kicked for: &e' # Last color code is the color that the kick reason will show in.
|
||||
|
||||
DefaultBan: '&aYou have been banned from the server.'
|
||||
BroadcastBan: 'has been banned for: &e' # Last color code is the color that the ban reason will show in.
|
||||
|
||||
BroadcastUnban: 'has been unbanned.'
|
||||
|
||||
# Other
|
||||
CannotFindPlayer: '&4Error: Cannot find the specified player.'
|
||||
MissingPermission: '&4&lYou do not have permission to execute this command!'
|
||||
Console: '&cYou can only run this command as a player.'
|
||||
InvalidArgument: '&4Error: Invalid argument.'
|
25
resources/plugin.yml
Normal file
25
resources/plugin.yml
Normal file
@ -0,0 +1,25 @@
|
||||
name: CorePlugin
|
||||
version: 1.0.0
|
||||
main: coreplugin.coreplugin.Core
|
||||
api-version: 1.16
|
||||
authors: [ 5vl ]
|
||||
description: A Core Plugin made by 5vl.
|
||||
commands:
|
||||
gmc:
|
||||
description: Shortens /gamemode creative.
|
||||
gma:
|
||||
description: Shortens /gamemode adventure
|
||||
gmsp:
|
||||
description: Shortens /gamemode spectator
|
||||
gms:
|
||||
description: Shortens /gamemode survival
|
||||
fly:
|
||||
description: This command makes you fly!
|
||||
heal:
|
||||
description: This will heal you!
|
||||
kick:
|
||||
description: You can kick people with this!
|
||||
ban:
|
||||
description: You can ban people with this!
|
||||
unban:
|
||||
description: You can unban people with this!
|
Loading…
x
Reference in New Issue
Block a user