Skip to content

Commit

Permalink
[Haro] Write README.md
Browse files Browse the repository at this point in the history
Add /spawn as alias to /harospawn
  • Loading branch information
Kakifrucht committed Oct 7, 2019
1 parent 826e104 commit a20625d
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 12 deletions.
39 changes: 35 additions & 4 deletions HalfminerHaro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,39 @@

# Current features

- Implements it's own whitelist, only added players can join, or players that have the permission *hmh.admin*
- TODO
- This plugin is meant to fully convert your server into a Haro server, and thus not really compatible with other Arena plugins, like HalfminerBattle.
- Implements it's own whitelist, only added players can join, or players that have the permission *hmh.admin*.
- Added players can always join the server, even if the game wasn't started yet, use Vanilla whitelist in conjuction to prevent this if necessary.
- When the game is running, shows the time left and playercount in the tablist.
- Kicks players after their playtime is over.
- Displays countdown to warn players before their time is running out.
- Kicks a player after being eliminated from the game.
- **Commands**
- */haro add*
- */haro remove*
- */haro <add|remove> \<Player>*
- Add or remove a player from the game.
- Added players can join the server before the game was started.
- Players can be removed during the game, as a disqualification measure.
- Players that haven't joined the server before can also be added.
- */haro addtime <-day|-all|Player> [time]*
- Add play time to either all players or a specific player.
- When using */haro addtime -day*, all players will get the time in seconds specified in config.
- Set this command to execute whenever a new day is starting via some external task scheduler.
- To remove time from a player, use a negative value.
- Players who are online will receive a notification that their playtime was changed.
- Will take into account the maximum time a player can accumulate.
- */haro end*
- End the currently running game, by resetting it's state and clearing all added players.
- Will print a warning, if more than one player is still in the game.
- */haro setspawn*
- Will set the spawn point to the location the executing player is currently at.
- Spawn point will be used for respawns, and as the starting point when the game starts.
- Access the spawn point by using */harospawn* (or */spawn*, if not overloaded).
- */haro start*
- Start a game, at least two players must be added to the game.
- Will run custom commands defined in the config file once when the game starts.
- Will run custom commands to initialize all online players, players who are not online during the start will be initialized after their first join.
- Will teleport all players to the specified spawn point, if their distance to it is higher than specified in the config file.
- Will add the starting time (specified in config file) to all players as their remaining time left.
- */haro status*
- Prints current game information (is the game running/over?).
- Shows all added players, their online/elimination status, and their remaining time, if not yet eliminated.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
String[] argsTruncated = args;
HaroCommand haroCommand;

if (label.equalsIgnoreCase("harospawn")) {
if (label.toLowerCase().endsWith("harospawn") || label.toLowerCase().endsWith("spawn")) {
haroCommand = new Cmdsetspawn(true);
} else {

Expand Down
12 changes: 6 additions & 6 deletions HalfminerHaro/src/main/java/de/halfminer/hmh/HaroListeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ public void onLogin(PlayerLoginEvent e) {
haroPlayer = haroStorage.getHaroPlayer(e.getPlayer().getName());
}

String disallowMessageKey = null;
String kickMessageKey = null;
if (!haroPlayer.isAdded()) {
disallowMessageKey = "listenerNotAdded";
kickMessageKey = "listenerNotAdded";
} else if (haroStorage.isGameRunning()) {

if (haroPlayer.isEliminated()) {
disallowMessageKey = "listenerAlreadyEliminated";
kickMessageKey = "listenerAlreadyEliminated";
}

if (!haroPlayer.hasTimeLeft()) {
disallowMessageKey = "listenerNoTimeLeft";
kickMessageKey = "listenerNoTimeLeft";
}
}

if (disallowMessageKey != null) {
String kickMessage = MessageBuilder.returnMessage(disallowMessageKey, hmh, false);
if (kickMessageKey != null) {
String kickMessage = MessageBuilder.returnMessage(kickMessageKey, hmh, false);
e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, kickMessage);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import de.halfminer.hms.util.Utils;
import org.bukkit.entity.Player;

/**
* - Add or remove a player from the game.
* - Added players can join the server before the game was started.
* - Players can be removed during the game, as a disqualification measure.
* - Players that haven't joined the server before can also be added.
*/
public class Cmdaddremove extends HaroCommand {

private final boolean add;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
import java.util.ArrayList;
import java.util.List;

/**
* - Add play time to either all players or a specific player.
* - When using /haro addtime -day, all players will get the time in seconds specified in config.
* - Set this command to execute whenever a new day is starting via some external task scheduler.
* - To remove time from a player, use a negative value.
* - Players who are online will receive a notification that their playtime was changed.
* - Will take into account the maximum time a player can accumulate.
*/
public class Cmdaddtime extends HaroCommand {

public Cmdaddtime() {
Expand Down
4 changes: 4 additions & 0 deletions HalfminerHaro/src/main/java/de/halfminer/hmh/cmd/Cmdend.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import de.halfminer.hms.util.MessageBuilder;
import org.bukkit.entity.Player;

/**
* - End the currently running game, by resetting it's state and clearing all added players.
* - Will print a warning, if more than one player is still in the game.
*/
public class Cmdend extends HaroCommand {

public Cmdend() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import de.halfminer.hms.util.MessageBuilder;
import org.bukkit.Location;

/**
* - Will set the spawn point to the location the executing player is currently at.
* - Spawn point will be used for respawns, and as the starting point when the game starts.
* - Access the spawn point by using /harospawn (or /spawn, if not overloaded).
*/
public class Cmdsetspawn extends HaroCommand {

private final boolean teleport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import de.halfminer.hmh.data.HaroPlayer;
import de.halfminer.hms.util.MessageBuilder;

/**
* - Start a game, at least two players must be added to the game.
* - Will run custom commands defined in the config file once when the game starts.
* - Will run custom commands to initialize all online players, players who are not online during the start will be initialized after their first join.
* - Will teleport all players to the specified spawn point, if their distance to it is higher than specified in the config file.
* - Will add the starting time (specified in config file) to all players as their remaining time left.
*/
public class Cmdstart extends HaroCommand {

public Cmdstart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

import java.util.List;

/**
* - Prints current game information (is the game running/over?).
* - Shows all added players, their online/elimination status, and their remaining time, if not yet eliminated.
*/
public class Cmdstatus extends HaroCommand {

public Cmdstatus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

/**
* Abstract base class for every Haro command.
*/
public abstract class HaroCommand extends HaroClass {

private static final String BASE_PERMISSION = "hmh.cmd.";
Expand Down
2 changes: 1 addition & 1 deletion HalfminerHaro/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ depend: [HalfminerSystem]
commands:
haro:
description: Base admin command
aliases: [hmh, harospawn]
aliases: [hmh, harospawn, spawn]

permissions:
hmh.*:
Expand Down

0 comments on commit a20625d

Please sign in to comment.