mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
new CommandEvent
Former-commit-id: 176f8d42c330d5f240b149facae55729b37ca7a7 [formerly 9d20426be43643e435915346a66548c4f74e4e4b] Former-commit-id: 3728e32f6b17a5d72f555db4990ebffb074af25d
This commit is contained in:
1 parent
d34d6b89c8
commit
7e8d5967d2
2 files changed
+58
No files matched your search
@@ -30,6 +30,7 @@ import org.maxgamer.quickshop.Database.Database;
|
||||
import org.maxgamer.quickshop.Database.DatabaseHelper;
|
||||
import org.maxgamer.quickshop.Database.MySQLCore;
|
||||
import org.maxgamer.quickshop.Database.SQLiteCore;
|
||||
import org.maxgamer.quickshop.Events.QSCommandEvent;
|
||||
import org.maxgamer.quickshop.Shop.ContainerShop;
|
||||
import org.maxgamer.quickshop.Shop.Info;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
@@ -654,6 +655,8 @@ public class QS implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
QSCommandEvent commandEvent = new QSCommandEvent(sender, cmd, commandLabel, args);
|
||||
if(commandEvent.isCancelled())return true;
|
||||
if (args.length > 0) {
|
||||
String subArg = args[0].toLowerCase();
|
||||
if (subArg.equals("unlimited")) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.maxgamer.quickshop.Events;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class QSCommandEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private String commandLabel;
|
||||
private Command cmd;
|
||||
private CommandSender sender;
|
||||
private String[] args;
|
||||
/**Calling when QS get a /qs or /shop command**/
|
||||
public QSCommandEvent(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
this.sender = sender;
|
||||
this.cmd = cmd;
|
||||
this.commandLabel=commandLabel;
|
||||
this.args=args;
|
||||
}
|
||||
|
||||
public String[] getArgs() {
|
||||
return args;
|
||||
}
|
||||
public Command getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
public CommandSender getSender() {
|
||||
return sender;
|
||||
}
|
||||
public String getCommandLabel() {
|
||||
return commandLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user