2016-04-23 06:24:05 +02:00
|
|
|
package com.gmail.nossr50.commands;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.config.Config;
|
|
|
|
import com.gmail.nossr50.database.FlatfileDatabaseManager;
|
|
|
|
import com.gmail.nossr50.database.SQLDatabaseManager;
|
|
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2016-04-23 06:24:05 +02:00
|
|
|
import com.gmail.nossr50.util.player.UserManager;
|
|
|
|
import com.google.common.collect.ImmutableList;
|
2019-01-15 07:11:58 +01:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.command.TabExecutor;
|
|
|
|
|
|
|
|
import java.util.List;
|
2016-04-23 06:24:05 +02:00
|
|
|
|
|
|
|
public class MHDCommand implements TabExecutor {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
|
|
|
|
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
|
|
|
m.resetMobHealthSettings();
|
|
|
|
for (McMMOPlayer player : UserManager.getPlayers()) {
|
|
|
|
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
|
|
|
}
|
|
|
|
sender.sendMessage("Mob health reset");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (mcMMO.getDatabaseManager() instanceof FlatfileDatabaseManager) {
|
|
|
|
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
|
|
|
|
m.resetMobHealthSettings();
|
|
|
|
for (McMMOPlayer player : UserManager.getPlayers()) {
|
|
|
|
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
|
|
|
}
|
|
|
|
sender.sendMessage("Mob health reset");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
|
|
|
return ImmutableList.of();
|
|
|
|
}
|
|
|
|
}
|