本文整理了Java中org.bukkit.Bukkit.getLogger()
方法的一些代码示例,展示了Bukkit.getLogger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getLogger()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getLogger
暂无
代码示例来源:origin: Bukkit/Bukkit
/**
* Creates a new {@link YamlConfiguration}, loading from the given reader.
* <p>
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
*
* @param reader input
* @return resulting configuration
* @throws IllegalArgumentException Thrown if stream is null
*/
public static YamlConfiguration loadConfiguration(Reader reader) {
Validate.notNull(reader, "Stream cannot be null");
YamlConfiguration config = new YamlConfiguration();
try {
config.load(reader);
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
} catch (InvalidConfigurationException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
}
return config;
}
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Creates a new {@link YamlConfiguration}, loading from the given file.
* <p>
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
* <p>
* The encoding used may follow the system dependent default.
*
* @param file Input file
* @return Resulting configuration
* @throws IllegalArgumentException Thrown if file is null
*/
public static YamlConfiguration loadConfiguration(File file) {
Validate.notNull(file, "File cannot be null");
YamlConfiguration config = new YamlConfiguration();
try {
config.load(file);
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
} catch (InvalidConfigurationException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file , ex);
}
return config;
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Creates a new {@link YamlConfiguration}, loading from the given stream.
* <p>
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
*
* @param stream Input stream
* @return Resulting configuration
* @throws IllegalArgumentException Thrown if stream is null
* @deprecated does not properly consider encoding
* @see #load(InputStream)
* @see #loadConfiguration(Reader)
*/
@Deprecated
public static YamlConfiguration loadConfiguration(InputStream stream) {
Validate.notNull(stream, "Stream cannot be null");
YamlConfiguration config = new YamlConfiguration();
try {
config.load(stream);
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
} catch (InvalidConfigurationException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
}
return config;
}
代码示例来源:origin: aadnk/ProtocolLib
/**
* Attempt to get the default logger from Bukkit.
* @return Bukkit default logger.
*/
private static Logger tryGetLogger() {
try {
return Bukkit.getLogger();
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
@Override
public void log(Level level, String content) {
try {
Bukkit.getLogger().log(level, "[NoCheatPlus] " + content);
} catch (Throwable t) {}
}
};
代码示例来源:origin: aadnk/ProtocolLib
private static Logger getBukkitLogger() {
try {
return Bukkit.getLogger();
} catch (LinkageError e) {
return Logger.getLogger("Minecraft");
}
}
代码示例来源:origin: BentoBoxWorld/BentoBox
@Override
public void printStackTrace(){
super.printStackTrace();
Bukkit.getLogger().log(Level.WARNING, " Basic format : (addon.yml)");
Bukkit.getLogger().log(Level.WARNING, " main: path.to.your.MainClass");
Bukkit.getLogger().log(Level.WARNING, " name: <NameOfYourModule>");
Bukkit.getLogger().log(Level.WARNING, " authors: <AuthorA> | <AuthorA, AuthorB>");
Bukkit.getLogger().log(Level.WARNING, " version: YourVersion");
}
}
代码示例来源:origin: drtshock/PlayerVaults
public static void debug(String s, long start) {
long elapsed = System.currentTimeMillis() - start;
if (DEBUG || elapsed > 4) {
Bukkit.getLogger().log(Level.INFO, "At {0}. Time since start: {1}ms", new Object[]{s, (elapsed)});
}
}
代码示例来源:origin: BentoBoxWorld/BentoBox
@Override
public void closeConnection() {
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
Bukkit.getLogger().severe("Could not close MariaDB database connection");
}
}
}
}
代码示例来源:origin: CitizensDev/CitizensAPI
private void create() {
try {
Bukkit.getLogger().log(Level.INFO, "Creating file: " + file.getName());
file.getParentFile().mkdirs();
file.createNewFile();
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Could not create file: " + file.getName());
}
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
@Override
public void onLoad() {
Bukkit.getLogger().info("[NoCheatPlus] onLoad: Early set up of static API, configuration, logging."); // Bukkit logger.
setupBasics();
}
代码示例来源:origin: eccentricdevotion/TARDIS
@Override
public void spawnAbandonedTARDIS(Location location) {
try {
spawnAbandonedTARDIS(location, "BUDGET", PRESET.FACTORY, COMPASS.SOUTH);
} catch (TARDISException ex) {
Bukkit.getLogger().log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@Override
@Nonnull
public ItemStack getURLSkull(String url) {
try {
// The "MHF_Question" is here so serialization doesn't cause an NPE
return getURLSkull(new URL(url), "MHF_Question", UUID.randomUUID());
} catch (MalformedURLException e) {
Bukkit.getLogger().log(Level.WARNING, "Malformed URL: " + url, e);
}
return new ItemStack(Material.AIR);
}
代码示例来源:origin: BentoBoxWorld/BentoBox
@Override
public Connection createConnection() {
try {
connection = DriverManager.getConnection(connectionUrl, dbSettings.getUsername(), dbSettings.getPassword());
} catch (SQLException e) {
Bukkit.getLogger().severe("Could not connect to the database! " + e.getMessage());
}
return connection;
}
代码示例来源:origin: BentoBoxWorld/BentoBox
@Override
public Connection createConnection() {
try {
connection = DriverManager.getConnection(connectionUrl, dbSettings.getUsername(), dbSettings.getPassword());
} catch (SQLException e) {
Bukkit.getLogger().severe("Could not connect to the database! " + e.getMessage());
}
return connection;
}
代码示例来源:origin: AdvancementAPI/AdvancementAPI
public static FrameType getFromString(String frameType) {
if (frameType.equalsIgnoreCase("random")) return FrameType.RANDOM();
else try {
return FrameType.valueOf(frameType);
} catch (EnumConstantNotPresentException e) {
Bukkit.getLogger().info("[AdvancementAPI] Unknown FrameType given. Using default (TASK)");
return FrameType.TASK;
}
}
代码示例来源:origin: BentoBoxWorld/BentoBox
/**
* Saves the FileConfiguration retrievable by getConfig().
*/
public void saveConfig() {
try {
getConfig().save(new File(dataFolder, ADDON_CONFIG_FILENAME));
} catch (IOException e) {
Bukkit.getLogger().severe("Could not save config!");
}
}
代码示例来源:origin: elBukkit/MagicPlugin
public static Class<?> getVersionedBukkitClass(String newVersion, String oldVersion) {
Class<?> c = getBukkitClass(newVersion);
if (c == null) {
c = getBukkitClass(oldVersion);
if (c == null) {
Bukkit.getLogger().warning("Could not bind to " + newVersion + " or " + oldVersion);
}
}
return c;
}
代码示例来源:origin: Bkm016/TabooLib
@Override
public void onEnable() {
update.addListener(((oldVal, newVal) -> {
Bukkit.getLogger().info("配置项 enableUpdate 的值由 " + oldVal + " 变为了 " + newVal);
if (newVal) {
Updater.start();
} else {
Updater.stop();
}
}));
}
代码示例来源:origin: ProtocolSupport/ProtocolSupport
public void loginOffline() {
try {
GameProfile profile = connection.getProfile();
profile.setOriginalUUID(networkManager.getSpoofedUUID() != null ? networkManager.getSpoofedUUID() : Profile.generateOfflineModeUUID(profile.getName()));
networkManager.getSpoofedProperties().forEach(profile::addProperty);
finishLogin();
} catch (Exception exception) {
disconnect("Failed to verify username!");
Bukkit.getLogger().log(Level.SEVERE, "Exception verifying " + connection.getProfile().getOriginalName(), exception);
}
}
内容来源于网络,如有侵权,请联系作者删除!