Browse Source

Slightly more debugging console info.

master
Stanislav Usenkov 9 years ago
parent
commit
d705783649
  1. 2
      pom.xml
  2. 52
      src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java
  3. 4
      src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java
  4. 139
      src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultDeprecatedChat.java

2
pom.xml

@ -4,7 +4,7 @@
<groupId>ru.simsonic</groupId>
<artifactId>rscPermissions</artifactId>
<version>0.10.9b-SNAPSHOT</version>
<version>0.10.10b-SNAPSHOT</version>
<packaging>jar</packaging>
<name>rscPermissions</name>

52
src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java

@ -88,11 +88,11 @@ public final class BridgeForBukkitAPI
// Register Chat
rscp.getServer().getServicesManager().register(
net.milkbowl.vault.chat.Chat.class, vaultChat,
rscp, ServicePriority.Highest);
rscp, ServicePriority.Normal);
// Register Permission
rscp.getServer().getServicesManager().register(
net.milkbowl.vault.permission.Permission.class, vaultPermission,
rscp, ServicePriority.Highest);
rscp, ServicePriority.Normal);
sendConsoleMessage(Phrases.INTEGRATION_V_Y.toPlayer());
} else
sendConsoleMessage(Phrases.INTEGRATION_V_N.toPlayer());
@ -121,6 +121,14 @@ public final class BridgeForBukkitAPI
rscp.getServer().getConsoleSender().sendMessage(GenericChatCodes.processStringStatic(sb.toString()));
}
}
private final String[] runtimes = new String[]
{
"java.",
"sun.reflect.",
"net.minecraft.server.",
"org.bukkit.craftbukkit.",
"org.bukkit.plugin",
};
public void printDebugStackTrace()
{
if(rscp.permissionManager.isConsoleDebugging())
@ -128,16 +136,40 @@ public final class BridgeForBukkitAPI
final StringBuilder sb = new StringBuilder(Settings.DEBUG_PREFIX)
.append("An API method was invoked from the path:")
.append(System.lineSeparator());
for(StackTraceElement element : Thread.currentThread().getStackTrace())
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
int runtimeElements = stackTrace.length;
for(int steId = 0; steId < stackTrace.length; steId += 1)
{
final String className = stackTrace[stackTrace.length - 1 - steId].getClassName();
boolean isKnownPackage = false;
for(String prepackage : runtimes)
if(className.startsWith(prepackage))
{
isKnownPackage = true;
break;
}
if(isKnownPackage == false)
{
runtimeElements = steId;
break;
}
}
for(int steId = 0; steId < stackTrace.length; steId += 1)
{
final StackTraceElement element = stackTrace[steId];
final String className = element.getClassName();
if(!className.equals(BridgeForBukkitAPI.class.getName())
&& !className.equals(Thread.class.getName())
)
sb.append(Settings.DEBUG_PREFIX)
.append(className.startsWith(BukkitPluginMain.class.getPackage().getName()) ? "{_LG}" : "{_LS}")
.append(element.toString())
.append(System.lineSeparator());
final boolean isDebug = className.equals(this.getClass().getName());
final boolean isThread = className.equals(Thread.class.getName());
if(!isDebug && !isThread)
{
sb.append(Settings.DEBUG_PREFIX);
final boolean isLocal = steId < stackTrace.length - runtimeElements;
if(className.startsWith(BukkitPluginMain.class.getPackage().getName()))
sb.append("{_LG}");
else
sb.append(isLocal ? "{_WH}" : "{_LS}");
sb.append(element.toString()).append(System.lineSeparator());
}
}
rscp.getServer().getConsoleSender().sendMessage(GenericChatCodes.processStringStatic(sb.toString()));
}

4
src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java

@ -10,13 +10,11 @@ import ru.simsonic.rscPermissions.Engine.ResolutionResult;
public final class VaultChat extends VaultDeprecatedChat
{
private final BridgeForBukkitAPI bridge;
private final BukkitPluginMain rscp;
private final VaultPermission permissions;
public VaultChat(BridgeForBukkitAPI bridge, VaultPermission permissions)
{
super(permissions);
this.bridge = bridge;
super(bridge, permissions);
this.rscp = (BukkitPluginMain)bridge.getPlugin();
this.permissions = permissions;
}

139
src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultDeprecatedChat.java

@ -4,219 +4,320 @@ import net.milkbowl.vault.permission.Permission;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.entity.Player;
import ru.simsonic.rscPermissions.BridgeForBukkitAPI;
public abstract class VaultDeprecatedChat extends net.milkbowl.vault.chat.Chat
{
public VaultDeprecatedChat(Permission permissions)
protected final BridgeForBukkitAPI bridge;
public VaultDeprecatedChat(BridgeForBukkitAPI bridge, Permission permissions)
{
super(permissions);
this.bridge = bridge;
}
@Override
@Deprecated
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public void setPlayerInfoInteger(String world, String player, String node, int value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getGroupInfoInteger(String world, String group, String node, int defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoInteger(String world, String group, String node, int value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public void setPlayerInfoDouble(String world, String player, String node, double value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getGroupInfoDouble(String world, String group, String node, double defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoDouble(String world, String group, String node, double value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public void setPlayerInfoBoolean(String world, String player, String node, boolean value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoBoolean(String world, String group, String node, boolean value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public String getPlayerInfoString(String world, String player, String node, String defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
@Deprecated
public void setPlayerInfoString(String world, String player, String node, String value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getGroupInfoString(String world, String group, String node, String defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoString(String world, String group, String node, String value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getPlayerInfoInteger(Player player, String node, int defaultValue)
{
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|)");
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoInteger(Player player, String node, int value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getGroupInfoInteger(World world, String group, String node, int defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoInteger(World world, String group, String node, int value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getPlayerInfoDouble(Player player, String node, double defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|)");
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoDouble(Player player, String node, double value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getGroupInfoDouble(World world, String group, String node, double defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoDouble(World world, String group, String node, double value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue)
{
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|)");
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoBoolean(Player player, String node, boolean value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoBoolean(World world, String group, String node, boolean value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPlayerInfoString(Player player, String node, String defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_WH}" + player + "{_LS} ({_LB}" + defaultValue + "{_LS|)");
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoString(Player player, String node, String value)
{
bridge.printDebugString("Set " + node + " for " + player + " = " + value);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getGroupInfoString(World world, String group, String node, String defaultValue)
{
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
bridge.printDebugString("{_LS}Get {_LG}" + node + "{_LS} of {_YL}" + group + "{_LS} ({_LB}" + defaultValue + "{_LS|) @ " + world);
bridge.printDebugStackTrace();
return defaultValue;
// throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoString(World world, String group, String node, String value)
{
bridge.printDebugString("Set " + node + " for " + group + " = " + value + " @ " + world);
bridge.printDebugStackTrace();
throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
}

Loading…
Cancel
Save