-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* AriKeysPlugin Support AriKeysPlugin support, deprecation warning on mythickeys for 1.19 * add AriKeys * nmsversion checks + softdepend add snmsversion checks and arikeys as softdepend
- Loading branch information
1 parent
c765e5e
commit 150b609
Showing
9 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/denizenscript/depenizen/bukkit/bridges/AriKeysBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.denizenscript.depenizen.bukkit.bridges; | ||
|
||
import com.denizenscript.denizencore.events.ScriptEvent; | ||
import com.denizenscript.depenizen.bukkit.Bridge; | ||
import com.denizenscript.depenizen.bukkit.events.arikeys.AriKeysKeyPressScriptEvent; | ||
import com.denizenscript.depenizen.bukkit.events.arikeys.AriKeysKeyReleaseScriptEvent; | ||
|
||
|
||
public class AriKeysBridge extends Bridge { | ||
|
||
@Override | ||
public void init() { | ||
ScriptEvent.registerScriptEvent(AriKeysKeyReleaseScriptEvent.class); | ||
ScriptEvent.registerScriptEvent(AriKeysKeyPressScriptEvent.class); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...in/java/com/denizenscript/depenizen/bukkit/events/arikeys/AriKeysKeyPressScriptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.denizenscript.depenizen.bukkit.events.arikeys; | ||
|
||
import com.denizenscript.denizen.events.BukkitScriptEvent; | ||
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import com.denizenscript.denizencore.objects.core.ElementTag; | ||
import com.denizenscript.denizencore.scripts.ScriptEntryData; | ||
import eu.asangarin.arikeys.api.AriKeyPressEvent; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
public class AriKeysKeyPressScriptEvent extends BukkitScriptEvent implements Listener { | ||
|
||
// <--[event] | ||
// @Events | ||
// arikeys key pressed | ||
// | ||
// @Location true | ||
// | ||
// @Switch id:<id> to only process the event if the key ID matches the given text matcher. | ||
// | ||
// @Triggers When a key is pressed by a client running AriKeys, if that key is in the AriKeys config. | ||
// | ||
// @Context | ||
// <context.id> Returns the ID of the key that was pressed according to the AriKeys config, as a namespaced key. | ||
// | ||
// @Player Always. | ||
// | ||
// @Plugin Depenizen, AriKeys | ||
// | ||
// @Group Depenizen | ||
// | ||
// --> | ||
|
||
public AriKeysKeyPressScriptEvent() { | ||
registerCouldMatcher("arikeys key pressed"); | ||
registerSwitches("id"); | ||
} | ||
|
||
public AriKeyPressEvent event; | ||
|
||
@Override | ||
public boolean matches(ScriptPath path) { | ||
if (!runGenericSwitchCheck(path, "id", String.valueOf(event.getId()))) { | ||
return false; | ||
} | ||
if (!runInCheck(path, event.getPlayer().getLocation())) { | ||
return false; | ||
} | ||
return super.matches(path); | ||
} | ||
|
||
@Override | ||
public ScriptEntryData getScriptEntryData() { | ||
return new BukkitScriptEntryData(event.getPlayer()); | ||
} | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
switch (name) { | ||
case "id": return new ElementTag(event.getId().toString()); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@EventHandler | ||
public void onKeyPress(AriKeyPressEvent event) { | ||
this.event = event; | ||
fire(event); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
.../java/com/denizenscript/depenizen/bukkit/events/arikeys/AriKeysKeyReleaseScriptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.denizenscript.depenizen.bukkit.events.arikeys; | ||
|
||
import com.denizenscript.denizen.events.BukkitScriptEvent; | ||
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import com.denizenscript.denizencore.objects.core.ElementTag; | ||
import com.denizenscript.denizencore.scripts.ScriptEntryData; | ||
import eu.asangarin.arikeys.api.AriKeyReleaseEvent; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
public class AriKeysKeyReleaseScriptEvent extends BukkitScriptEvent implements Listener { | ||
|
||
// <--[event] | ||
// @Events | ||
// arikeys key released | ||
// | ||
// @Location true | ||
// | ||
// @Switch id:<id> to only process the event if the key ID matches the given text matcher. | ||
// | ||
// @Triggers When a key stops being pressed by a client running AriKeys, if that key is in the AriKeys config. | ||
// | ||
// @Context | ||
// <context.id> Returns the ID of the key that was released according to the AriKeys config, as a namespaced key. | ||
// | ||
// @Player Always. | ||
// | ||
// @Plugin Depenizen, AriKeys | ||
// | ||
// @Group Depenizen | ||
// | ||
// --> | ||
|
||
public AriKeysKeyReleaseScriptEvent() { | ||
registerCouldMatcher("arikeys key released"); | ||
registerSwitches("id"); | ||
} | ||
|
||
public AriKeyReleaseEvent event; | ||
|
||
@Override | ||
public boolean matches(ScriptPath path) { | ||
if (!runGenericSwitchCheck(path, "id", String.valueOf(event.getId()))) { | ||
return false; | ||
} | ||
if (!runInCheck(path, event.getPlayer().getLocation())) { | ||
return false; | ||
} | ||
return super.matches(path); | ||
} | ||
|
||
@Override | ||
public ScriptEntryData getScriptEntryData() { | ||
return new BukkitScriptEntryData(event.getPlayer()); | ||
} | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
switch (name) { | ||
case "id": return new ElementTag(event.getId().toString()); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@EventHandler | ||
public void onKeyRelease(AriKeyReleaseEvent event) { | ||
this.event = event; | ||
fire(event); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ api-version: '1.13' | |
|
||
softdepend: | ||
- AreaShop | ||
- AriKeys | ||
- ASkyBlock | ||
- BetonQuest | ||
- BigDoors | ||
|