Skip to content

Commit 0310305

Browse files
committed
Add flag --show-ignored to /loadregionshows that defaults to 'false' -- this controls whether ignored regionshow schemas are printed to the user
GitOrigin-RevId: 34b6bb4b7d8d5f3ea3073964e9f9c04a1ff13bcf
1 parent f98585d commit 0310305

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/us/mcparks/showscript/RegionShowListener.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,25 @@ private void loadRegionShows() {
7070
}
7171

7272
private void loadRegionShows(Path path) {
73-
loadRegionShows(path, null);
73+
loadRegionShows(path, null, true);
7474
}
7575

76-
private void loadRegionShows(Path path, CommandSender sender) {
76+
private void loadRegionShows(Path path, CommandSender sender, boolean showIgnored) {
7777
if (sender != null) sender.sendMessage("Loading region shows in " + path.toString().substring(Main.getPlugin(Main.class).fs.toPath().toString().length()));
7878
try {
7979
Files.walk(path)
8080
.filter(Files::isRegularFile)
8181
.filter(file -> file.toString().endsWith("_regionshowschema.yml"))
8282
.forEach(file -> {
83-
loadRegionShow(file.toFile(), sender);
83+
loadRegionShow(file.toFile(), sender, showIgnored);
8484
});
8585
} catch (IOException e) {
8686
// TODO Auto-generated catch block
8787
e.printStackTrace();
8888
}
8989
}
9090

91-
private boolean loadRegionShow(String regionShowName) {
92-
return loadRegionShow(regionShowName, null);
93-
}
94-
95-
private boolean loadRegionShow(String regionShowName, CommandSender sender) {
96-
return loadRegionShow(new File(Main.getPlugin(Main.class).fs, regionShowName + ".yml"), null);
97-
}
98-
99-
private boolean loadRegionShow(File f, CommandSender sender) {
91+
private boolean loadRegionShow(File f, CommandSender sender, boolean alertIfIgnored) {
10092
if (!f.exists()) {
10193
return false;
10294
}
@@ -210,7 +202,7 @@ private boolean loadRegionShow(File f, CommandSender sender) {
210202

211203

212204

213-
if (isIgnored) {
205+
if (isIgnored && alertIfIgnored) {
214206
if (sender != null) sender.sendMessage("Ignoring region show schema " + f.getName() + "(if it was previously running, it has been unloaded)");
215207
return true;
216208
}
@@ -275,8 +267,8 @@ public void reloadRegionShows() {
275267

276268
@CommandMethod("loadregionshows <path>")
277269
@CommandPermission("castmember")
278-
public void loadRegionShowsCommand(CommandSender sender, @Argument(value="path", suggestions = "showDirectoryNames") String path) {
279-
loadRegionShows(new File(Main.getPlugin(Main.class).fs, path).toPath(), sender);
270+
public void loadRegionShowsCommand(CommandSender sender, @Argument(value="path", suggestions = "showDirectoryNames") String path, @Flag(value="show-ignored") boolean showIgnored) {
271+
loadRegionShows(new File(Main.getPlugin(Main.class).fs, path).toPath(), sender, showIgnored);
280272
}
281273

282274
@CommandMethod("reloadregionshows")

0 commit comments

Comments
 (0)