Fixed tiny bug with permissions

This commit is contained in:
Savvy 2017-08-15 23:56:17 -04:00
parent 4766581177
commit 37b012ffe1
6 changed files with 58 additions and 85 deletions

View File

@ -44,8 +44,8 @@
<file leaf-file-name="Rixa.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="700">
<caret line="100" column="36" lean-forward="true" selection-start-line="100" selection-start-column="36" selection-end-line="100" selection-end-column="36" />
<state relative-caret-position="952">
<caret line="100" column="36" lean-forward="false" selection-start-line="100" selection-start-column="36" selection-end-line="100" selection-end-column="36" />
<folding />
</state>
</provider>
@ -54,7 +54,7 @@
<file leaf-file-name="LeaderboardCommand.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/LeaderboardCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<state relative-caret-position="238">
<caret line="24" column="50" lean-forward="false" selection-start-line="24" selection-start-column="50" selection-end-line="24" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
@ -64,14 +64,13 @@
</provider>
</entry>
</file>
<file leaf-file-name="LevelsModule.java" pinned="false" current-in-tab="true">
<file leaf-file-name="LevelsModule.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48">
<caret line="33" column="26" lean-forward="false" selection-start-line="33" selection-start-column="26" selection-end-line="33" selection-end-column="26" />
<state relative-caret-position="235">
<caret line="44" column="18" lean-forward="true" selection-start-line="44" selection-start-column="18" selection-end-line="44" selection-end-column="18" />
<folding>
<element signature="method#LevelsModule#0;class#LevelsModule#0" expanded="true" />
<element signature="method#leaderboard#0;class#LevelsModule#0" expanded="true" />
<element signature="method#registerUser#0;class#LevelsModule#0" expanded="true" />
<element signature="method#getUserData#0;class#LevelsModule#0" expanded="true" />
<element signature="method#checkUser#0;class#LevelsModule#0" expanded="true" />
@ -84,6 +83,23 @@
</provider>
</entry>
</file>
<file leaf-file-name="RixaGuild.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527">
<caret line="93" column="28" lean-forward="true" selection-start-line="93" selection-start-column="28" selection-end-line="93" selection-end-column="28" />
<folding>
<element signature="method#RixaGuild#0;class#RixaGuild#0" expanded="true" />
<element signature="method#load#0;class#RixaGuild#0" expanded="true" />
<element signature="method#getGuildSettings#0;class#RixaGuild#0" expanded="true" />
<element signature="method#checkExists#0;class#RixaGuild#0" expanded="true" />
<element signature="method#hasPermission#0;class#RixaGuild#0" expanded="true" />
<element signature="method#permissionExists#0;class#RixaGuild#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -604,13 +620,13 @@
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandHandler.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/LevelsCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/user/UserData.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/PingCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/LeaderboardCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java" />
</list>
</option>
</component>
@ -623,10 +639,9 @@
<component name="MavenProjectNavigator">
<treeState />
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1256" />
<component name="ProjectFrameBounds">
<option name="x" value="-7" />
<option name="width" value="974" />
<option name="height" value="1047" />
</component>
<component name="ProjectLevelVcsManager">
@ -647,7 +662,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -728,16 +742,6 @@
<item name="rixa" type="462c0819:PsiDirectoryNode" />
<item name="guild" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Rixa" type="b2602c69:ProjectViewProjectNode" />
<item name="Rixa" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="rixa" type="462c0819:PsiDirectoryNode" />
<item name="guild" type="462c0819:PsiDirectoryNode" />
<item name="user" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Rixa" type="b2602c69:ProjectViewProjectNode" />
<item name="Rixa" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
@ -753,6 +757,7 @@
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -1116,25 +1121,24 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<frame x="-7" y="0" width="974" height="1047" extended-state="0" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33403805" sideWeight="0.51875" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.63424945" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33297986" sideWeight="0.48125" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.63424945" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33618844" sideWeight="0.48125" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24270834" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.48643005" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@ -1368,9 +1372,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="39" column="18" lean-forward="false" selection-start-line="38" selection-start-column="17" selection-end-line="39" selection-end-column="18" />
<folding>
<element signature="method#checkConnection#0;class#Database#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -1378,10 +1379,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-504">
<caret line="632" column="84" lean-forward="true" selection-start-line="632" selection-start-column="84" selection-end-line="632" selection-end-column="84" />
<folding>
<element signature="method#getConnection#1;class#DriverManager#0" expanded="false" />
<element signature="method#getConnection#3;class#DriverManager#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -1389,11 +1386,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="292">
<caret line="51" column="7" lean-forward="true" selection-start-line="51" selection-start-column="7" selection-end-line="51" selection-end-column="7" />
<folding>
<element signature="method#MySQL#0;class#MySQL#0" expanded="false" />
<element signature="method#MySQL#1;class#MySQL#0" expanded="false" />
<element signature="method#openConnection#0;class#MySQL#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -1417,10 +1409,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="193">
<caret line="173" column="27" lean-forward="false" selection-start-line="173" selection-start-column="27" selection-end-line="173" selection-end-column="27" />
<folding>
<element signature="e#7284#7285#0" expanded="false" />
<element signature="e#7312#7313#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -1475,7 +1463,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="28" column="32" lean-forward="false" selection-start-line="28" selection-start-column="32" selection-end-line="28" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
@ -1483,9 +1470,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="41" column="18" lean-forward="false" selection-start-line="41" selection-start-column="18" selection-end-line="41" selection-end-column="18" />
<folding>
<element signature="method#update#0;class#Data#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -1493,33 +1477,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-11">
<caret line="80" column="21" lean-forward="false" selection-start-line="80" selection-start-column="21" selection-end-line="80" selection-end-column="21" />
<folding>
<element signature="method#createTable#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#checkConnection#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#executeUpdate#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#getObject#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#getObject#1;class#DatabaseManager#0" expanded="true" />
<element signature="method#executeQuery#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#getCount#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#checkExists#0;class#DatabaseManager#0" expanded="true" />
<element signature="method#insert#0;class#DatabaseManager#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="36" column="33" lean-forward="true" selection-start-line="36" selection-start-column="33" selection-end-line="36" selection-end-column="33" />
<folding>
<element signature="method#RixaGuild#0;class#RixaGuild#0" expanded="true" />
<element signature="method#load#0;class#RixaGuild#0" expanded="true" />
<element signature="method#getGuildSettings#0;class#RixaGuild#0" expanded="true" />
<element signature="method#checkExists#0;class#RixaGuild#0" expanded="true" />
<element signature="method#hasPermission#0;class#RixaGuild#0" expanded="true" />
<element signature="method#hasPermission#1;class#RixaGuild#0" expanded="true" />
<element signature="method#permissionExists#0;class#RixaGuild#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -1570,21 +1527,20 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="45" column="49" lean-forward="true" selection-start-line="45" selection-start-column="49" selection-end-line="45" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="700">
<caret line="100" column="36" lean-forward="true" selection-start-line="100" selection-start-column="36" selection-end-line="100" selection-end-column="36" />
<state relative-caret-position="952">
<caret line="100" column="36" lean-forward="false" selection-start-line="100" selection-start-column="36" selection-end-line="100" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/LeaderboardCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<state relative-caret-position="238">
<caret line="24" column="50" lean-forward="false" selection-start-line="24" selection-start-column="50" selection-end-line="24" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
@ -1595,11 +1551,10 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/levels/LevelsModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48">
<caret line="33" column="26" lean-forward="false" selection-start-line="33" selection-start-column="26" selection-end-line="33" selection-end-column="26" />
<state relative-caret-position="235">
<caret line="44" column="18" lean-forward="true" selection-start-line="44" selection-start-column="18" selection-end-line="44" selection-end-column="18" />
<folding>
<element signature="method#LevelsModule#0;class#LevelsModule#0" expanded="true" />
<element signature="method#leaderboard#0;class#LevelsModule#0" expanded="true" />
<element signature="method#registerUser#0;class#LevelsModule#0" expanded="true" />
<element signature="method#getUserData#0;class#LevelsModule#0" expanded="true" />
<element signature="method#checkUser#0;class#LevelsModule#0" expanded="true" />
@ -1611,6 +1566,21 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527">
<caret line="93" column="28" lean-forward="true" selection-start-line="93" selection-start-column="28" selection-end-line="93" selection-end-column="28" />
<folding>
<element signature="method#RixaGuild#0;class#RixaGuild#0" expanded="true" />
<element signature="method#load#0;class#RixaGuild#0" expanded="true" />
<element signature="method#getGuildSettings#0;class#RixaGuild#0" expanded="true" />
<element signature="method#checkExists#0;class#RixaGuild#0" expanded="true" />
<element signature="method#hasPermission#0;class#RixaGuild#0" expanded="true" />
<element signature="method#permissionExists#0;class#RixaGuild#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View File

@ -86,19 +86,22 @@ public class RixaGuild {
if(!permissionExists(role)) {
return false;
}
boolean b = false;
try {
PreparedStatement ps =
db.getConnection().prepareStatement
("SELECT `" + permission.toString().toUpperCase() + "` FROM `permissions` WHERE `role_id` = ?");
ps.setString(1, role.getId());
ResultSet rs = db.getObject(ps);
b = rs.getBoolean(permission.toString().toUpperCase());
ps.close();
rs.close();
return rs.getBoolean(permission.toString().toUpperCase());
} catch (SQLException e) {
e.printStackTrace();
}
return false;
return b;
}
public void setPermission(Role role, RixaPermission permission, boolean value) {