当前位置: 首页>>代码示例>>Java>>正文


Java LogHandler类代码示例

本文整理汇总了Java中net.dmulloy2.handlers.LogHandler的典型用法代码示例。如果您正苦于以下问题:Java LogHandler类的具体用法?Java LogHandler怎么用?Java LogHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogHandler类属于net.dmulloy2.handlers包,在下文中一共展示了LogHandler类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMessage

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public boolean sendMessage(Player player, ChatPosition position, BaseComponent... message)
{
	try
	{
		Object component = serialize.invoke(null, ComponentSerializer.toString(message));
		Object packet = packetConstructor.newInstance(component, position.getValue());

		Method getHandle = player.getClass().getMethod("getHandle");
		Object entityPlayer = getHandle.invoke(player);

		Object playerConnection = connectionField.get(entityPlayer);
		sendPacket.invoke(playerConnection, packet);
		return true;
	}
	catch (Throwable ex)
	{
		LogHandler.globalDebug(Util.getUsefulStack(ex, "sending chat packet to {0}", player.getName()));
		return false;
	}
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:22,代码来源:ReflectionProvider.java

示例2: beforeClass

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Throwable
{
	BukkitTesting.prepare();

	SwornPlugin plugin = mock(SwornPlugin.class);
	when(plugin.getLogHandler()).thenReturn(new LogHandler(plugin, Logger.getGlobal()));

	// Mock the config
	YamlConfiguration config = new YamlConfiguration();
	InputStream stream = Resources.getResource("config.yml").openStream();
	InputStreamReader reader = new InputStreamReader(stream, Charsets.UTF_8);
	config.load(reader);

	when(plugin.getConfig()).thenReturn(config);

	ConfigParser.parse(plugin, Config.class);
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:19,代码来源:ConfigTest.java

示例3: getMinecraftClass

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
private static Class<?> getMinecraftClass(String name)
{
	initialize();

	try
	{
		return Class.forName(NMS + name);
	}
	catch (Throwable ex)
	{
		LogHandler.globalDebug("Could not find Minecraft class {0}", NMS + name);
		return null;
	}
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:15,代码来源:ReflectionProvider.java

示例4: sendMessage

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public boolean sendMessage(Player player, ChatPosition position, BaseComponent... message)
{
	try
	{
		PacketContainer packet = manager.createPacket(PacketType.Play.Server.CHAT);

		// Write our message to the packet
		WrappedChatComponent component = WrappedChatComponent.fromJson(ComponentSerializer.toString(message));
		packet.getChatComponents().write(0, component);

		// Nullify Spigot's components
		packet.getModifier().write(1, null);

		// Write the position
		packet.getBytes().write(0, position != null ? position.getValue() : 1);

		// Send the packet
		manager.sendServerPacket(player, packet);
		return true;
	}
	catch (Throwable ex)
	{
		LogHandler.globalDebug(Util.getUsefulStack(ex, "sending chat packet to {0}", player.getName()));
		return false;
	}
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:28,代码来源:ProtocolLibProvider.java

示例5: onEnable

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public void onEnable()
{
	long start = System.currentTimeMillis();

	// Log handler
	logHandler = new LogHandler(this);

	// Configuration
	saveDefaultConfig();
	reloadConfig();

	// Integration
	setupIntegration();

	// Deploy tasks
	new CreatureSpawnTask(this).runTaskTimer(this, 20L, getConfig().getLong("spawnTicks"));

	if (getConfig().getBoolean("legendariesEnabled"))
	{
		new LegendarySpawnTask(this).runTaskTimer(this, 20L, getConfig().getLong("spawnTicks"));
	}

	if (getConfig().getBoolean("apocalypse.enabled", false))
	{
		new ApocalypseTask(this).runTaskTimer(this, 20L, getConfig().getLong("spawnTicks"));
	}

	// Register listeners
	PluginManager pm = getServer().getPluginManager();
	pm.registerEvents(new EntityListener(this), this);
	pm.registerEvents(new WorldListener(this), this);

	// Clear legendaries
	clearLegendaries();

	logHandler.log("{0} has been enabled. Took {1} ms.", getDescription().getFullName(), System.currentTimeMillis() - start);
}
 
开发者ID:MineSworn,项目名称:SwornCritters,代码行数:39,代码来源:SwornCritters.java

示例6: onEnable

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public void onEnable()
{
	long start = System.currentTimeMillis();

	/** Configuration **/
	saveDefaultConfig();
	reloadConfig();

	/** Register Handlers **/
	logHandler = new LogHandler(this);
	permissionHandler = new PermissionHandler(this);
	autoSaveHandler = new AutoSaveHandler(this);
	commandHandler = new CommandHandler(this);

	/** Register Commands **/
	commandHandler.setCommandPrefix("asp");
	commandHandler.registerPrefixedCommand(new CmdHelp(this));
	commandHandler.registerPrefixedCommand(new CmdReload(this));
	commandHandler.registerPrefixedCommand(new CmdSave(this));
	commandHandler.registerPrefixedCommand(new CmdVersion(this));

	/** Schedule Auto-Save task **/
	int delay = getConfig().getInt("delay", 15) * 20 * 60;
	new AutoSaveTask().runTaskTimer(this, delay, delay);

	logHandler.log("{0} has been enabled ({1}ms)", getDescription().getFullName(), System.currentTimeMillis() - start);
}
 
开发者ID:dmulloy2,项目名称:AutoSavePlus,代码行数:29,代码来源:AutoSavePlus.java

示例7: onEnable

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public void onEnable()
{
	long start = System.currentTimeMillis();

	// Configuration
	saveDefaultConfig();
	reloadConfig();

	// Initialize variables
	loadedGuns = new HashMap<>();
	bullets = new ConcurrentHashMap<>();
	players = new ConcurrentHashMap<>();
	effects = new ConcurrentHashMap<>();

	disabledWorlds = getConfig().getStringList("disabledWorlds");

	// Handlers
	logHandler = new LogHandler(this);
	commandHandler = new CommandHandler(this);
	permissionHandler = new PermissionHandler(this);

	// Integration
	setupIntegration();

	// Register commands
	commandHandler.setCommandPrefix("swornguns");

	CmdHelp cmdHelp = new CmdHelp(this);
	cmdHelp.setHeader("&3 ---- &eSwornGuns Help &3-- &e{1}&3/&e{2} &3----");
	commandHandler.registerPrefixedCommand(cmdHelp);

	commandHandler.registerPrefixedCommand(new CmdList(this));
	commandHandler.registerPrefixedCommand(new CmdReload(this));
	commandHandler.registerPrefixedCommand(new CmdToggle(this));
	commandHandler.registerPrefixedCommand(new CmdVersion(this));

	// Register events
	PluginManager pm = getServer().getPluginManager();
	pm.registerEvents(new PlayerListener(this), this);
	pm.registerEvents(new EntityListener(this), this);

	// Files
	File guns = new File(getDataFolder(), "guns");
	if (! guns.exists())
	{
		guns.mkdir();
	}

	File projectile = new File(getDataFolder(), "projectile");
	if (! projectile.exists())
	{
		projectile.mkdir();
	}

	// Load guns
	loadGuns();
	loadProjectiles();

	getOnlinePlayers();

	// Update timer
	new UpdateTimer().runTaskTimer(this, 20L, 1L);

	logHandler.log("{0} has been enabled. Took {1} ms.", getDescription().getFullName(), System.currentTimeMillis() - start);
}
 
开发者ID:dmulloy2,项目名称:SwornGuns,代码行数:67,代码来源:SwornGuns.java

示例8: onEnable

import net.dmulloy2.handlers.LogHandler; //导入依赖的package包/类
@Override
public void onEnable()
{
	long start = System.currentTimeMillis();

	// Register handlers
	logHandler = new LogHandler(this);
	commandHandler = new CommandHandler(this);
	permissionHandler = new PermissionHandler("parkour");
	resourceHandler = new ResourceHandler(this);

	// Configuration
	createDirectories();
	saveDefaultConfig();
	loadConfig();

	parkourHandler = new ParkourHandler(this);
	fileHandler = new FileHandler(this);

	updateRewards();
	loadGames();

	// Load signs
	fileHandler.loadSigns();

	// Integration
	setupIntegration();

	// Register commands
	commandHandler.setCommandPrefix("parkour");
	commandHandler.registerPrefixedCommand(new CmdAbandon(this));
	commandHandler.registerPrefixedCommand(new CmdClaim(this));
	commandHandler.registerPrefixedCommand(new CmdCreate(this));
	commandHandler.registerPrefixedCommand(new CmdDelete(this));
	commandHandler.registerPrefixedCommand(new CmdHelp(this));
	commandHandler.registerPrefixedCommand(new CmdJoin(this));
	commandHandler.registerPrefixedCommand(new CmdKick(this));
	commandHandler.registerPrefixedCommand(new CmdLeave(this));
	commandHandler.registerPrefixedCommand(new CmdList(this));
	commandHandler.registerPrefixedCommand(new CmdReload(this));
	commandHandler.registerPrefixedCommand(new CmdSetPoint(this));
	commandHandler.registerPrefixedCommand(new CmdSpawn(this));
	commandHandler.registerPrefixedCommand(new CmdVersion(this));

	// Register listeners
	PluginManager pm = getServer().getPluginManager();
	pm.registerEvents(new PlayerListener(this), this);
	pm.registerEvents(new BlockListener(this), this);

	log("{0} has been enabled. Took {1} ms.", getDescription().getFullName(), System.currentTimeMillis() - start);
}
 
开发者ID:dmulloy2,项目名称:SwornParkour,代码行数:52,代码来源:SwornParkour.java


注:本文中的net.dmulloy2.handlers.LogHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。