Skip to content

Commit a80c63c

Browse files
committed
Add reload command
1 parent 71908df commit a80c63c

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>adhdmc</groupId>
88
<artifactId>InvisibleFrames</artifactId>
9-
<version>0.1</version>
9+
<version>1.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>InvisibleFrames</name>

src/main/java/adhdmc/invisibleframes/ClickListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.bukkit.event.player.PlayerInteractEntityEvent;
1212
import org.bukkit.inventory.EquipmentSlot;
1313

14-
public class ClickListener implements Listener {
14+
public class ClickListener implements Listener {
1515

1616
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
1717
public void onItemFrameInteract(PlayerInteractEntityEvent event) {

src/main/java/adhdmc/invisibleframes/InvisibleFrames.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package adhdmc.invisibleframes;
22

3-
import org.bukkit.permissions.Permission;
43
import org.bukkit.plugin.java.JavaPlugin;
54

65
public final class InvisibleFrames extends JavaPlugin {
@@ -10,6 +9,7 @@ public final class InvisibleFrames extends JavaPlugin {
109
@Override
1110
public void onEnable() {
1211
this.getServer().getPluginManager().registerEvents(new ClickListener(), this);
12+
this.getCommand("ifreload").setExecutor(new ReloadCommand());
1313
this.saveDefaultConfig();
1414
getConfig().addDefault("lock-frame", true);
1515
getConfig().addDefault("toggle-empty", false);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package adhdmc.invisibleframes;
2+
3+
import org.bukkit.command.Command;
4+
import org.bukkit.command.CommandExecutor;
5+
import org.bukkit.command.CommandSender;
6+
import org.bukkit.command.TabCompleter;
7+
import org.jetbrains.annotations.NotNull;
8+
import org.jetbrains.annotations.Nullable;
9+
10+
import java.util.List;
11+
12+
public class ReloadCommand implements CommandExecutor, TabCompleter {
13+
@Override
14+
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
15+
if (!commandSender.hasPermission("invisibleframes.reload")) {
16+
commandSender.sendMessage("You do not have permission for this");
17+
return false;
18+
}
19+
InvisibleFrames.getInstance().reloadConfig();
20+
commandSender.sendMessage("[InvisibleFrames] Configuration Reloaded");
21+
return true;
22+
}
23+
24+
@Override
25+
public @Nullable List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
26+
return null;
27+
}
28+
}

src/main/resources/plugin.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ name: InvisibleFrames
22
version: '${project.version}'
33
main: adhdmc.invisibleframes.InvisibleFrames
44
api-version: 1.18
5-
prefix: "[ Invisible Frames ]"
5+
prefix: "[Invisible Frames]"
66
authors: [ _Rhythmic ]
77
description: Allows easy toggling of item frames from visible to invisible
8+
commands:
9+
ifreload:
10+
permission: invisibleframes.reload
11+
description: Reloads invisible frames config
812
permissions:
913
invisibleframes.toggleframes:
1014
default: op
1115
description: Allows user to toggle item frames between invisible, or visible
16+
invisibleframes.reload:
17+
default: op
18+
description: Allows user to reload config

0 commit comments

Comments
 (0)