Wrote the help text for all commands

This commit is contained in:
alisolarflare 2016-11-13 17:00:00 -05:00
parent e089d8ff12
commit 728674335a
19 changed files with 166 additions and 137 deletions

View file

@ -11,8 +11,11 @@ public abstract class ModCommand extends TBMCCommandBase{
@Override
public String[] GetHelpText(String alias){
return new String[] {"This command doesn't have help text, ask a dev to add one, using public String[] GetHelpText. "
+ "If you're a dev, write the help text you lazy bastard. -Ali"};
return new String[] {
"This command doesn't have help text, ask a dev to add one",
" using public String[] GetHelpText. ",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
@Override

View file

@ -16,9 +16,12 @@ public abstract class PlayerCommand extends TBMCCommandBase{
}
@Override
public String[] GetHelpText(String alias){
return new String[] {"This command doesn't have help text, ask a mod to ask a dev to add one, using public String[] GetHelpText. "
+ "If you're a mod, ask a dev to write the help text." +
"If you're a dev, write the help text you lazy bastard. -Ali"};
return new String[] {
"This command doesn't have help text, ask a mod to ask a ",
"dev to add one using public String[] GetHelpText. ",
"If you're a mod, ask a dev to write the help text.",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -19,12 +19,9 @@ public class PressAliLink extends PlayerCommand {
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.getServer().broadcastMessage(linkList.toString() + "over.");
if (args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [frequency]");
return false;
}
for (Link link : linkList) {
for (String inputlink : args) {
@ -33,6 +30,13 @@ public class PressAliLink extends PlayerCommand {
}
}
}
return false;
sender.sendMessage("Link pressed!");
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /pressalilink <frequency>"
};
}
}

View file

@ -1,6 +1,5 @@
package alisolarflare.components.alilinks.commands;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -9,7 +8,6 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.alilinks.entities.Link;
@ -51,13 +49,21 @@ public class SetAliLink extends PlayerCommand {
z = Double.parseDouble(args[3]);
}
}
Link link = new Link(frequency, world, x, y, z);
linkList.add(link);
linkData.add(link.toMap());
saveLinkList();
return true;
}
private void saveLinkList(){
config.set("aliLinkList", linkData);
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /setalilink <frequency> [x] [y] [z]"
};
}
}

View file

@ -1,5 +1,7 @@
package alisolarflare.components.creativeboundaries.commands;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -9,10 +11,10 @@ import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
public class Cbgm0 extends PlayerCommand{
private CreativeBoundariesComponent module;
private List<Player> cbCreatives;
public Cbgm0(CreativeBoundariesComponent module) {
this.module = module;
public Cbgm0(CreativeBoundariesComponent component) {
this.cbCreatives = component.cbCreatives;
}
@Override
@ -24,7 +26,12 @@ public class Cbgm0 extends PlayerCommand{
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL);
module.cbCreatives.remove(player);
return false;
cbCreatives.remove(player);
return true;
}
public String[] GetHelpText(String alias){
return new String[]{
"Creative Boundaries Usage: /cbgm0"
};
}
}

View file

@ -1,5 +1,7 @@
package alisolarflare.components.creativeboundaries.commands;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -15,25 +17,21 @@ import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
public class Cbgm1 extends PlayerCommand {
private CreativeBoundariesComponent module;
List<Player> cbCreatives;
public Cbgm1(CreativeBoundariesComponent module) {
this.module = module;
public Cbgm1(CreativeBoundariesComponent component) {
this.cbCreatives = component.cbCreatives;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("Some error occured.");
player.sendMessage("TownBlock is null.");
return false;
}
@ -41,23 +39,30 @@ public class Cbgm1 extends PlayerCommand {
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("TownBlock's town is not registered.");
return false;
}
if (town == null) {
player.sendMessage("ERROR: The town you're standing in is Null.");
player.sendMessage("You aren't standing in a town, head to your home town to use this command.");
return false;
}
boolean playerIsInTown = false;
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE);
module.cbCreatives.add(player);
return true;
playerIsInTown = true;
break;
}
}
player.sendMessage("Sorry, you're not part of this town");
return false;
if (!playerIsInTown){
player.sendMessage("Sorry, you're not part of this town");
return false;
}
player.setGameMode(GameMode.CREATIVE);
cbCreatives.add(player);
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[] {
"Usage: When in a town that you either own or are a resident of, type /cbgm1 to gain creative"
};
}
}

View file

@ -2,35 +2,33 @@ package alisolarflare.components.creativeboundaries.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.ModCommand;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
public class SetDickmode extends PlayerCommand{
private CreativeBoundariesComponent module;
public class SetDickmode extends ModCommand{
boolean dickMode;
public SetDickmode(CreativeBoundariesComponent module){
this.module = module;
public SetDickmode(CreativeBoundariesComponent component){
this.dickMode = component.dickmode;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){
if(args[0] == null){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!");
module.dickmode=(true);
return true;
}
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!");
module.dickmode=(false);
return true;
}
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if(args.length < 1){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
String firstArgument = args[0];
if(firstArgument.startsWith("t") || firstArgument.equals("1")){
sender.sendMessage("Dickmode has been turned on!");
dickMode = true;
return true;
}
if(firstArgument.startsWith("f") || firstArgument.equals("0")){
sender.sendMessage("Dickmode has been turned off!");
dickMode = false;
return true;
}
return false;
}
}

View file

@ -1,11 +1,6 @@
package alisolarflare.components.creativeboundaries.listeners;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCreativeEvent;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
@ -16,11 +11,4 @@ public class ItemRestrictionListener implements Listener {
public ItemRestrictionListener(CreativeBoundariesComponent module) {
this.module = module;
}
@EventHandler
public void onItemTake(InventoryCreativeEvent event){
List<Player> cbCreatives = module.cbCreatives;
}
}

View file

@ -1,5 +1,7 @@
package alisolarflare.components.creativeboundaries.listeners;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -15,27 +17,30 @@ import com.palmergames.bukkit.towny.object.TownyUniverse;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
public class PlotChangeListener implements Listener{
public CreativeBoundariesComponent module;
private boolean dickmode;
private List<Player> cbCreatives;
public PlotChangeListener(CreativeBoundariesComponent module){
this.module = module;
this.dickmode = module.dickmode;
this.cbCreatives = module.cbCreatives;
}
@EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
Player player = plotEvent.getPlayer();
if (module.dickmode == false){
if (dickmode == false){
return;
}
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
return;
}
if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){
if (!(cbCreatives.contains(plotEvent.getPlayer()))){
return;
}
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!");
module.cbCreatives.remove(player);
cbCreatives.remove(player);
return;
}
Town town;
@ -44,14 +49,14 @@ public class PlotChangeListener implements Listener{
} catch (NotRegisteredException e) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!");
module.cbCreatives.remove(player);
cbCreatives.remove(player);
return;
}
if (town == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!");
module.cbCreatives.remove(player);
cbCreatives.remove(player);
return;
}
boolean townHasRes = false;
@ -63,7 +68,7 @@ public class PlotChangeListener implements Listener{
if (!townHasRes){
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!!");
module.cbCreatives.remove(player);
cbCreatives.remove(player);
}
}
}

View file

@ -12,11 +12,13 @@ public class FlairMe extends PlayerCommand {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
PortalListener.playersToBeFlaired.add((Player) sender);
sender.sendMessage("Setup Successful! Walk through a portal to get your flair");
return false;
return true;
}
@Override
public String GetCommandPath() {
return "flairme";
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /flairme and enter a portal with coloured",
"wool underneath to change your flair"
};
}
}

View file

@ -16,10 +16,6 @@ public class GPower extends PlayerCommand {
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("G power activate!");
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command! Talk to a dev/ali if you think this is wrong");
}
Player player = (Player) sender;
if (args.length < 2) {
player.sendMessage("Proper Usage to test G-Powers:");
@ -32,7 +28,6 @@ public class GPower extends PlayerCommand {
colour = args[0];
} else {
player.sendMessage("error: colour. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]");
return false;
}
boolean isActive;
@ -42,18 +37,22 @@ public class GPower extends PlayerCommand {
isActive = false;
} else {
player.sendMessage("error: active. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
player.sendMessage("Terms Vaild!");
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
gPowerMemory.configurePlayer(player, colour, isActive);
return false;
return true;
}
@Override
public String GetCommandPath() {
return "gpower";
}
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]"
};
}
}

View file

@ -17,6 +17,11 @@ public class PowerAll extends ModCommand{
for (poweredPlayer poweredPlayer : gPowerMemory.poweredPlayerList.values()){
poweredPlayer.isPowersActive = true;
}
return false;
return true;
}
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /PowerAll to activate all powers for all players with gpowers"
};
}
}

View file

@ -16,15 +16,14 @@ public class PowerDown extends PlayerCommand {
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command! Contact dev/ali if you think this is wrong");
Player player = (Player) sender;
gPowerMemory.PowerDownPlayer(player);
return false;
return true;
}
@Override
public String GetCommandPath() {
return "powerdown";
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /PowerDown to disable your g-power"
};
}
}

View file

@ -21,11 +21,12 @@ public class PowerUp extends PlayerCommand {
Player player = (Player) sender;
gPowerMemory.PowerUpPlayer(player);
return false;
return true;
}
@Override
public String GetCommandPath() {
return "powerup";
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /PowerUp to activate your registered G-Power"
};
}
}

View file

@ -22,7 +22,6 @@ public class BoomBowRule extends ModCommand{
return false;
}
if (args.length < 2){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rules:");
player.sendMessage("boomDecay" + boomDecay);
player.sendMessage("healthReduction" + healthReduction);
@ -31,7 +30,6 @@ public class BoomBowRule extends ModCommand{
return false;
}
if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
return false;
}
boolean gameRule = false;
@ -53,21 +51,16 @@ public class BoomBowRule extends ModCommand{
break;
default:
player.sendMessage("Error: "+args[0]+" not defined as a rule");
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rule settings: boomDecay, healthReduction, endCrystal, localized");
break;
return false;
}
return false;
return true;
}
@Override
public String GetCommandPath() {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] GetHelpText(String arg0) {
// TODO Auto-generated method stub
return null;
public String[] GetHelpText(String alias) {
return new String[]{
"Usage: /boomBowRule [rulename] [true/false]",
"Rule settings: boomDecay, healthReduction, endCrystal, localized"
};
}
}

View file

@ -1,7 +1,6 @@
package alisolarflare.components.minigames.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.minigames.MinigameModule;
@ -14,16 +13,11 @@ public class JoinMinigame extends PlayerCommand {
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
String name = sender.getName();
if (module.fighters.contains(name)) {
sender.sendMessage("You are already in the minigame!");
return false;
return true;
}
module.fighters.add(name);
@ -31,6 +25,12 @@ public class JoinMinigame extends PlayerCommand {
if (module.fighters.contains(name)) {
sender.sendMessage("You have joined the minigame!");
}
return false;
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /JoinMinigame to join a current button minigame!"
};
}
}

View file

@ -23,7 +23,7 @@ public class LeaveMinigame extends PlayerCommand {
String name = sender.getName();
if (!(module.fighters.contains(name))) {
sender.sendMessage("You are not fighting!");
return false;
return true;
}
while(module.fighters.contains(name)){
@ -31,6 +31,12 @@ public class LeaveMinigame extends PlayerCommand {
}
sender.sendMessage("You have left the fighters category!");
return false;
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /LeaveMinigame to leave the current minigame!"
};
}
}

View file

@ -15,6 +15,12 @@ public class ListFighters extends PlayerCommand {
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
sender.sendMessage(lobby.fighters.toString());
return false;
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: Type /ListFighters to get the list of fighters in the current minigame"
};
}
}

View file

@ -3,10 +3,10 @@ package alisolarflare.components.minigames.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.ModCommand;
import alisolarflare.components.minigames.data.SpawnSet;
public class SetColourSpawn extends PlayerCommand{
public class SetColourSpawn extends ModCommand{
private SpawnSet spawnSet;
public SetColourSpawn(SpawnSet spawnSet){
@ -14,15 +14,8 @@ public class SetColourSpawn extends PlayerCommand{
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("ERROR: You must be a player to use this command!");
Player player = (Player) sender;
if(!(player.getName().equalsIgnoreCase("Alisolarflare")))
player.sendMessage("ERROR: You must be Alisolarflare to use this command!");
if(args.length == 0){
sender.sendMessage("ERROR: Arguments required.");
return false;
@ -63,6 +56,12 @@ public class SetColourSpawn extends PlayerCommand{
sender.sendMessage("Purple Spawn Set!");
break;
}
return false;
return true;
}
public String[] GetHelpText(String alias){
return new String[] {
"Usage: /SetColourSpawn <colour>",
"Colours: red, orange, yellow, green, blue, purple"
};
}
}