CustomCommandListener on steroids
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
78ad3cf7a3
Commit
d77deffcc9
@ -35,7 +35,10 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class CustomCommandListener implements Listener {
|
public class CustomCommandListener implements Listener {
|
||||||
@ -126,20 +129,6 @@ public class CustomCommandListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
customCommands.stream().map(customCommand -> customCommand.execute(e)).filter(b -> !b).findFirst();
|
customCommands.stream().map(customCommand -> customCommand.execute(e)).filter(b -> !b).findFirst();
|
||||||
|
|
||||||
|
|
||||||
/*String[] command = e.getMessage().split(" ");
|
|
||||||
|
|
||||||
BookMeta bookMeta = bookMetaMap.get(e.getMessage());
|
|
||||||
if (bookMeta == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.setCancelled(true);
|
|
||||||
try {
|
|
||||||
new ScriptExecutor(bookMeta, e.getPlayer());
|
|
||||||
} catch (StackOverflowError exception) {
|
|
||||||
// Ignored
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNoBook(ItemStack item) {
|
private boolean isNoBook(ItemStack item) {
|
||||||
|
@ -52,7 +52,7 @@ public final class ScriptExecutor {
|
|||||||
command = command.replaceAll(" +", " ");
|
command = command.replaceAll(" +", " ");
|
||||||
if (command.startsWith("#") || command.trim().isEmpty()) {
|
if (command.startsWith("#") || command.trim().isEmpty()) {
|
||||||
if (initial && command.startsWith("#!CMD /")) {
|
if (initial && command.startsWith("#!CMD /")) {
|
||||||
specialCommand = command.substring(7);
|
specialCommand = command.substring(7).split(" ")[0];
|
||||||
}
|
}
|
||||||
initial = false;
|
initial = false;
|
||||||
continue;
|
continue;
|
||||||
@ -102,7 +102,7 @@ public final class ScriptExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(player, "/" + (command.equals(specialCommand) ? "script:" : "") + command);
|
PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(player, "/" + (specialCommand != null && command.startsWith(specialCommand) ? "script:" : "") + command);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(preprocessEvent);
|
Bukkit.getServer().getPluginManager().callEvent(preprocessEvent);
|
||||||
if (preprocessEvent.isCancelled()) {
|
if (preprocessEvent.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package de.steamwar.bausystem.features.script.variables;
|
package de.steamwar.bausystem.features.script.variables;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
public interface Value {
|
public interface Value {
|
||||||
long asLong();
|
long asLong();
|
||||||
@ -12,6 +13,7 @@ public interface Value {
|
|||||||
void fromString(String value);
|
void fromString(String value);
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
class LongValue implements Value {
|
class LongValue implements Value {
|
||||||
|
|
||||||
private long value;
|
private long value;
|
||||||
@ -52,6 +54,7 @@ public interface Value {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
class BooleanValue implements Value {
|
class BooleanValue implements Value {
|
||||||
|
|
||||||
private boolean value;
|
private boolean value;
|
||||||
@ -88,6 +91,7 @@ public interface Value {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
class StringValue implements Value {
|
class StringValue implements Value {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren