@Override public void setPassengerOfNMS(NMSEntityBase vehicleBase) { if (vehicleBase == null || !(vehicleBase instanceof Entity)) { // It should never dismount return; } Entity entity = (Entity) vehicleBase; try { RIDER_PITCH_DELTA.set(this, 0.0); RIDER_YAW_DELTA.set(this, 0.0); } catch (Exception ex) { ConsoleLogger.logDebugException(ex); } if (this.vehicle != null) { this.vehicle.passenger = null; } this.vehicle = entity; entity.passenger = this; }
@Override public void onUpdateFound(final String newVersion) { HolographicDisplays.newVersion = newVersion; ConsoleLogger.log(Level.INFO, "Found a new version available: " + newVersion); ConsoleLogger.log(Level.INFO, "Download it on Bukkit Dev:"); ConsoleLogger.log(Level.INFO, "dev.bukkit.org/bukkit-plugins/holographic-displays"); } });
ConsoleLogger.log(Level.WARNING, "Could not find a valid 'speed: <number>' in the first line of the file '" + file.getName() + "'. Default speed of 0.5 seconds will be used."); ConsoleLogger.log(Level.WARNING, "Could not find any line in '" + file.getName() + "' (excluding the speed). You should add at least one more line."); ConsoleLogger.logDebug(Level.INFO, "Successfully loaded animation '" + file.getName() + "', speed = " + speed + "."); ConsoleLogger.log(Level.SEVERE, "Couldn't load the file '" + file.getName() + "'!", e);
@Override public EntityNMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { ConsoleLogger.handleSpawnFail(parentPiece); } return touchSlime; }
} catch (InvalidConfigurationException e) { e.printStackTrace(); ConsoleLogger.log(Level.WARNING, "The configuration is not a valid YAML file! Please check it with a tool like http://yaml-online-parser.appspot.com/"); return; } catch (IOException e) { e.printStackTrace(); ConsoleLogger.log(Level.WARNING, "I/O error while reading the configuration. Was the file in use?"); return; } catch (Exception e) { e.printStackTrace(); ConsoleLogger.log(Level.WARNING, "Unhandled exception while reading the configuration!"); return; } catch (IOException e) { e.printStackTrace(); ConsoleLogger.log(Level.WARNING, "I/O error while saving the configuration. Was the file in use?"); String[] nameAndAddress = singleServer.split(":", 2); if (nameAndAddress.length < 2) { ConsoleLogger.log(Level.WARNING, "The server info \"" + singleServer + "\" is not valid. There should be a name and an address, separated by a colon."); continue; port = Integer.parseInt(ipAndPort[1]); } catch (NumberFormatException e) { ConsoleLogger.log(Level.WARNING, "Invalid port number in the server info \"" + singleServer + "\"."); continue; ConsoleLogger.setDebugEnabled(config.getBoolean(ConfigNode.DEBUG.getPath()));
public static void logDebug(Level level, String msg) { logDebug(level, msg, null); }
@Override public EntityNMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { ConsoleLogger.handleSpawnFail(parentPiece); } return touchSlime; }
public static void handleSpawnFail(HologramLine parentPiece) { logDebug(Level.WARNING, "Coulnd't spawn entity for this hologram: " + parentPiece.getParent().toString()); }
@Override public EntityNMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { ConsoleLogger.handleSpawnFail(parentPiece); } return touchSlime; }
@Override public void setPassengerOfNMS(NMSEntityBase vehicleBase) { if (vehicleBase == null || !(vehicleBase instanceof Entity)) { // It should never dismount return; } Entity entity = (Entity) vehicleBase; try { RIDER_PITCH_DELTA.set(this, 0.0); RIDER_YAW_DELTA.set(this, 0.0); } catch (Exception ex) { ConsoleLogger.logDebugException(ex); } if (this.vehicle != null) { this.vehicle.passenger = null; } this.vehicle = entity; entity.passenger = this; }
public static void logDebug(Level level, String msg, Throwable thrown) { if (debug) { log(level, "[Debug] " + msg, thrown); } }
@Override public void run() { long now = System.currentTimeMillis(); Iterator<Entry<String, BungeeServerInfo>> iter = BungeeServerTracker.getTrackedServers().entrySet().iterator(); while (iter.hasNext()) { Entry<String, BungeeServerInfo> next = iter.next(); long lastRequest = next.getValue().getLastRequest(); if (lastRequest != 0 && now - lastRequest > MAX_INACTIVITY) { // Don't track that server anymore. iter.remove(); ConsoleLogger.logDebug(Level.INFO, "Removed bungee server \"" + next.getKey() + "\" from tracking due to inactivity."); } } }
@Override public EntityNMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { ConsoleLogger.handleSpawnFail(parentPiece); } return touchSlime; }
@Override public void setPassengerOfNMS(NMSEntityBase vehicleBase) { if (vehicleBase == null || !(vehicleBase instanceof Entity)) { // It should never dismount return; } Entity entity = (Entity) vehicleBase; try { RIDER_PITCH_DELTA.set(this, 0.0); RIDER_YAW_DELTA.set(this, 0.0); } catch (Exception ex) { ConsoleLogger.logDebugException(ex); } if (this.vehicle != null) { this.vehicle.passenger = null; } this.vehicle = entity; entity.passenger = this; }
public static void log(Level level, String msg) { log(level, msg, null); }
ConsoleLogger.logDebug(Level.WARNING, "Received empty Json response from IP \"" + address.toString() + "\"!"); return; ConsoleLogger.logDebug(Level.WARNING, "Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString); return; ConsoleLogger.logDebug(Level.WARNING, "Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString);
@Override public EntityNMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { ConsoleLogger.handleSpawnFail(parentPiece); } return touchSlime; }
@Override public void setPassengerOfNMS(NMSEntityBase vehicleBase) { if (vehicleBase == null || !(vehicleBase instanceof Entity)) { // It should never dismount return; } Entity entity = (Entity) vehicleBase; try { RIDER_PITCH_DELTA.set(this, 0.0); RIDER_YAW_DELTA.set(this, 0.0); } catch (Exception ex) { ConsoleLogger.logDebugException(ex); } if (this.vehicle != null) { this.vehicle.passenger = null; } this.vehicle = entity; entity.passenger = this; } }
public static void trySaveToDisk() { try { saveToDisk(); } catch (IOException ex) { ex.printStackTrace(); ConsoleLogger.log(Level.SEVERE, "Unable to save database.yml to disk!"); } } }