From b9418e47c4c95c0f3e4b59097585477c1b8534bc Mon Sep 17 00:00:00 2001 From: Karanum Date: Fri, 9 Jun 2017 18:18:14 +0200 Subject: [PATCH] Added help command, fixed filter radius resetting, more faulty event fixes --- .../2.6/taskArtifacts/cache.properties.lock | Bin 17 -> 17 bytes .gradle/2.6/taskArtifacts/fileHashes.bin | Bin 92983 -> 92983 bytes .gradle/2.6/taskArtifacts/fileSnapshots.bin | Bin 511751 -> 511751 bytes .../2.6/taskArtifacts/outputFileStates.bin | Bin 19382 -> 19412 bytes .gradle/2.6/taskArtifacts/taskArtifacts.bin | Bin 41015 -> 41015 bytes build.gradle | 4 +- .../adamantineshield/AdamantineShield.java | 4 +- .../commands/CommandMain.java | 45 +++++++++++++++++- .../commands/CommandPurge.java | 4 ++ .../commands/CommandReload.java | 6 +++ .../commands/lookup/CommandFilter.java | 6 ++- .../commands/lookup/CommandInspect.java | 4 ++ .../commands/lookup/CommandLookup.java | 6 ++- .../commands/pages/CommandNextPage.java | 4 ++ .../commands/pages/CommandPage.java | 4 ++ .../commands/pages/CommandPrevPage.java | 4 ++ .../commands/rollback/CommandRollback.java | 6 +++ .../commands/rollback/CommandUndo.java | 6 +++ .../adamantineshield/enums/Permissions.java | 4 +- .../listeners/PlayerInspectListener.java | 6 +++ .../adamantineshield/lookup/FilterSet.java | 8 ++-- 21 files changed, 108 insertions(+), 13 deletions(-) diff --git a/.gradle/2.6/taskArtifacts/cache.properties.lock b/.gradle/2.6/taskArtifacts/cache.properties.lock index 4a389919f50baa58276498f88a7d915cc671be4f..35b712ebae3cb80930cfebb5755e406234fe5e30 100644 GIT binary patch literal 17 VcmZSP2@QPy?5@fb1~5=C1^_XB1Zw~Q literal 17 VcmZSP2@QPy?5@fb1~8C+3;;4L1sVVV diff --git a/.gradle/2.6/taskArtifacts/fileHashes.bin b/.gradle/2.6/taskArtifacts/fileHashes.bin index 929d94cb3c93480260ffef89f41a3d9dc7fe3dd6..addc1aafe19e11c5ecbace68841fa530c8393d48 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r%q#2?&rt5XA*E5{nqhu$kBbg&7ldSc$KN1sWSbMm{VEQ9uz2 zIIG7&7)PW@Y$WMMtI#MA?vGF!3c-P9f~G(kh8e8UDEc_>d3XBN{qa8cKF@pKult^B zn^fB-)y+O3Y62I{t`YV{ytf?s@1B&NXo(2!-G9E&%hLM0l!?{}u<&a1EORc}DEI~B z-AVx4kKL#|-!k7~!MC;}PX__3 zIv2xOZSfs1i**O`u6=;7lwUKmoWqrdvV)OLZb#y)O50|ae!260j%Xz9Wcg1Q(V6Z6 zY#AEa#Iz;xTSD|-RT9uRBnuC1Ep!A^fu(Z^nkbRFPvc!WnrT9r;&G+V{7O* z;>XNoVre?(hzFsS)Bh>Q~(ce?vqHWz&tKekOJXF7=mSegF16$)0Qi{|a~} zMDqby<8YasB>->L!80McZm{F&ukKZ(IM;_&;GO1W5 zwjBsUv_FI8G4@A%IFmvj*MK0zBM|I-!mSMc2ZkC3f)Iayuo3pCLB1`EzU3{BiCkdO zdN3%J(MkyK%%W#RkJ&(oShB3vp;;qO%%-EF-kT_Bz6YG2Y46|$Gt}Ga$gY_ILG_(U z$1}_n&bi}I_&I~{Z0v(^e%CDPeFq4UV<*^$AI>gwbq+l%lKTK5h9y6IlG*NI>&c=1 zP9oM}R9qqe!wLgG%AV(66LIAGu%)$yUEr9Vd$KT6cmYX!1zhYbeHuaNM*si- diff --git a/.gradle/2.6/taskArtifacts/fileSnapshots.bin b/.gradle/2.6/taskArtifacts/fileSnapshots.bin index 307024ad7f15dbb5da19826156f26d5fd1b42084..5f85321e222b8f01a5f817ef8c98625a34b44bb5 100644 GIT binary patch delta 661 zcmZplC*M9#euBL`!!C0M21W)5*v|)Kvw_)+^3n_pOn)ZE-4$l;jb&iaw*(8bp7dv6 zFi4y1$7sUhVt8cV<~GLNVv{2!$_3^Z&v>yzq4X@or0&YeCnPKcRtbx6nyFunf*3hz z-edvE9|9*I%wtm7ax@O2@_@)BsSN^eYyUGd+8xydi?J{^OG&Lj~w5;kug_n^8v=m!kYs;44pZ&92pq29GP6FJEpT_OkW_zEHK^wAuHSV*BXre z+(Lp3Tc62qs@rPR8h6IE^zE3sPf%jw*zCFO zGUw*R&!4yiw<;`=Rh}P_(jxdDV*9QI*MH`UGxfzv+30*w{Do&%MpEJ@YAZiOFmGeg#G~#>oeQ z1lud8G6FHv_R6WuLOI*ZPBAla-N|V7ALUR9&xg1Oppt?xqNbAKvVk*1r{J? O1!A`CFBI72*8u>PYwuzJ delta 659 zcmZplC*M9#euBL`V_Oyj1H)G!W?*1ctzuwcdJJJtng?V*nHYChn4!CpfkEpGSeS*e ziGe}iYO)`r2@Bh#@TSdejJw6eWB1g*PWX8htb(~W_CFL%c95u;d_lrMU`bz0+=&M5 z0f>U&TNY63=E3u+YkI_dc!4nNc`H%ENjab z2~u8qS@$P1UY!20m!*31{eRW0)6cdu3QTWQWiptqaEL8*`+F8f3Et^@4=@XDmtDhL z$;9&0w!3a~z(WyEmLk!#Inx)KvldUEpv1(n*>l@vP7WC1aB0=9E`0*3;*8 z0PSb|%vdn_&wddWlg_DJ+Z)sv0~7cR^s*9*811e{92TBgS~UG)7h{AxSd3X9ZN-_= z&Fk}}eXqE$yu0i24p11a$m|lF?ns@ zufV9rIQc-3V0-0MMj&R|UOAOnD2Med1B2Yz?HkKk{^AKOW!CMn9W1lBk%EU+plQm@ Z<&z5on%Z9|umCYD5VLK6p};P`4ghOh@{s@l diff --git a/.gradle/2.6/taskArtifacts/outputFileStates.bin b/.gradle/2.6/taskArtifacts/outputFileStates.bin index 671648c8f0631f9dfe6357da6b3fea6d66094df3..01f7e56eca329a685eb31fbc2faa135478e2939d 100644 GIT binary patch delta 86 zcmdlso$<Y@w@vnt+QTAaefG~r#lPYk4U9!M h2Y940%bhU>$_oH72MCKy39YERn)nB#N1bDV8UUj485;lq delta 38 ucmcaIopIZA#trrojIx^@Bm|fyXGm>fNxaWnwo&n~_(lV7(aixKY0Ll%JPl|7 diff --git a/.gradle/2.6/taskArtifacts/taskArtifacts.bin b/.gradle/2.6/taskArtifacts/taskArtifacts.bin index 6b60b3b14a7f414775d26d28a2299bb0f47b180f..c3d63b912f4e2e88349fb1e1f548166116249ae3 100644 GIT binary patch delta 153 zcmV;K0A~NUzyi0x0*F>E^1+N z0J9=yIspg(0001tbT6>80cbP>5aBKH2oh<;VjqoW$;l;gTa(^viL*6pG69lp1OvjJ!{1GCO+G64{N==_Hj*AF7l7{wN}*+G(%-fM}HZ3G3*;Gyw6lkQb8 wvpH@0B(vL=PzexM`8-POisn&au@fq(*L", TextColors.AQUA, " - Purges old log entries"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/CommandReload.java b/src/main/java/com/karanumcoding/adamantineshield/commands/CommandReload.java index 1bb073f..07a36a5 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/CommandReload.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/CommandReload.java @@ -5,6 +5,8 @@ import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.spec.CommandExecutor; +import org.spongepowered.api.text.Text; +import org.spongepowered.api.text.format.TextColors; public class CommandReload implements CommandExecutor { @@ -13,5 +15,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm // TODO Auto-generated method stub return CommandResult.empty(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield reload", TextColors.AQUA, " - Reloads this plugin"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandFilter.java b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandFilter.java index 71f6ef6..7235664 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandFilter.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandFilter.java @@ -41,7 +41,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm return CommandResult.empty(); } - FilterSet filterSet = new FilterSet(plugin, p); + FilterSet filterSet = new FilterSet(plugin, p, false); filterSet.forceLookupType(lookup.getLookupType()); FilterParser.parse(filters, filterSet); lookup.filterResult(filterSet); @@ -49,5 +49,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm lookup.showPage(p, 1); return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield filter [filters]", TextColors.AQUA, " - Filters your last result"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandInspect.java b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandInspect.java index b7da679..97ae8e3 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandInspect.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandInspect.java @@ -35,5 +35,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield inspect", TextColors.AQUA, " - Toggles the inspector"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandLookup.java b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandLookup.java index c44c9cb..826d7f6 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandLookup.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/lookup/CommandLookup.java @@ -43,7 +43,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm Player p = (Player) src; Collection filters = args.getAll("filter"); - FilterSet filterSet = new FilterSet(plugin, p); + FilterSet filterSet = new FilterSet(plugin, p, true); FilterParser.parse(filters, filterSet); String targetTable = filterSet.getLookupType().getTable(); @@ -79,5 +79,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm }); return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield lookup [filters]", TextColors.AQUA, " - Performs a lookup"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandNextPage.java b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandNextPage.java index a09a588..4e6ea88 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandNextPage.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandNextPage.java @@ -36,5 +36,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm result.showPage((Player) src, page); return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield nextpage", TextColors.AQUA, " - Switches to next result page"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPage.java b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPage.java index 083c9af..3a5b937 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPage.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPage.java @@ -36,5 +36,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm result.showPage((Player) src, page); return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield page ", TextColors.AQUA, " - Switches lookup result page"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPrevPage.java b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPrevPage.java index 643b7bb..17cffef 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPrevPage.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/pages/CommandPrevPage.java @@ -36,5 +36,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm result.showPage((Player) src, page); return CommandResult.success(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield prevpage", TextColors.AQUA, " - Switches to previous result page"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandRollback.java b/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandRollback.java index b73914e..a0f6e68 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandRollback.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandRollback.java @@ -5,6 +5,8 @@ import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.spec.CommandExecutor; +import org.spongepowered.api.text.Text; +import org.spongepowered.api.text.format.TextColors; public class CommandRollback implements CommandExecutor { @@ -13,5 +15,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm // TODO Auto-generated method stub return CommandResult.empty(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield rollback [filters]", TextColors.AQUA, " - Performs a rollback"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandUndo.java b/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandUndo.java index 6364d4a..fde9715 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandUndo.java +++ b/src/main/java/com/karanumcoding/adamantineshield/commands/rollback/CommandUndo.java @@ -5,6 +5,8 @@ import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.CommandContext; import org.spongepowered.api.command.spec.CommandExecutor; +import org.spongepowered.api.text.Text; +import org.spongepowered.api.text.format.TextColors; public class CommandUndo implements CommandExecutor { @@ -13,5 +15,9 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm // TODO Auto-generated method stub return CommandResult.empty(); } + + public static Text getHelpEntry() { + return Text.of(TextColors.YELLOW, "/ashield undo [filters]", TextColors.AQUA, " - Undoes rollback results"); + } } diff --git a/src/main/java/com/karanumcoding/adamantineshield/enums/Permissions.java b/src/main/java/com/karanumcoding/adamantineshield/enums/Permissions.java index 0746bb6..bb2690f 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/enums/Permissions.java +++ b/src/main/java/com/karanumcoding/adamantineshield/enums/Permissions.java @@ -1,10 +1,10 @@ package com.karanumcoding.adamantineshield.enums; public enum Permissions { - ROLLBACK("use.rollback"), + ROLLBACK("use.rollback.base"), UNDO("use.rollback.undo"), REDO("use.rollback.redo"), - LOOKUP("use.lookup"), + LOOKUP("use.lookup.base"), RELOAD("admin.reload"), PURGE("admin.purge"), FILTER("use.lookup.filter"); diff --git a/src/main/java/com/karanumcoding/adamantineshield/listeners/PlayerInspectListener.java b/src/main/java/com/karanumcoding/adamantineshield/listeners/PlayerInspectListener.java index 78d1a10..c9d484e 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/listeners/PlayerInspectListener.java +++ b/src/main/java/com/karanumcoding/adamantineshield/listeners/PlayerInspectListener.java @@ -29,6 +29,9 @@ public void onBlockPrimaryInteract(InteractBlockEvent.Primary.MainHand e, @First e.setCancelled(true); BlockSnapshot block = e.getTargetBlock(); + if (block == null || !block.getLocation().isPresent()) + return; + Location loc = block.getLocation().get(); p.sendMessage(Text.of(TextColors.BLUE, "Querying database, please wait...")); @@ -45,6 +48,9 @@ public void onBlockSecondaryInteract(InteractBlockEvent.Secondary.MainHand e, @F e.setCancelled(true); BlockSnapshot block = e.getTargetBlock(); + if (block == null || !block.getLocation().isPresent()) + return; + Location loc = block.getLocation().get(); p.sendMessage(Text.of(TextColors.BLUE, "Querying database, please wait...")); diff --git a/src/main/java/com/karanumcoding/adamantineshield/lookup/FilterSet.java b/src/main/java/com/karanumcoding/adamantineshield/lookup/FilterSet.java index a37715e..545a73a 100644 --- a/src/main/java/com/karanumcoding/adamantineshield/lookup/FilterSet.java +++ b/src/main/java/com/karanumcoding/adamantineshield/lookup/FilterSet.java @@ -20,11 +20,13 @@ public class FilterSet { private Map, FilterBase> filters; private LookupType lookupType; - public FilterSet(AdamantineShield plugin, Player p) { + public FilterSet(AdamantineShield plugin, Player p, boolean initialFilter) { lookupType = null; filters = Maps.newHashMap(); - filters.put(PositionFilter.class, new PositionFilter(p.getLocation().getBlockPosition(), - plugin.getConfig().getInt("lookup", "default-radius"))); + if (initialFilter) { + filters.put(PositionFilter.class, new PositionFilter(p.getLocation().getBlockPosition(), + plugin.getConfig().getInt("lookup", "default-radius"))); + } } public Optional getFilter(Class filter) {