本文整理汇总了Java中net.canarymod.Canary类的典型用法代码示例。如果您正苦于以下问题:Java Canary类的具体用法?Java Canary怎么用?Java Canary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Canary类属于net.canarymod包,在下文中一共展示了Canary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPlayerPermissions
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public Set<String> checkPlayerPermissions(String player, Set<String> perms) {
if (Canary.bans().isBanned(player)) {
return Collections.emptySet();
}
OfflinePlayer p = Canary.getServer().getOfflinePlayer(player);
if (p == null) {
return Collections.emptySet();
}
Set<String> rslt = new HashSet<String>();
for (String s : perms) {
if (p.hasPermission(s)) {
rslt.add(s);
}
}
return rslt;
}
示例2: doEnable
import net.canarymod.Canary; //导入依赖的package包/类
private void doEnable() {
/* Enable core */
if(!core.enableCore(enabCoreCB)) {
pm.disablePlugin("dynmap");
return;
}
playerList = core.playerList;
sscache = new SnapshotCache(core.getSnapShotCacheSize(), core.useSoftRefInSnapShotCache());
/* Get map manager from core */
mapManager = core.getMapManager();
/* Initialized the currently loaded worlds */
for (World world : Canary.getServer().getWorldManager().getAllWorlds()) {
CanaryModWorld w = getWorld(world);
if(core.processWorldLoad(w)) /* Have core process load first - fire event listeners if good load after */
core.listenerManager.processWorldEvent(EventType.WORLD_LOAD, w);
}
/* Register our update trigger events */
registerEvents();
/* Core is ready - notify API availability */
DynmapCommonAPIListener.apiInitialized(this);
Log.info("Enabled");
}
示例3: onPopulateEnvironment
import net.canarymod.Canary; //导入依赖的package包/类
@Inject(method = "populateEnvironment", at = @At("RETURN"))
private void onPopulateEnvironment(CallbackInfo ci) {
if (Canary.pluginManager() != null) {
this.theReportCategory.addCrashSectionCallable("Canary Plugins", () -> {
final StringBuilder result = new StringBuilder(64);
for (final Plugin plugin : Canary.pluginManager().getPlugins()) {
result.append("\n\t\t")
.append(plugin.getName())
.append(" v ")
.append(plugin.getVersion())
.append(" (")
.append(plugin.getPath())
.append(")");
}
return result.toString();
});
}
}
示例4: getPlayerName
import net.canarymod.Canary; //导入依赖的package包/类
private String getPlayerName(final String uuid) {
String name = null;
final Player player = Canary.getServer().getPlayerFromUUID(uuid);
if (player != null) {
// Player online
ZownPlugin.LOG.debug("Found online Player");
name = player.getName();
} else {
// Player offline
final OfflinePlayer oPlayer = Canary.getServer().getOfflinePlayer(UUID.fromString(uuid));
if (oPlayer != null) {
ZownPlugin.LOG.debug("Found offline Player");
name = oPlayer.getName();
}
}
return name;
}
示例5: executeCommand
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public int executeCommand(ICommandSender sender, String command) {
command = command.trim();
if (command.startsWith("/")) {
command = command.substring(1);
}
String[] args = command.split(" ");
String commandName = args[0];
boolean exists = Canary.commands().parseCommand((MessageReceiver) sender, commandName, args);
if (!exists) {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.notFound", new Object[0]);
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
sender.addChatMessage(chatcomponenttranslation);
}
return exists ? 1 : 0;
}
示例6: consoleCommand
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public boolean consoleCommand(String command) {
final ConsoleCommandHook commandHook = (ConsoleCommandHook) new ConsoleCommandHook(this, command).call();
if (commandHook.isCanceled()) {
return true;
}
final String[] args = command.split(" ");
String commandName = args[0];
if (commandName.startsWith("/")) {
commandName = commandName.substring(1);
}
if (!Canary.commands().parseCommand(this, commandName, args)) {
return this.getCommandManager().executeCommand((ICommandSender) this, command) > 0;
}
return true;
}
示例7: main
import net.canarymod.Canary; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// Some handy messages that CanaryMod has
Canary.log.info("Starting: " + Canary.getImplementationTitle() + " " + Canary.getImplementationVersion());
Canary.log.info("Neptune Path: " + Canary.getCanaryJarPath() + " & Working From: " + Canary.getWorkingPath());
// Initialise the sqlite jdbc driver
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException ignored) {
}
// Now lets initialise Neptune / Canary
initNeptune();
// Now we're ready to start the Minecraft server
MinecraftServer.main(args);
}
示例8: DynmapPlugin
import net.canarymod.Canary; //导入依赖的package包/类
public DynmapPlugin() {
plugin = this;
helper = CanaryVersionHelper.getHelper();
pm = Canary.pluginManager();
ModSupportImpl.init();
}
示例9: getBlockIDAt
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public int getBlockIDAt(String wname, int x, int y, int z) {
World w = Canary.getServer().getWorld(wname);
Chunk c = null;
if (w != null) {
c = w.getChunk(x >> 4, z >> 4);
}
if (c != null) {
return c.getBlockTypeAt(x & 0xF, y, z & 0xF);
}
return -1;
}
示例10: getOnlinePlayers
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public DynmapPlayer[] getOnlinePlayers() {
List<Player> players = Canary.getServer().getPlayerList();
DynmapPlayer[] dplay = new DynmapPlayer[players.size()];
for(int i = 0; i < dplay.length; i++)
dplay[i] = new BukkitPlayer(players.get(i));
return dplay;
}
示例11: getPlayer
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public DynmapPlayer getPlayer(String name) {
Player p = Canary.getServer().getPlayer(name);
if(p != null) {
return new BukkitPlayer(p);
}
return null;
}
示例12: getOfflinePlayer
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public DynmapPlayer getOfflinePlayer(String name) {
OfflinePlayer op = Canary.getServer().getOfflinePlayer(name);
if(op != null) {
return new BukkitPlayer(op);
}
return null;
}
示例13: checkPlayerPermission
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public boolean checkPlayerPermission(String player, String perm) {
if (Canary.bans().isBanned(player)) {
return false;
}
OfflinePlayer p = Canary.getServer().getOfflinePlayer(player);
boolean rslt = false;
if (p != null)
rslt = p.hasPermission(perm);
return rslt;
}
示例14: getHome
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public Location getHome() {
final Warp home = Canary.warps().getHome(this);
if (home != null) {
return home.getLocation();
}
return this.getSpawnPosition();
}
示例15: enable
import net.canarymod.Canary; //导入依赖的package包/类
@Override
public boolean enable() {
if (Bukkit.getServer() == null) {
server = new CanaryServer(Canary.getServer(), getLogman());
}
// Enable Listener
Canary.hooks().registerListener(new CanaryPlayerListener(server), this);
Canary.hooks().registerListener(new CanaryBlockListener(server), this);
Canary.hooks().registerListener(new CanaryWorldListener(server), this);
Canary.hooks().registerListener(new CanaryServerListener(server), this);
// Create all the directories.
Constants.createDirectories();
// Start server
server.start();
// Metrics (statistics)
try {
Metrics metrics = new Metrics(this);
Metrics.Graph plugins = metrics.createGraph("Plugins");
for (org.bukkit.plugin.Plugin plugin : server.getPluginManager().getPlugins()) {
plugins.addPlotter(new Metrics.Plotter(plugin.getName()) {
@Override
public int getValue() {
return 1;
}
});
}
metrics.start();
} catch (IOException e) {
getLogman().warn("Failed to send statistics to Metrics", e);
}
return true;
}