-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve code update bStats optimize pom.xml
- Loading branch information
xGinko
committed
Mar 17, 2023
1 parent
3336774
commit f53b8e6
Showing
43 changed files
with
831 additions
and
372 deletions.
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
...erCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java
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,34 @@ | ||
package me.xginko.netherceiling.commands; | ||
|
||
import me.xginko.netherceiling.NetherCeiling; | ||
import me.xginko.netherceiling.commands.netherceiling.NetherCeilingCmd; | ||
import me.xginko.netherceiling.commands.unstuck.UnstuckCmd; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandMap; | ||
import org.bukkit.command.CommandSender; | ||
|
||
import java.util.HashSet; | ||
|
||
public interface NetherCeilingCommand extends CommandExecutor { | ||
|
||
String label(); | ||
|
||
HashSet<NetherCeilingCommand> commands = new HashSet<>(); | ||
static void reloadCommands() { | ||
commands.clear(); | ||
|
||
commands.add(new NetherCeilingCmd()); | ||
commands.add(new UnstuckCmd()); | ||
|
||
NetherCeiling plugin = NetherCeiling.getInstance(); | ||
CommandMap commandMap = plugin.getServer().getCommandMap(); | ||
for (NetherCeilingCommand command : commands) { | ||
plugin.getCommand(command.label()).unregister(commandMap); | ||
plugin.getCommand(command.label()).setExecutor(command); | ||
} | ||
} | ||
|
||
@Override | ||
boolean onCommand(CommandSender sender, Command command, String label, String[] args); | ||
} |
38 changes: 0 additions & 38 deletions
38
NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
...1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java
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,73 @@ | ||
package me.xginko.netherceiling.commands.netherceiling; | ||
|
||
import me.xginko.netherceiling.commands.NetherCeilingCommand; | ||
import me.xginko.netherceiling.commands.SubCommand; | ||
import me.xginko.netherceiling.commands.netherceiling.subcommands.ReloadSubCmd; | ||
import me.xginko.netherceiling.commands.netherceiling.subcommands.VersionSubCmd; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class NetherCeilingCmd implements NetherCeilingCommand, TabCompleter { | ||
|
||
private final List<SubCommand> subcommands = new ArrayList<>(); | ||
private final List<String> tabcompleters = new ArrayList<>(); | ||
|
||
public NetherCeilingCmd() { | ||
subcommands.add(new ReloadSubCmd()); | ||
subcommands.add(new VersionSubCmd()); | ||
for (SubCommand subcommand : subcommands) { | ||
tabcompleters.add(subcommand.getName()); | ||
} | ||
} | ||
|
||
@Override | ||
public String label() { | ||
return "netherceiling"; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { | ||
if (command.getName().equalsIgnoreCase(label()) && args.length > 0 && args.length <=2) { | ||
return tabcompleters; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (command.getName().equalsIgnoreCase(label()) && args.length > 0) { | ||
boolean cmdExists = false; | ||
for (SubCommand subcommand : subcommands) { | ||
if (args[0].equalsIgnoreCase(subcommand.getName())) { | ||
subcommand.perform(sender, args); | ||
cmdExists = true; | ||
} | ||
} | ||
if (!cmdExists) showCommandOverviewTo(sender); | ||
} else { | ||
showCommandOverviewTo(sender); | ||
} | ||
return true; | ||
} | ||
|
||
private void showCommandOverviewTo(CommandSender sender) { | ||
if (!sender.hasPermission("netherceiling.cmd.*")) return; | ||
sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); | ||
sender.sendMessage(ChatColor.WHITE+"NetherCeiling Commands "); | ||
sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); | ||
sender.sendMessage(ChatColor.WHITE+"/unstuck"+ChatColor.DARK_GRAY+" - "+ChatColor.GRAY+"Teleport yourself down from the nether ceiling."); | ||
for (SubCommand subcommand : subcommands) { | ||
sender.sendMessage( | ||
ChatColor.WHITE + subcommand.getSyntax() | ||
+ ChatColor.DARK_GRAY + " - " | ||
+ ChatColor.GRAY + subcommand.getDescription() | ||
); | ||
} | ||
sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); | ||
} | ||
} |
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
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
Oops, something went wrong.