Implement cooldown clearing and finish chatmod changes
This commit is contained in:
parent
2cd17709d0
commit
94973b8296
|
@ -51,6 +51,8 @@ import lv.pi.animalrp.animals.Cat;
|
|||
import lv.pi.animalrp.animals.Fox;
|
||||
import lv.pi.animalrp.commands.EmoteCommand;
|
||||
import lv.pi.animalrp.commands.InteractionCommand;
|
||||
import lv.pi.animalrp.commands.ChatModCommand;
|
||||
import lv.pi.animalrp.commands.ClearCooldownCommand;
|
||||
import lv.pi.animalrp.commands.SexCommand;
|
||||
import lv.pi.animalrp.commands.TfCommand;
|
||||
import lv.pi.animalrp.listeners.AntiElytra;
|
||||
|
@ -185,6 +187,13 @@ public class AnimalRP extends JavaPlugin {
|
|||
getCommand("emote").setExecutor(new EmoteCommand());
|
||||
getCommand("sex").setExecutor(new SexCommand());
|
||||
|
||||
ChatModCommand cmc = new ChatModCommand();
|
||||
|
||||
getCommand("chatmodoff").setExecutor(cmc);
|
||||
getCommand("chatmodon").setExecutor(cmc);
|
||||
|
||||
getCommand("clearcooldown").setExecutor(new ClearCooldownCommand());
|
||||
|
||||
getCommand("headpats").setExecutor(new InteractionCommand(Mood.HAPPY, "%s petted you! %s", "You petted %s! %s"));
|
||||
getCommand("kiss").setExecutor(new InteractionCommand(Mood.CUTE, "%s kissed you.. 0////0 %s", "You kissed %s.. 0////0 %s"));
|
||||
getCommand("bite").setExecutor(new InteractionCommand(Mood.ANGRY, "%s bit you!! Σ(っ゚Д゚)っ %s", "You bit %s! (○`д´)ノシ %s"));
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package lv.pi.animalrp.commands;
|
||||
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import lv.pi.animalrp.AnimalRP;
|
||||
import lv.pi.animalrp.util.Cooldown;
|
||||
|
||||
public class ClearCooldownCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<gray>I'm sorry console. :(</gray>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player)sender;
|
||||
|
||||
if(!player.isOp()) {
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<red>You are not an OP!"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length == 0) {
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<red>Include player!"));
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = args[0];
|
||||
OfflinePlayer of = Bukkit.getOfflinePlayer(playerName);
|
||||
if(of == null) {
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<red>User has never joined."));
|
||||
return true;
|
||||
}
|
||||
|
||||
Cooldown cooldown = AnimalRP.cooldowns.get(of.getUniqueId());
|
||||
|
||||
if(cooldown == null) {
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<red>User does not have a cooldown set."));
|
||||
return true;
|
||||
}
|
||||
|
||||
AnimalRP.cooldowns.remove(of.getUniqueId());
|
||||
sender.sendMessage(AnimalRP.mm.deserialize("<red>Removed" + of.getName() + "'s cooldown (type: " + cooldown.type + ")!"));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,12 @@ commands:
|
|||
bite:
|
||||
aliases: lovebite
|
||||
usage: Bite someone! (cutely)
|
||||
chatmodoff:
|
||||
usage: Disable the chat modification done by animals!
|
||||
chatmodon:
|
||||
usage: Enable the chat modification done by animals!
|
||||
clearcooldown:
|
||||
usage: Clears the specified user's cooldown.
|
||||
purr:
|
||||
aliases: [mrrow, meow]
|
||||
usage: Purr to someone! :3
|
||||
|
|
Loading…
Reference in a new issue