Skip to content

Commit

Permalink
[0.0.1pre2] Improve messages and add tokens, and add version to the c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
gdude2002 committed Jul 14, 2014
1 parent 8005480 commit 880d8f1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void onBlockBreakEvent(BlockBreakEvent event) {
this.plugin.painters.remove(player.getUniqueId());
HashMap<String, String> args = new HashMap<>();
args.put("permission", "painter.replace");
args.put("name", player.getName());

this.plugin.sendMessage(player, "replace_perm_lost", args);
return;
Expand Down
24 changes: 20 additions & 4 deletions src/com/archivesmc/painter/listeners/commandExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.HashMap;
import java.util.UUID;

public class commandExecutor implements CommandExecutor {
Expand All @@ -18,20 +19,35 @@ public commandExecutor(Painter plugin) {
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (command.getLabel().equalsIgnoreCase("painter")) {
if (!(commandSender instanceof Player)) {
this.plugin.sendMessage(commandSender, "command_player_only", null);
HashMap<String, String> args = new HashMap<>();
args.put("name", commandSender.getName());

this.plugin.sendMessage(commandSender, "command_player_only", args);
} else {
UUID id = ((Player) commandSender).getUniqueId();
if (strings.length < 1) {
if (this.plugin.permissions.has(commandSender, "painter.replace")) {
if (this.plugin.painters.contains(id)) {
this.plugin.painters.remove(id);
this.plugin.sendMessage(commandSender, "replace_mode_disable", null);

HashMap<String, String> args = new HashMap<>();
args.put("name", commandSender.getName());

this.plugin.sendMessage(commandSender, "replace_mode_disable", args);
} else {
this.plugin.painters.add(id);
this.plugin.sendMessage(commandSender, "replace_mode_enable", null);

HashMap<String, String> args = new HashMap<>();
args.put("name", commandSender.getName());

this.plugin.sendMessage(commandSender, "replace_mode_enable", args);
}
} else {
this.plugin.sendMessage(commandSender, "command_replace_no_permission", null);
HashMap<String, String> args = new HashMap<>();
args.put("permission", "painter.replace");
args.put("name", commandSender.getName());

this.plugin.sendMessage(commandSender, "command_replace_no_permission", args);
}
} else {
// TODO: Paint tool
Expand Down
20 changes: 14 additions & 6 deletions src/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ logger: logblock
# You can't leave any of these out! Make sure they're all here!
# You may also use various tokens in the messages, which will be listed in the comments below.
messages:
# Tokens: {PERMISSION}
# Tokens: {PERMISSION}, {NAME}
replace_perm_lost: "&dCMP &5\u00BB&6 Replace mode disabled, your access to it has been &crevoked"
replace_mode_enable: "&dCMP &5\u00BB&6Replace mode enabled, you are now replacing blocks"
replace_mode_disable: "&dCMP &5\u00BB&6Replace mode disabled, you are no longer replacing blocks"
# Tokens: {NAME}
replace_mode_enable: "&dCMP &5\u00BB&6 Replace mode enabled, you are now replacing blocks"
# Tokens: {NAME}
replace_mode_disable: "&dCMP &5\u00BB&6 Replace mode disabled, you are no longer replacing blocks"

command_player_only: "&dCMP &5\u00BB&6This command can only be run by a player"
command_replace_no_permission: "&dCMP &5\u00BB&6You do not have permission to toggle replace mode"
command_paint_tool_no_permission: "&dCMP &5\u00BB&6You do not have permission to use the paint tool"
# Tokens: {NAME}
command_player_only: "&dCMP &5\u00BB&6 This command can only be run by a player"
# Tokens: {PERMISSION}, {NAME}
command_replace_no_permission: "&dCMP &5\u00BB&6 You do not have permission to toggle replace mode"
# Tokens: {PERMISSION}, {NAME}
command_paint_tool_no_permission: "&dCMP &5\u00BB&6 You do not have permission to use the paint tool"

# Don't change this! You'll break stuff!
version: 0.0.1pre2
2 changes: 1 addition & 1 deletion src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Painter
version: 0.0.1pre
version: 0.0.1pre2
description: Allows the painting of wool and clay, and the replacing of blocks

author: Gareth Coles
Expand Down

0 comments on commit 880d8f1

Please sign in to comment.