本文整理汇总了Java中ch.njol.skript.lang.util.SimpleEvent类的典型用法代码示例。如果您正苦于以下问题:Java SimpleEvent类的具体用法?Java SimpleEvent怎么用?Java SimpleEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleEvent类属于ch.njol.skript.lang.util包,在下文中一共展示了SimpleEvent类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerSlimefun
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
public static void registerSlimefun() {
Skript.registerEvent("On slimefun research", SimpleEvent.class, ResearchUnlockEvent.class,
"[(slimefun|sf)] research [unlock]");
EventValues.registerEventValue(ResearchUnlockEvent.class, Player.class,
new Getter<Player, ResearchUnlockEvent>() {
@Override
@Nullable
public Player get(ResearchUnlockEvent e) {
Player p = e.getPlayer();
return p;
}
}, 0);
Skript.registerExpression(ExprSlimefunEvtResearch.class, String.class, ExpressionType.SIMPLE, "event-research");
Skript.registerEffect(EffSlimefunUnlockResearch.class,
"[sharpsk] [(slimefun|sf)] unlock research %string% for %player%");
Skript.registerExpression(ExprSlimefunAllResearches.class, String.class, ExpressionType.SIMPLE,
"[sharpsk] [(slimefun|sf)] all [(of|the)] researches");
}
示例2: loadArmorStand
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
private static void loadArmorStand() {
Registration.registerEvent("Armor Stand Interact Event", SimpleEvent.class, PlayerArmorStandManipulateEvent.class, "armor stand (manipulate|interact)")
.document("Armor Stand Interact", "1.6.9", "Called when a player right clicks an armor stand to put something on it / take something off of it. "
+ "The event is called before the interaction fully happens, meaning, for example, player's tool is what was in the player's hand before interacting, "
+ "and (if it isn't air) represents what the player is putting on the armor stand. "
+ "Note: If you are using Umbaska, make sure to use manipulate instead of interact, as interact conflicts with an Umbaska event.")
.eventValue(Player.class, "1.6.9", "The player.")
.eventValue(Entity.class, "1.6.9", "The armor stand.")
.eventValue(ItemStack.class, "1.6.9", "The item being taken off.")
.eventValue(Slot.class, "1.6.9", "The equipment slot, use this to set the item in that particular event.");
Registration.registerEventValue(PlayerArmorStandManipulateEvent.class, ItemStack.class, PlayerArmorStandManipulateEvent::getArmorStandItem);
Registration.registerEventValue(PlayerArmorStandManipulateEvent.class, Slot.class, e ->
new ArmorStandEquipmentSlot(e.getRightClicked(), ArmorStandEquipmentSlot.EquipSlot.getByEquipmentSlot(e.getSlot())));
Registration.registerEvent("Armor Stand Place Event", EvtArmorStandPlace.class, EntitySpawnEvent.class, "armor stand place")
.document("Armor Stand Place", "1.6.9", "Called when an armor stand is placed")
.eventValue(Entity.class, "1.6.9", "The armor stand that was placed");
}
示例3: loadHanging
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
private static void loadHanging() {
Registration.registerEnum(HangingBreakEvent.RemoveCause.class, "hangingremovecause", HangingBreakEvent.RemoveCause.values())
.document("HangingRemoveCause", "1.8", "A cause for a hanged entity to have been unhung.");
Registration.registerEvent("Hang Event", SimpleEvent.class, HangingPlaceEvent.class, "hang")
.document("Hang", "1.6.4", "Called when an entity is hung. Can be cancelled. Also see the Hanged Entity expression.")
.eventValue(Entity.class, "1.6.4", "The entity that hung the hanged entity.")
.eventValue(Player.class, "1.6.4", "The player that hung the hanged entity (same as event-entity).")
.eventValue(Block.class, "1.6.4", "The block on which the hanged entity was hung.");
Registration.registerEventValue(HangingPlaceEvent.class, Block.class, HangingPlaceEvent::getBlock);
Registration.registerEvent("Unhang Event", EvtUnhang.class, HangingBreakEvent.class, "unhang [due to %-hangingremovecauses%]")
.document("Unhang", "1.8", "Called when an entity is unhung. Can be cancelled. "
+ "Optionally, you can specify hanging remove causes which make the trigger only be called if the unhanging is due to those reasons. "
+ "Also see the Hanged Entity expression.")
.eventValue(Entity.class, "1.8", "The entity that unhung the hanged entity.");
Registration.registerEventValue(HangingBreakByEntityEvent.class, Entity.class, HangingBreakByEntityEvent::getRemover);
Registration.registerEventValue(HangingBreakEvent.class, HangingBreakEvent.RemoveCause.class, HangingBreakEvent::getCause);
Registration.registerExpression(ExprHangedEntity.class,Entity.class, ExpressionType.SIMPLE,"hanged entity")
.document("Hanged Entity", "1.6.5", "An expression, used in the Hang and Unhang events, for the entity which was hung/unhung.");
}
示例4: loadServerListPing
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
private static void loadServerListPing() {
Registration.registerEvent("Server List Ping", SimpleEvent.class, ServerListPingEvent.class, "[[(server|player)] list] ping")
.document("Server List Ping", "1.8", "Called when a Minecraft client pings the server to show information in the server list.");
Registration.registerExpression(ExprAmountOfPlayers.class, Number.class, ExpressionType.SIMPLE, "(shown|sent) (0¦amount of|1¦max [amount of]) players")
.document("Shown Amount of Players", "1.8", "An expression, used in the Server List Ping event, for the amount of players currently online "
+ "or max amount of players allowed that was shown by your server to the pinging client.");
Registration.registerExpression(ExprMotd.class, String.class, ExpressionType.SIMPLE, "(shown|sent) motd")
.document("Shown MOTD", "1.8", "An expression, used in the Server List Ping event, for the MOTD shown by your server to the pinging client.");
Registration.registerExpression(ExprIP.class, String.class, ExpressionType.SIMPLE, "pinger's ip", "ip of pinger")
.document("IP of Pinger", "1.8", "An expression, used in the Server List Ping event, for the IP of the pinging client.");
}
示例5: loadTabCompletion
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
private static void loadTabCompletion() {
Registration.registerEvent("Chat Tab Complete Event", SimpleEvent.class, PlayerChatTabCompleteEvent.class, "chat tab complete")
.document("Chat Tab Complete", "1.8", "Called when a player uses tab to auto complete a message (not a command). "
+ "Also see the Completions and Last Token expressions.")
.eventValue(String.class, "1.8", "The full message so far typed by the player.");
Registration.registerEventValue(PlayerChatTabCompleteEvent.class, String.class, PlayerChatTabCompleteEvent::getChatMessage);
if (Reflection.classExists("org.bukkit.event.server.TabCompleteEvent")) {
Registration.registerEvent("Tab Complete Event", SimpleEvent.class, TabCompleteEvent.class, "tab complete")
.document("Tab Complete", "1.8", "Called when a player uses tab to auto complete a message or a command. "
+ "Only available in recent Bukkit versions. Also see the Completions and Last Token expressions.")
.eventValue(String.class, "1.8", "The full message so far typed by the player.");
Registration.registerEventValue(TabCompleteEvent.class, String.class, TabCompleteEvent::getBuffer);
Registration.registerExpression(ExprCompletions.class,String.class,ExpressionType.SIMPLE,"completions")
.document("Completions", "1.6.8", "An editable expression, used in the Tab Complete and Chat Tab Complete events, "
+ "for a list of all completions available for this tab complete.");
Registration.registerExpression(ExprLastToken.class, String.class, ExpressionType.SIMPLE, "last token")
.document("Last Token", "1.6.8", "An expression, used in the Tab Complete and Chat Tab Complete events, "
+ "for the last token typed by the player before tab completing.");
} else {
Registration.registerExpression(ExprCompletionsOld.class,String.class,ExpressionType.SIMPLE,"completions")
.document("Completions", "1.6.8", "An editable expression, used in the Chat Tab Complete event, "
+ "for a list of all completions available for this tab complete.");
Registration.registerExpression(ExprLastTokenOld.class, String.class, ExpressionType.SIMPLE, "last token")
.document("Last Token", "1.6.8", "An expression, used in the Chat Tab Complete event, "
+ "for the last token typed by the player before tab completing.");
}
}
示例6: ScriptFunction
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
@SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
public ScriptFunction(final String name, final Parameter<?>[] parameters, final SectionNode node, @Nullable final ClassInfo<T> returnType, final boolean single) {
super(name, parameters, returnType, single);
// here to allow recursion
Functions.functions.put(name, new FunctionData(this));
Functions.currentFunction = this;
try {
trigger = new Trigger(node.getConfig().getFile(), "function " + name, new SimpleEvent(), ScriptLoader.loadItems(node));
} finally {
Functions.currentFunction = null;
}
}
示例7: ScriptCommand
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
/**
* Creates a new SkriptCommand.
*
* @param name /name
* @param pattern
* @param arguments the list of Arguments this command takes
* @param description description to display in /help
* @param usage message to display if the command was used incorrectly
* @param aliases /alias1, /alias2, ...
* @param permission permission or null if none
* @param permissionMessage message to display if the player doesn't have the given permission
* @param items trigger to execute
*/
public ScriptCommand(final File script, final String name, final String pattern, final List<Argument<?>> arguments, final String description, final String usage, final ArrayList<String> aliases, final String permission, final String permissionMessage, final int executableBy, final List<TriggerItem> items) {
Validate.notNull(name, pattern, arguments, description, usage, aliases, items);
this.name = name;
label = "" + name.toLowerCase();
this.permission = permission;
this.permissionMessage = permissionMessage.isEmpty() ? Language.get("commands.no permission message") : Utils.replaceEnglishChatStyles(permissionMessage);
final Iterator<String> as = aliases.iterator();
while (as.hasNext()) { // remove aliases that are the same as the command
if (as.next().equalsIgnoreCase(label))
as.remove();
}
this.aliases = aliases;
activeAliases = new ArrayList<String>(aliases);
this.description = Utils.replaceEnglishChatStyles(description);
this.usage = Utils.replaceEnglishChatStyles(usage);
this.executableBy = executableBy;
this.pattern = pattern;
this.arguments = arguments;
trigger = new Trigger(script, "command /" + name, new SimpleEvent(), items);
bukkitCommand = setupBukkitCommand();
}
示例8: registeruCars
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
public static void registeruCars() {
Skript.registerEvent("uCars Car Respawn", SimpleEvent.class, uCarRespawnEvent.class,
"[on] [ucars] car respawn");
Skript.registerEvent("uCars Car crash", SimpleEvent.class, uCarCrashEvent.class, " [on] [ucars] car crash");
Skript.registerCondition(ConduCarsIsInCar.class, "[ucars] %player% is in [a] car");
Skript.registerCondition(ConduCarsIsInCar.class, "[ucars] %player% is not in [a] car");
}
示例9: loadNoteBlock
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
private static void loadNoteBlock() {
Map<String, Note> noteMap = new HashMap<>();
for (int octave : new int[]{0, 1})
for (Note.Tone tone : Note.Tone.values())
for (int deviation : new int[]{-1, 0, 1}) {
if (deviation == 1 && (tone == Note.Tone.B || tone == Note.Tone.E)) {
continue;
}
if (deviation == -1 && (tone == Note.Tone.C || tone == Note.Tone.F)) {
continue;
}
Note note = Note.natural(octave, tone);
if (deviation == 1) {
note = note.sharped();
} else if (deviation == -1) {
note = note.flattened();
}
String noteName = tone.name() + (deviation == 1 ? "+" : deviation == -1 ? "-" : "") + octave;
noteMap.put("N" + noteName, note);
if (octave == 0) {
noteMap.put("N" + noteName.substring(0, noteName.length() - 1), note);
}
}
Note fSharp2 = Note.sharp(2, Note.Tone.F);
noteMap.put("NF+2", fSharp2);
noteMap.put("NG-2", fSharp2);
EnumClassInfo<Note> noteEnumClassInfo = Registration.registerEnum(Note.class, "note", noteMap);
if (!MundoUtil.serverHasPlugin("RandomSK")) {
noteMap.forEach((noteName, note) -> noteEnumClassInfo.pair(noteName.substring(1), note));
}
Registration.registerEnum(Instrument.class, "instrument", Instrument.values())
.document("Instrument", "1.6", "An instrument to which a note can be played using a noteblock.");
Registration.registerEffect(EffPlayNoteBlock.class, "play [[%-note% with] %-instrument% on] noteblock %block%")
.document("Play Note on Noteblock", "1.6", "Plays the specified noteblock, optionally with a specified instrument and a specified note.");
Registration.registerEvent("Note Play", SimpleEvent.class, NotePlayEvent.class, "note play")
.document("Note Play", "1.6", "Called when a noteblock is played.")
.eventValue(Note.class, "1.6", "The note that was played.")
.eventValue(Instrument.class, "1.6", "The instrument using which the note was played.")
.eventValue(Block.class, "1.6", "The noteblock that was played.");
Registration.registerEventValue(NotePlayEvent.class, Note.class, NotePlayEvent::getNote);
Registration.registerEventValue(NotePlayEvent.class, Instrument.class, NotePlayEvent::getInstrument);
Registration.registerEventValue(NotePlayEvent.class, Block.class, NotePlayEvent::getBlock);
Registration.registerPropertyExpression(ExprNoteOfBlock.class, Note.class, "block", "note")
.document("Note of Noteblock", "1.6", "The current note of the specified noteblock.");
}
示例10: registerEvent
import ch.njol.skript.lang.util.SimpleEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void registerEvent(@SuppressWarnings("rawtypes") Class clazz, String syntax) {
Skript.registerEvent(syntax, SimpleEvent.class, clazz, "[skellett] " + syntax);
classes.add(clazz);
}