Skip to content

Commit

Permalink
Partially Fix Duplication Bug
Browse files Browse the repository at this point in the history
- Partially fix a bug where some '/oprequest' command messages are sent to players multiple times.
  • Loading branch information
aappleton8 committed Sep 29, 2018
1 parent 041561c commit 0bc5ee0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
Binary file removed Jar/OpPermissions_v1.0.1.3_1.7-1.12.jar
Binary file not shown.
Binary file added Jar/OpPermissions_v1.0.1.4_1.7-1.13.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion OpPermissions/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: OpPermissions
main: me.OpPermissions.OpPermissionsMainClass
version: 1.0.1.3
version: 1.0.1.4
description: A plugin helping with op permissions
author: aappleton3
database: false
Expand Down
27 changes: 20 additions & 7 deletions OpPermissions/src/me/OpPermissions/OpPermissionsCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;

public class OpPermissionsCommands implements CommandExecutor {
public static OpPermissionsMainClass plugin;
Expand Down Expand Up @@ -445,7 +446,12 @@ else if (args.length == 1) {
opNames.add(i);
}
}
s.sendMessage(opNames.toString());
if (opNames.isEmpty()) {
s.sendMessage(ChatColor.DARK_RED + "There are no permanent ops ");
}
else {
s.sendMessage(ChatColor.DARK_GREEN + opNames.toString());
}
}
else {
plugin.noPermission(s);
Expand Down Expand Up @@ -543,11 +549,12 @@ else if (l.equalsIgnoreCase("oprequest")) {
return false;
}
else {
String canSeeMessage = plugin.getConfig().getString("allowrequests");
if (s.hasPermission("oppermissions.oprequest.send") || (s instanceof ConsoleCommandSender)) {
if (plugin.getConfig().getString("allowrequests").equalsIgnoreCase("no") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("false")) {
s.sendMessage(ChatColor.RED + "This feature has been disabled ");
}
else if (!(plugin.getConfig().getString("allowrequests").equalsIgnoreCase("all") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("both") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("op") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("permission"))) {
else if (!(canSeeMessage.equalsIgnoreCase("all") || canSeeMessage.equalsIgnoreCase("both") || canSeeMessage.equalsIgnoreCase("op") || canSeeMessage.equalsIgnoreCase("permission"))) {
s.sendMessage(ChatColor.RED + "This feature has been disabled ");
Bukkit.broadcast(ChatColor.RED + "The " + plugin.getName() + " plugin config has an invalid value ", "oppermissions.seepluginmessages");
Bukkit.broadcast(ChatColor.RED + "The " + plugin.getName() + " plugin config has an invalid value ", "oppermissions.oprequest.receive");
Expand All @@ -556,17 +563,23 @@ else if (!(plugin.getConfig().getString("allowrequests").equalsIgnoreCase("all")
else {
String message = String.join(" ", args);
message = ChatColor.DARK_GREEN + s.getName() + " asks: " + message;
s.sendMessage(message);
if (plugin.getConfig().getString("allowrequests").equalsIgnoreCase("all")) {
if (canSeeMessage.equalsIgnoreCase("all")) {
Bukkit.broadcastMessage(message);
}
else {
if (plugin.getConfig().getString("allowrequests").equalsIgnoreCase("permission") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("both")) {
if (s instanceof Player) {
s.sendMessage(message);
}
if (canSeeMessage.equalsIgnoreCase("permission")) {
Bukkit.broadcast(message, "oppermissions.oprequest.receive");
}
if (plugin.getConfig().getString("allowrequests").equalsIgnoreCase("op") || plugin.getConfig().getString("allowrequests").equalsIgnoreCase("both")) {
else if (canSeeMessage.equalsIgnoreCase("op")) {
Bukkit.broadcast(message, Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
}
}
else if (canSeeMessage.equalsIgnoreCase("both")) {
Bukkit.broadcast(message, "oppermissions.oprequest.receive");
Bukkit.broadcast(message, Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ The terms 'username' and 'playername' are used interchangeably in this plugin an
This plugin can use either playernames or player UUIDs. Although this plugin can convert between the two, errors are likely to occur (most commonly users' usernames becoming 'null') if the conversion operation is performed on an offline player. As such, the format to use should be chosen at the start and kept constant. If a conversion is necessary, setting the 'onlyautoupdateonline' config field to true will prevent the plugin updating offline players, avoiding errors. Setting the 'updateonplayerjoins' config field to true will make the plugin convert the players when they come online, however, the user may still appear as 'null' until then.

## Versions:
The current plugin release version is 1.0.1.3. The compiled .jar file is available in the 'releases' section. The 'Jar' folder contains the most recently compiled plugin version that runs; this may be the same as the most recent release or it may be a development build. The development builds may be unstable. The current release of this plugin has been tested on Spigot servers running Minecraft versions 1.7.10, 1.8.9 and 1.12.2. It is designed for Minecraft versions between 1.7.x and 1.12.x, and as such, any bug for any version between 1.7.x and 1.12.x will be fixed. This plugin is likely to work with many other Minecraft Spigot and Bukkit versions but this is untested and bugs found with these versions will not necessarily be fixed.
The current plugin release version is 1.0.1.4. The compiled .jar file is available in the 'releases' section. The 'Jar' folder contains the most recently compiled plugin version that runs; this may be the same as the most recent release or it may be a development build. The development builds may be unstable. The current release of this plugin has been tested on Spigot servers running Minecraft versions 1.7.10, 1.8.9, 1.12.2 and 1.13.1. It is designed for Minecraft versions between 1.7.x and 1.13.x, and as such, any bug for any version between 1.7.x and 1.13.x will be fixed. This plugin is likely to work with many other Minecraft Spigot and Bukkit versions but this is untested and bugs found with these versions will not necessarily be fixed.

## License:
This plugin and its source code are released under the MIT license (see the [LICENSE file](https://github.com/aappleton8/OpPermissions/blob/master/LICENSE) for full details). This plugin is copyright (c) aappleton3/aappleton8, 2018.

## Build:
This plugin is built using Eclipse. To build the plugin, the .classpath file firstly needs to be recreated using Eclipse, and the craftbukkit-1.12.2.jar file needs to be added as an external build dependency.
This plugin is built using Eclipse. To build the plugin, the .classpath file firstly needs to be recreated using Eclipse, and the craftbukkit-1.12.2.jar file (or another version of craftbukkit) needs to be added as an external build dependency.

## Commands:
The general command syntaxes are:
Expand Down

0 comments on commit 0bc5ee0

Please sign in to comment.