本文整理了Java中org.bukkit.event.EventHandler.<init>()
方法的一些代码示例,展示了EventHandler.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventHandler.<init>()
方法的具体详情如下:
包路径:org.bukkit.event.EventHandler
类名称:EventHandler
方法名:<init>
暂无
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler
public void onPluginEnable(PluginEnableEvent event) {
Plugin plugin = event.getPlugin();
String name = plugin.getDescription().getName();
if (plugin instanceof PermissionsProvider) {
setPluginPermissionsResolver(plugin);
} else if ("permissions".equalsIgnoreCase(name) || "permissionsex".equalsIgnoreCase(name)
|| "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name)
|| "vault".equalsIgnoreCase(name)) {
load();
}
}
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler
public void onPluginDisable(PluginDisableEvent event) {
String name = event.getPlugin().getDescription().getName();
if (event.getPlugin() instanceof PermissionsProvider
|| "permissions".equalsIgnoreCase(name) || "permissionsex".equalsIgnoreCase(name)
|| "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name)
|| "vault".equalsIgnoreCase(name)) {
load();
}
}
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler(ignoreCancelled = true)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (commandRegistration.dispatch(event.getPlayer(), event.getMessage().substring(1))) {
event.setCancelled(true);
}
}
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerCommand(PlayerCommandSendEvent event) {
CommandLocals locals = new CommandLocals();
locals.put(Actor.class, plugin.wrapCommandSender(event.getPlayer()));
Set<String> toRemove = plugin.getWorldEdit().getPlatformManager().getCommandManager().getDispatcher().getCommands().stream()
.filter(commandMapping -> !commandMapping.getCallable().testPermission(locals))
.map(CommandMapping::getPrimaryAlias)
.collect(Collectors.toSet());
event.getCommands().removeIf(toRemove::contains);
}
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onGamemode(PlayerGameModeChangeEvent event) {
if (!plugin.getInternalPlatform().isHookingEvents()) {
return;
}
// this will automatically refresh their session, we don't have to do anything
WorldEdit.getInstance().getSessionManager().get(plugin.wrapPlayer(event.getPlayer()));
}
代码示例来源:origin: EngineHub/WorldEdit
/**
* Called when a player attempts to use a command
*
* @param event Relevant event details
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
String[] split = event.getMessage().split(" ");
if (split.length > 0) {
split[0] = split[0].substring(1);
split = plugin.getWorldEdit().getPlatformManager().getCommandManager().commandDetection(split);
}
final String newMessage = "/" + StringUtil.joinString(split, " ");
if (!newMessage.equals(event.getMessage())) {
event.setMessage(newMessage);
plugin.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (!event.getMessage().isEmpty()) {
plugin.getServer().dispatchCommand(event.getPlayer(), event.getMessage().substring(1));
}
event.setCancelled(true);
}
}
}
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPluginEnabled(PluginEnableEvent evt) {
if (!readyToEnable()) {
if (readyToEnable()) { /* If we;re ready now, finish enable */
doEnable(); /* Finish enable */
}
}
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerQuit(PlayerQuitEvent evt) {
DynmapPlayer dp = new BukkitPlayer(evt.getPlayer());
core.listenerManager.processPlayerEvent(EventType.PLAYER_QUIT, dp);
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onSpawnChange(SpawnChangeEvent evt) {
BukkitWorld w = getWorld(evt.getWorld());
core.listenerManager.processWorldEvent(EventType.WORLD_SPAWN_CHANGE, w);
}
}, DynmapPlugin.this);
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockFromTo(BlockFromToEvent event) {
Block b = event.getBlock();
Material m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
b = event.getToBlock();
m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
}
};
代码示例来源:origin: EngineHub/WorldEdit
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!plugin.getInternalPlatform().isHookingEvents()) {
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerJoin(PlayerJoinEvent evt) {
final DynmapPlayer dp = new BukkitPlayer(evt.getPlayer());
// Give other handlers a change to prep player (nicknames and such from Essentials)
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, new Runnable() {
@Override
public void run() {
core.listenerManager.processPlayerEvent(EventType.PLAYER_JOIN, dp);
}
}, 2);
}
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerMove(PlayerMoveEvent event) {
Location loc = event.getPlayer().getLocation();
mapManager.touch(getWorld(loc.getWorld()).getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "playermove");
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockBreak(BlockBreakEvent evt) {
Block b = evt.getBlock();
if(b == null) return; /* Work around for stupid mods.... */
Location l = b.getLocation();
core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().getId(),
getWorld(l.getWorld()).getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ());
}
}, DynmapPlugin.this);
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockBreak(BlockBreakEvent event) {
Block b = event.getBlock();
if(b == null) return; /* Stupid mod workaround */
Location loc = b.getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockbreak");
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockForm(BlockFormEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockform");
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onLeavesDecay(LeavesDecayEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if(onleaves) {
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "leavesdecay");
}
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockRedstone(BlockRedstoneEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockredstone");
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onBlockPlace(BlockPlaceEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockplace");
}
};
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
public void onSignChange(SignChangeEvent evt) {
Block b = evt.getBlock();
Location l = b.getLocation();
String[] lines = evt.getLines(); /* Note: changes to this change event - intentional */
DynmapPlayer dp = null;
Player p = evt.getPlayer();
if(p != null) dp = new BukkitPlayer(p);
core.listenerManager.processSignChangeEvent(EventType.SIGN_CHANGE, b.getType().getId(),
getWorld(l.getWorld()).getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ(), lines, dp);
}
}, DynmapPlugin.this);
内容来源于网络,如有侵权,请联系作者删除!