Skip to content

Commit

Permalink
Bug Fixes 5 and Player Info Command
Browse files Browse the repository at this point in the history
- Fix a bug where the extra permissions could not be registered.
- Make the '/slapinfo players' command show the exemption status of online players instead of only the fully exemption status.
- Add more aliases of the '/slapaccept' command.
  • Loading branch information
aappleton8 committed Mar 31, 2019
1 parent 73d9469 commit c7c27e7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions 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: 1.0.0.1
version: 1.0.0.2
description: A plugin to slap players
author: aappleton3
database: false
Expand All @@ -23,7 +23,7 @@ commands:
slapaccept:
description: Acknowledge that you have been slapped if someone slaps you
usage: /slapaccept [<player>]
aliases: [slapac, slaa, slacc]
aliases: [slapac, slapacc, slapap, slapapp, slaa, slacc]
permission-message: You do not have the required permissions to perform this command
slaprelease:
description: Release a player who has been hit with a permanent slap
Expand Down
16 changes: 15 additions & 1 deletion PlayerSlap/src/me/PlayerSlap/CommandClasses/SlapInfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.UUID;
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
Expand Down Expand Up @@ -143,7 +144,20 @@ else if (args[0].equalsIgnoreCase("player")) {
else {
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"));
if (Bukkit.getOfflinePlayer(pid).isOnline()) {
s.sendMessage("The player is online ");
if (Bukkit.getPlayer(pid).hasPermission("playerslap.noslap")) {
s.sendMessage("Is exempt: true ");
}
else {
s.sendMessage("Is exampt: false ");
}
}
else {
s.sendMessage("The player is offline ");
s.sendMessage("The exemption status of offline players cannot be obtained ");
}
s.sendMessage("Is fully exempt: " + plugin.yd.configuration.getString("players." + sid + ".exempt"));
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 ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ private void getCurrentlySlappedPlayers() {
private void registerExtraPermissions(PluginManager pm) {
Set<String> slapTypes = Collections.emptySet();
try {
slapTypes = plugin.yc.configuration.getConfigurationSection("slaptypes").getKeys(false);
slapTypes = yc.configuration.getConfigurationSection("slaptypes").getKeys(false);
}
catch (NullPointerException e) {
logger.warning(formattedPluginName + "Could not register extra permissions as the config.yml file could not be loaded : " + e.toString());
e.printStackTrace();
}
if ((slapTypes != null) && (slapTypes.isEmpty() == false)) {
logger.info(formattedPluginName + "Registering extra permissions ");
YamlFiles.checkPermissions(slapTypes, pm);
}
}
Expand Down
2 changes: 1 addition & 1 deletion PlayerSlap/src/me/PlayerSlap/MainClasses/YamlFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class YamlFiles extends YamlFilesBase {

private final String configPermission = "playerslap.see.config";
private static Set<String> slapPermissions = Collections.emptySet();
private static Set<String> slapPermissions = Collections.emptySet();

public YamlFiles(PlayerSlapMainClass pluginInstance, Logger loggerInstance, String outFileName, String inFileName) {
super(pluginInstance, loggerInstance, outFileName, inFileName);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This plugin gives server administrators the ability to 'slap' players as a form of punishment. The action of 'slapping' can involve removing health, spawning mobs, hitting the player with lightning, producing smoke and broadcasting a message. Different types of slaps can be defined in the config file.

## Versions:
This project is currently version 1.0.0.0. It is designed for Minecraft Spigot versions between 1.7.x and 1.13.x. The latest latest can be found in the 'releases' section, and the most recent (possibly unstable) build can be found in the 'Jar' folder.
This project is currently version 1.0.0.2. It is designed for Minecraft Spigot versions between 1.7.x and 1.13.x. The latest latest can be found in the 'releases' section, and the most recent (possibly unstable) build can be found in the 'Jar' folder.

## License:
This plugin and its source code are released under a MIT license (see the LICENSE file for full details). This plugin is copyright (c) aappleton3/aappleton8, 2018.
Expand Down

0 comments on commit c7c27e7

Please sign in to comment.