Skip to content

Commit

Permalink
Bug Fixes 4
Browse files Browse the repository at this point in the history
- Fix some 'NullPointerException' bugs.
  • Loading branch information
aappleton8 committed Sep 23, 2018
1 parent a06a6f1 commit 18605ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion PlayerSlap/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PlayerSlap
main: me.PlayerSlap.MainClasses.PlayerSlapMainClass
version: Development_0.0.0.4
version: Development_0.0.0.5
description: A plugin to slap players
author: aappleton3
database: false
Expand Down
28 changes: 16 additions & 12 deletions PlayerSlap/src/me/PlayerSlap/CommandClasses/SlapInfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ else if (args[0].equalsIgnoreCase("player")) {
String sid = pid.toString();
s.sendMessage(ChatColor.AQUA + "The player " + args[1] + " has the following information: ");
s.sendMessage("Is exempt: " + plugin.yd.configuration.getString("players." + sid + ".exempt"));
s.sendMessage("This player has been slapped " + plugin.yd.configuration.getString("player." + sid + ".times") + " times ");
s.sendMessage("This player has been slapped " + plugin.yd.configuration.getString("players." + sid + ".times") + " times ");
if (plugin.needAcceptPlayers.containsKey(pid)) {
s.sendMessage(ChatColor.RED + "This player is currently under a slap ");
s.sendMessage("Player must accept slap: " + plugin.needAcceptPlayers.get(pid).getKey().toString());
Expand Down Expand Up @@ -172,7 +172,7 @@ else if (args[0].equalsIgnoreCase("times")) {
plugin.ms.sendMessage(s, "noplayerconfig", null);
}
else {
s.sendMessage("The player " + args[1] + " has been slapped " + plugin.yd.configuration.getString("player." + pid.toString() + ".times") + " times ");
s.sendMessage("The player " + args[1] + " has been slapped " + plugin.yd.configuration.getString("players." + pid.toString() + ".times") + " times ");
}
}
else {
Expand All @@ -187,15 +187,20 @@ else if (args[0].equalsIgnoreCase("times")) {
else if (args[0].equalsIgnoreCase("general")) {
if (args.length == 1) {
if (s.hasPermission("playerslap.info.general")) {
s.sendMessage("General " + plugin.descriptionFile.getName() + " plugin config information: ");
s.sendMessage("Players can slap themselves: " + plugin.yc.configuration.getString("slapself"));
s.sendMessage("Default slap type: " + plugin.yc.configuration.getString("slapdefault"));
s.sendMessage("Player slap counts incremented on '/slapall' command uses: " + plugin.yc.configuration.getString("incrementonslapall"));
s.sendMessage("Slap accept broadcast message: " + plugin.yc.configuration.getString("messages.accept").replaceAll("__Default", plugin.ms.acceptSlapMessage));
s.sendMessage("Personal slap release message: " + plugin.yc.configuration.getString("messages.releasepersonal").replaceAll("__Default", plugin.ms.personalReleaseMessage));
s.sendMessage("Broadcast slap release message: " + plugin.yc.configuration.getString("messages.releasebroadcast").replaceAll("__Default", plugin.ms.broadcastReleaseMessage));
s.sendMessage("Personal slap no release message: " + plugin.yc.configuration.getString("messages.noreleasepersonal").replaceAll("__Default", plugin.ms.personalNoReleaseMessage));
s.sendMessage("Sender slap no release message: " + plugin.yc.configuration.getString("messages.noreleasesender").replaceAll("__Default", plugin.ms.senderNoReleaseMessage));
try {
s.sendMessage("General " + plugin.descriptionFile.getName() + " plugin config information: ");
s.sendMessage("Players can slap themselves: " + plugin.yc.configuration.getString("slapself"));
s.sendMessage("Default slap type: " + plugin.yc.configuration.getString("slapdefault"));
s.sendMessage("Player slap counts incremented on '/slapall' command uses: " + plugin.yc.configuration.getString("incrementonslapall"));
s.sendMessage("Slap accept broadcast message: " + plugin.yc.configuration.getString("messages.accept").replaceAll("__Default", plugin.ms.acceptSlapMessage));
s.sendMessage("Personal slap release message: " + plugin.yc.configuration.getString("messages.releasepersonal").replaceAll("__Default", plugin.ms.personalReleaseMessage));
s.sendMessage("Broadcast slap release message: " + plugin.yc.configuration.getString("messages.releasebroadcast").replaceAll("__Default", plugin.ms.broadcastReleaseMessage));
s.sendMessage("Personal slap no release message: " + plugin.yc.configuration.getString("messages.noreleasepersonal").replaceAll("__Default", plugin.ms.personalNoReleaseMessage));
s.sendMessage("Sender slap no release message: " + plugin.yc.configuration.getString("messages.noreleasesender").replaceAll("__Default", plugin.ms.senderNoReleaseMessage));
}
catch (NullPointerException e) {
plugin.ms.sendMessage(s, "configerror", "Messages section of the config.yml file ");
}
}
else {
plugin.ms.sendMessage(s, "nopermission", null);
Expand All @@ -210,5 +215,4 @@ else if (args[0].equalsIgnoreCase("general")) {
return false;
}
}

}

0 comments on commit 18605ef

Please sign in to comment.