Add /toggledownfall command (rip)
This commit is contained in:
parent
8dbb4671dc
commit
d365fbb89c
6 changed files with 65 additions and 1 deletions
|
@ -67,7 +67,7 @@ public class PluginInitializer {
|
||||||
|
|
||||||
// Initialize commands
|
// Initialize commands
|
||||||
logger.verb("Initializing commands");
|
logger.verb("Initializing commands");
|
||||||
commands = new CommandBase[]{new BroadcastCommand(), new DiscordCommand(), new HomeCommand(), new PluginCommand(), new SystemInformationCommand(), new TrollCommand(), new MsgCommand(), new ClearChatCommand()};
|
commands = new CommandBase[]{new BroadcastCommand(), new DiscordCommand(), new HomeCommand(), new PluginCommand(), new SystemInformationCommand(), new TrollCommand(), new MsgCommand(), new ClearChatCommand(), new ToggleDownfallCommand()};
|
||||||
|
|
||||||
// Register commands
|
// Register commands
|
||||||
logger.verb("Registering commands");
|
logger.verb("Registering commands");
|
||||||
|
|
|
@ -112,4 +112,7 @@ public class Translation {
|
||||||
|
|
||||||
// Command: /clearchat
|
// Command: /clearchat
|
||||||
public static String CLEARCHAT = "Der Chat wurde von %sender% geleert.";
|
public static String CLEARCHAT = "Der Chat wurde von %sender% geleert.";
|
||||||
|
|
||||||
|
// Command: /toggledownfall
|
||||||
|
public static String TOGGLEDOWNFALL = "Der Niederschlag wurde umgestellt.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,5 @@ public class Configuration {
|
||||||
public boolean enablePrefix = false;
|
public boolean enablePrefix = false;
|
||||||
public String inviteLink = "";
|
public String inviteLink = "";
|
||||||
public String defaultSpellingLanguage = "de_DE";
|
public String defaultSpellingLanguage = "de_DE";
|
||||||
|
public boolean useOldMcTranslationForToggleDownfall = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package de.pickshadow.plugin.commands;
|
||||||
|
|
||||||
|
import de.pickshadow.plugin.base.ObjHolder;
|
||||||
|
import de.pickshadow.plugin.base.Translation;
|
||||||
|
import de.pickshadow.plugin.classes.CommandBase;
|
||||||
|
import de.pickshadow.plugin.utils.Miscellaneous;
|
||||||
|
import de.pickshadow.plugin.utils.TabCompletionHelper;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabCompleter;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class ToggleDownfallCommand extends CommandBase {
|
||||||
|
public ToggleDownfallCommand() {
|
||||||
|
commandNames = new String[]{ "toggledownfall" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if (Miscellaneous.isCommandSentByConsole(sender, true)) return true;
|
||||||
|
Player player = (Player) sender;
|
||||||
|
World world = player.getWorld();
|
||||||
|
|
||||||
|
if (world.isClearWeather()) world.setClearWeatherDuration(new Random().nextInt(6000));
|
||||||
|
else if (world.isThundering()) {
|
||||||
|
world.setThundering(true);
|
||||||
|
world.setThunderDuration(new Random().nextInt(6000));
|
||||||
|
} else {
|
||||||
|
logger.error("Invalid weather state. isClearWeather() and isThundering() are false.");
|
||||||
|
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_EXCEPTION));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjHolder.config.useOldMcTranslationForToggleDownfall) {
|
||||||
|
if (player.locale() == Locale.GERMANY) player.sendMessage("Der Niederschlag wurde umgestellt.");
|
||||||
|
else player.sendMessage("Toggled downfall.");
|
||||||
|
}
|
||||||
|
else player.sendMessage(Miscellaneous.format(Translation.TOGGLEDOWNFALL));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TabCompleter getCompletion() {
|
||||||
|
return TabCompletionHelper.createEmptyCompletion();
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,3 +10,4 @@ version: 0
|
||||||
enablePrefix: true
|
enablePrefix: true
|
||||||
inviteLink: ""
|
inviteLink: ""
|
||||||
defaultSpellingLanguage: "de_DE"
|
defaultSpellingLanguage: "de_DE"
|
||||||
|
useOldMcTranslationForToggleDownfall: true
|
||||||
|
|
|
@ -67,6 +67,10 @@ commands:
|
||||||
usage: /clearchat
|
usage: /clearchat
|
||||||
aliases: [ "cc", "chatclear" ]
|
aliases: [ "cc", "chatclear" ]
|
||||||
permission: pickshadow.commands.clearchat
|
permission: pickshadow.commands.clearchat
|
||||||
|
toggledownfall:
|
||||||
|
description: Stellt den Niederschlag um. Erinnering an alte Zeiten.
|
||||||
|
usage: /toggledownfall
|
||||||
|
permission: pickshadow.commands.toggledownfall
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pickshadow.*:
|
pickshadow.*:
|
||||||
|
@ -87,6 +91,7 @@ permissions:
|
||||||
- pickshadow.commands.msg
|
- pickshadow.commands.msg
|
||||||
- pickshadow.commands.reply
|
- pickshadow.commands.reply
|
||||||
- pickshadow.commands.clearchat
|
- pickshadow.commands.clearchat
|
||||||
|
- pickshadow.commands.toggledownfall
|
||||||
pickshadow.commands.discord:
|
pickshadow.commands.discord:
|
||||||
default: not op
|
default: not op
|
||||||
pickshadow.commands.home:
|
pickshadow.commands.home:
|
||||||
|
@ -105,3 +110,5 @@ permissions:
|
||||||
default: not op
|
default: not op
|
||||||
pickshadow.commands.clearchat:
|
pickshadow.commands.clearchat:
|
||||||
default: op
|
default: op
|
||||||
|
pickshadow.commands.toggledownfall:
|
||||||
|
default: not op
|
||||||
|
|
Loading…
Reference in a new issue