Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Asintotoo authored Aug 19, 2024
1 parent 3275423 commit 4de973d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.asintoto</groupId>
<artifactId>Basic</artifactId>
<version>1.2.13</version>
<version>1.2.14</version>
<packaging>jar</packaging>

<name>Basic</name>
Expand Down
31 changes: 29 additions & 2 deletions src/main/java/com/asintoto/basic/commands/BasicCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@

public abstract class BasicCommand implements CommandExecutor, TabCompleter {

protected List<String> NO_COMPLETE = Collections.emptyList();
protected List<String> PLAYER_LIST = null;
protected final List<String> NO_COMPLETE = Collections.emptyList();
protected final List<String> PLAYER_LIST = null;
protected String label;

protected CommandSender sender;
protected String[] args;

private String usage;
private String permission;

public BasicCommand(String label) {
this.label = label;
this.usage = ColorLib.setColors("&cUsage: /" + label + " <params...>");
this.permission = Basic.getPlugin().getName().toLowerCase() + ".command." + label;
}

@Override
Expand Down Expand Up @@ -93,4 +95,29 @@ protected void sendMessage(String msg) {
public String getLabel() {
return label;
}

protected boolean hasPermission(CommandSender p) {
return p.hasPermission(permission);
}

protected boolean hasPermission(Player p) {
return p.hasPermission(permission);
}

protected boolean hasPermission() {
return sender.hasPermission(permission);
}

protected String getPermission() {
return this.permission;
}

protected void setPermission(String permission) {
this.permission = permission;
}

protected void printNoPermission() {
String msg = "&c&lYou do not have the permission to perform this command &r&8(" + permission + ")";
sendMessage(msg);
}
}
6 changes: 5 additions & 1 deletion src/main/java/com/asintoto/basic/items/ItemCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public ItemCreator(Material item, int amount, int damage) {
lore = new ArrayList<>();
flags = new ArrayList<>();

this.meta = this.item.getItemMeta();
if(this.item.getType() != Material.AIR
&& this.item.getType() != Material.CAVE_AIR
&& this.item.getType() != Material.VOID_AIR) {
this.meta = this.item.getItemMeta();
}
}

public ItemCreator(Material item) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/asintoto/basic/menu/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;


public class Menu {
public abstract class Menu {

private Inventory inventory;

Expand Down Expand Up @@ -87,7 +87,12 @@ public void setTitle(String title) {
this.title = ColorLib.setColors(title);
}

@Deprecated
public void addButton(Button button, int slot) {
setButton(button, slot);
}

public void setButton(Button button, int slot) {
this.inventory.setItem(slot, button.getItem());
this.buttonSlotMap.put(slot, button);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/asintoto/basic/utils/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ public static void warning(String msg) {
public static void success(String msg) {
Basic.sendConsoleMessage(successPrefix + msg);
}

public static void message(String msg) {
Basic.sendConsoleMessage(msg);
}
}

0 comments on commit 4de973d

Please sign in to comment.