2018-09-26 02:07:46 -06:00
|
|
|
package com.esophose.playerparticles.command;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2018-09-26 23:31:00 -06:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import com.esophose.playerparticles.manager.LangManager;
|
|
|
|
import com.esophose.playerparticles.manager.PermissionManager;
|
2018-09-26 02:07:46 -06:00
|
|
|
import com.esophose.playerparticles.manager.LangManager.Lang;
|
|
|
|
import com.esophose.playerparticles.particles.PPlayer;
|
2018-09-26 23:31:00 -06:00
|
|
|
import com.esophose.playerparticles.styles.api.ParticleStyle;
|
|
|
|
import com.esophose.playerparticles.styles.api.ParticleStyleManager;
|
2018-09-26 02:07:46 -06:00
|
|
|
|
|
|
|
public class StylesCommandModule implements CommandModule {
|
|
|
|
|
2018-09-27 18:16:50 -06:00
|
|
|
public void onCommandExecute(PPlayer pplayer, String[] args) {
|
|
|
|
Player p = pplayer.getPlayer();
|
|
|
|
|
|
|
|
if (PermissionManager.getStylesUserHasPermissionFor(p).size() == 1) {
|
2018-09-26 23:31:00 -06:00
|
|
|
LangManager.sendMessage(pplayer, Lang.NO_STYLES);
|
|
|
|
return;
|
|
|
|
}
|
2018-09-27 18:16:50 -06:00
|
|
|
|
2018-09-29 17:27:37 -06:00
|
|
|
String toSend = LangManager.getText(Lang.USE) + " ";
|
2018-09-26 23:31:00 -06:00
|
|
|
for (ParticleStyle style : ParticleStyleManager.getStyles()) {
|
|
|
|
if (PermissionManager.hasStylePermission(p, style)) {
|
|
|
|
toSend += style.getName();
|
|
|
|
toSend += ", ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (toSend.endsWith(", ")) {
|
|
|
|
toSend = toSend.substring(0, toSend.length() - 2);
|
|
|
|
}
|
2018-09-27 18:16:50 -06:00
|
|
|
|
2018-09-26 23:31:00 -06:00
|
|
|
LangManager.sendCustomMessage(p, toSend);
|
2018-09-29 17:27:37 -06:00
|
|
|
LangManager.sendCustomMessage(p, LangManager.getText(Lang.USAGE) + " " + LangManager.getText(Lang.STYLE_USAGE));
|
2018-09-27 18:16:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return "styles";
|
|
|
|
}
|
|
|
|
|
2018-09-29 17:27:37 -06:00
|
|
|
public Lang getDescription() {
|
|
|
|
return Lang.STYLES_COMMAND_DESCRIPTION;
|
2018-09-27 18:16:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getArguments() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean requiresEffects() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-09-26 02:07:46 -06:00
|
|
|
}
|