Skip to content

Commit

Permalink
Players with the permission « uh.build » can build before the beginni…
Browse files Browse the repository at this point in the history
…ng of the game.

Also:
 - permissions are listed in the plugin.yml file, with description and default (op for all perms).
  • Loading branch information
AmauryCarrade committed Jul 10, 2014
1 parent 39441fa commit 43b20a7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
45 changes: 43 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,46 @@ version: 0.1

commands:
uh:
description: Ultra Harcore
usage: /uh <subcommand>
description: Ultra Harcore base command
usage: /uh <subcommand>

permissions:
uh.*:
description: Gives access to all Ultra Hardcore commands.
children:
uh.build: true
uh.start: true
uh.shift: true
uh.team: true
uh.addspawn: true
uh.generatewalls: true
uh.heal: true
uh.healall: true
uh.resurrect: true
uh.build:
description: Allows an user to build before the beginning of the game
default: op
uh.start:
description: Allows an user to start the game with /uh start
default: op
uh.shift:
description: Allows an user to shift an episode using /uh shift
default: op
uh.team:
description: Allows an user to manage the teams with /uh team *
default: op
uh.addspawn:
description: Allows an user to add a spawn point
default: op
uh.generatewalls:
description: Allows an user to generate the walls around the map
default: op
uh.heal:
description: Allows an user to heal a player using /uh heal <player> [half-hearts]
default: op
uh.healall:
description: Allows an user to heal ALL players using /uh healall [half-hearts]
default: op
uh.resurrect:
description: Allows an user to resurrect an other player with /uh resurrect <player>
default: op
8 changes: 6 additions & 2 deletions src/me/azenet/UHPlugin/UHPluginListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ public void run() {
*/
@EventHandler
public void onBlockBreakEvent(final BlockBreakEvent ev) {
if (!this.p.getGameManager().isGameRunning()) ev.setCancelled(true);
if (!this.p.getGameManager().isGameRunning() && !((Player)ev.getPlayer()).hasPermission("uh.build")) {
ev.setCancelled(true);
}
}

/**
Expand All @@ -215,7 +217,9 @@ public void onBlockBreakEvent(final BlockBreakEvent ev) {
*/
@EventHandler
public void onBlockPlaceEvent(final BlockPlaceEvent ev) {
if (!this.p.getGameManager().isGameRunning()) ev.setCancelled(true);
if (!this.p.getGameManager().isGameRunning() && !((Player)ev.getPlayer()).hasPermission("uh.build")) {
ev.setCancelled(true);
}
}

/**
Expand Down

0 comments on commit 43b20a7

Please sign in to comment.