Skip to content

Commit

Permalink
update mythickeys
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 19, 2022
1 parent 9b3d009 commit 2086ead
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 15 deletions.
1 change: 1 addition & 0 deletions Docs/BukkitPlugins.md
Expand Up @@ -17,6 +17,7 @@ Supported Plugins: (And the sources we acquired Jar files from.)
- MagicSpells (https://github.com/TheComputerGeek2/MagicSpells/releases)
- mcMMO (https://ci.mcmmo.org/job/mcMMO/job/mcMMO/)
- MobArena (http://dev.bukkit.org/bukkit-plugins/mobarena/)
- MythicKeys (https://www.spigotmc.org/resources/mythickeysplugin-custom-keybinds-api.98893/)
- MythicMobs (https://www.spigotmc.org/resources/mythicmobs.5702/)
- NoCheatPlus (http://ci.md-5.net/job/NoCheatPlus/)
- NoteBlockAPI (https://www.spigotmc.org/resources/noteblockapi.19287/)
Expand Down
2 changes: 1 addition & 1 deletion lib
Submodule lib updated 1 files
+ mythickeysplugin.jar
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -195,7 +195,7 @@
<dependency>
<groupId>eu.asangarin</groupId>
<artifactId>mythickeys</artifactId>
<version>1.2</version>
<version>1.3</version>
<scope>system</scope>
<systemPath>${basedir}/lib/mythickeysplugin.jar</systemPath>
</dependency>
Expand Down
Expand Up @@ -3,11 +3,13 @@
import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.depenizen.bukkit.Bridge;
import com.denizenscript.depenizen.bukkit.events.mythickeys.MythicKeysKeyPressScriptEvent;
import com.denizenscript.depenizen.bukkit.events.mythickeys.MythicKeysKeyReleaseScriptEvent;

public class MythicKeysBridge extends Bridge {

@Override
public void init() {
ScriptEvent.registerScriptEvent(MythicKeysKeyPressScriptEvent.class);
ScriptEvent.registerScriptEvent(MythicKeysKeyReleaseScriptEvent.class);
}
}
Expand Up @@ -13,7 +13,6 @@
import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;

public class PlaceholderAPIBridge extends Bridge {

Expand Down
Expand Up @@ -33,7 +33,7 @@ public void init() {
PropertyParser.registerProperty(SentinelNPCProperties.class, NPCTag.class);
}

public class DenizenSentinelTargets extends SentinelIntegration {
public static class DenizenSentinelTargets extends SentinelIntegration {

@Override
public String getTargetHelp() {
Expand Down
Expand Up @@ -2,7 +2,6 @@

import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.denizencore.objects.core.ElementTag;
Expand Down Expand Up @@ -62,7 +61,7 @@ public String getName() {

@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(PlayerTag.mirrorBukkitPlayer(event.getPlayer()), null);
return new BukkitScriptEntryData(event.getPlayer());
}

@Override
Expand Down
Expand Up @@ -18,13 +18,11 @@ public class MythicKeysKeyPressScriptEvent extends BukkitScriptEvent implements
// @Location true
//
// @Switch id:<id> to only process the event if the key ID matches the given text matcher.
// @Switch held:<true/false> to only process the event for the given 'held' state. If 'false', only fires once per press. If 'true', fires continually after being pressed except the first tick. If left off, fires continually until released.
//
// @Triggers every tick in which a key is being held by a client running MythicKeys, if that key is in the MythicKeys config.
// @Triggers When a key is pressed by a client running MythicKeys, if that key is in the MythicKeys config.
//
// @Context
// <context.id> Returns the ID of the key tha twas pressed according to the MythicKeys config, as a namespaced key.
// <context.held> returns true if the key is being held, false if this is the first tick the button has been pressed for.
// <context.id> Returns the ID of the key that was pressed according to the MythicKeys config, as a namespaced key.
//
// @Player Always.
//
Expand All @@ -37,7 +35,7 @@ public class MythicKeysKeyPressScriptEvent extends BukkitScriptEvent implements
public MythicKeysKeyPressScriptEvent() {
instance = this;
registerCouldMatcher("mythickeys key pressed");
registerSwitches("id", "held");
registerSwitches("id");
}

public static MythicKeysKeyPressScriptEvent instance;
Expand All @@ -48,9 +46,6 @@ public boolean matches(ScriptPath path) {
if (!runGenericSwitchCheck(path, "id", String.valueOf(event.getId()))) {
return false;
}
if (!runGenericSwitchCheck(path, "held", String.valueOf(event.isHeld()))) {
return false;
}
if (!runInCheck(path, event.getPlayer().getLocation())) {
return false;
}
Expand All @@ -71,7 +66,6 @@ public ScriptEntryData getScriptEntryData() {
public ObjectTag getContext(String name) {
switch (name) {
case "id": return new ElementTag(event.getId().toString());
case "held": return new ElementTag(event.isHeld());
}
return super.getContext(name);
}
Expand Down
@@ -0,0 +1,78 @@
package com.denizenscript.depenizen.bukkit.events.mythickeys;

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.mythickeys.api.MythicKeyReleaseEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class MythicKeysKeyReleaseScriptEvent extends BukkitScriptEvent implements Listener {

// <--[event]
// @Events
// mythickeys 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 MythicKeys, if that key is in the MythicKeys config.
//
// @Context
// <context.id> Returns the ID of the key that was released according to the MythicKeys config, as a namespaced key.
//
// @Player Always.
//
// @Plugin Depenizen, MythicKeys
//
// @Group Depenizen
//
// -->

public MythicKeysKeyReleaseScriptEvent() {
instance = this;
registerCouldMatcher("mythickeys key released");
registerSwitches("id");
}

public static MythicKeysKeyReleaseScriptEvent instance;
public MythicKeyReleaseEvent 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 String getName() {
return "MythicKeysKeyReleased";
}

@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(MythicKeyReleaseEvent event) {
this.event = event;
fire(event);
}
}

0 comments on commit 2086ead

Please sign in to comment.