Java Code Examples for ninja.leaping.configurate.objectmapping.ObjectMappingException#printStackTrace()

The following examples show how to use ninja.leaping.configurate.objectmapping.ObjectMappingException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
public List<Location> getSigns(String rid) {
    List<Location> locs = new ArrayList<>();
    try {
        for (String s : signCfgs.getNode(rid).getList(of(String.class))) {
            String[] val = s.split(",");
            if (!Sponge.getServer().getWorld(val[0]).isPresent()) {
                continue;
            }
            locs.add(new Location<>(Sponge.getServer().getWorld(val[0]).get(), Double.valueOf(val[1]), Double.valueOf(val[2]), Double.valueOf(val[3])));
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
    return locs;
}
 
Example 2
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
public List<Location> getSigns(String rid) {
    List<Location> locs = new ArrayList<>();
    try {
        for (String s : signCfgs.getNode(rid).getList(of(String.class))) {
            String[] val = s.split(",");
            if (Bukkit.getServer().getWorld(val[0]) == null) {
                continue;
            }
            locs.add(new Location(Bukkit.getServer().getWorld(val[0]), Double.valueOf(val[1]), Double.valueOf(val[2]), Double.valueOf(val[3])));
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
    return locs;
}
 
Example 3
Source File: RedProtect.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
public void reloadConfigs() {
    cmdHandler.unregisterAll();

    try {
        config = new ConfigManager();
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }

    logger.info("Loading language files...");
    lang = new LangManager();
    guiLang = new LangGuiManager();

    logger.info("Re-registering commands...");
    cmdHandler = new CommandHandler(this);

}
 
Example 4
Source File: ConfigurationImpl.java    From EagleFactions with MIT License 5 votes vote down vote up
@Override
public List<String> getListOfStrings(final Collection<String> defaultValue, final Object... nodePath)
{
    try
    {
        return configNode.getNode(nodePath).getList(TypeToken.of(String.class), new ArrayList<>(defaultValue));
    }
    catch(ObjectMappingException e)
    {
        e.printStackTrace();
    }
    return new ArrayList<>();
}
 
Example 5
Source File: ConfigurationImpl.java    From EagleFactions with MIT License 5 votes vote down vote up
@Override
public Set<String> getSetOfStrings(final Collection<String> defaultValue,final Object... nodePath)
{
    try
    {
        return new HashSet<>(configNode.getNode(nodePath).getList(TypeToken.of(String.class), new ArrayList<>(defaultValue)));
    }
    catch(ObjectMappingException e)
    {
        e.printStackTrace();
    }
    return new HashSet<>();
}
 
Example 6
Source File: PlayerFilter.java    From Web-API with MIT License 5 votes vote down vote up
public PlayerFilter(WebHook hook, ConfigurationNode config) {
    super(hook, config);

    try {
        players = config.getList(TypeToken.of(String.class));
    } catch (ObjectMappingException e) {
        e.printStackTrace();
    }
}
 
Example 7
Source File: BlockTypeFilter.java    From Web-API with MIT License 5 votes vote down vote up
public BlockTypeFilter(WebHook hook, ConfigurationNode config) {
    super(hook, config);

    try {
        types = config.getList(TypeToken.of(BlockType.class));
    } catch (ObjectMappingException e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: ItemTypeFilter.java    From Web-API with MIT License 5 votes vote down vote up
public ItemTypeFilter(WebHook hook, ConfigurationNode config) {
    super(hook, config);

    try {
        items = config.getList(TypeToken.of(ItemType.class));
    } catch (ObjectMappingException e) {
        e.printStackTrace();
    }
}
 
Example 9
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public void putSign(String rid, Location<World> loc) {
    try {
        List<String> lsigns = new ArrayList<>(signCfgs.getNode(rid).getList(of(String.class)));
        String locs = loc.getExtent().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
        if (!lsigns.contains(locs)) {
            lsigns.add(locs);
            saveSigns(rid, lsigns);
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
}
 
Example 10
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public void removeSign(String rid, Location<World> loc) {
    try {
        List<String> lsigns = new ArrayList<>(signCfgs.getNode(rid).getList(of(String.class)));
        String locs = loc.getExtent().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
        if (lsigns.contains(locs)) {
            lsigns.remove(locs);
            saveSigns(rid, lsigns);
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
}
 
Example 11
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public void putSign(String rid, Location loc) {
    try {
        List<String> lsigns = new ArrayList<>(signCfgs.getNode(rid).getList(of(String.class)));
        String locs = loc.getWorld().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
        if (!lsigns.contains(locs)) {
            lsigns.add(locs);
            saveSigns(rid, lsigns);
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
}
 
Example 12
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public void removeSign(String rid, Location loc) {
    try {
        List<String> lsigns = new ArrayList<>(signCfgs.getNode(rid).getList(of(String.class)));
        String locs = loc.getWorld().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
        if (lsigns.contains(locs)) {
            lsigns.remove(locs);
            saveSigns(rid, lsigns);
        }
    } catch (ObjectMappingException e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
}
 
Example 13
Source File: WeatherListener.java    From UltimateCore with MIT License 5 votes vote down vote up
@Listener
public void onWeatherChange(ChangeWorldWeatherEvent event) {
    ModuleConfig config = Modules.WEATHER.get().getConfig().get();
    try {
        List<String> worlds = config.get().getNode("lockweather").getList(TypeToken.of(String.class));
        if (worlds.contains(event.getTargetWorld().getName()) || worlds.contains(event.getTargetWorld().getUniqueId().toString())) {
            event.setWeather(Weathers.CLEAR);
            event.setDuration(72000);
        }
    } catch (ObjectMappingException e) {
        e.printStackTrace();
    }

}
 
Example 14
Source File: SerializableTransform.java    From UltimateCore with MIT License 5 votes vote down vote up
public SerializableTransform(Transform<World> transform) {
    this.transform = transform;
    ConfigurationNode node = SimpleCommentedConfigurationNode.root();
    try {
        ts.serialize(TypeToken.of(Transform.class), transform, node);
    } catch (ObjectMappingException e) {
        //This should never happen
        e.printStackTrace();
    }
    this.node = node;
}
 
Example 15
Source File: ProtectionConfigImpl.java    From EagleFactions with MIT License 4 votes vote down vote up
@Override
public void reload()
{
	loadWorldsFile();

	this.protectWildernessFromPlayers = this.configuration.getBoolean(false, "protect-wilderness-from-players");
	this.protectFromMobGrief = this.configuration.getBoolean(false, "protect-from-mob-grief");
	this.protectFromMobGriefWarZone = this.configuration.getBoolean(false, "protect-from-mob-grief-warzone");
	this.allowExplosionsByOtherPlayersInClaims = this.configuration.getBoolean(false, "allow-explosions-by-other-players-in-claims");
	this.protectWarZoneFromPlayers = this.configuration.getBoolean(true, "protect-warzone-from-players");

	//Mob spawning
	this.spawnMobsInSafeZone = this.configuration.getBoolean(true, "spawn-mobs-in-safezone");
	this.spawnMobsInWarZone = this.configuration.getBoolean(true, "spawn-mobs-in-warzone");
	this.spawnHostileMobsInWarZone = this.configuration.getBoolean(true, "spawn-hostile-mobs-in-warzone");
	this.spawnMobsInFactionsTerritory = this.configuration.getBoolean(true, "spawn-mobs-in-factions-territory");
	this.spawnHostileMobsInFactionsTerritory = this.configuration.getBoolean(true, "spawn-hostile-mobs-in-factions-territory");

	//Worlds
	try
	{
		this.claimableWorldNames = new HashSet<>(this.worldsConfigNode.getNode("worlds", "CLAIMABLE").getList(TypeToken.of(String.class), new ArrayList<>()));
		this.notClaimableWorldNames = new HashSet<>(this.worldsConfigNode.getNode("worlds", "NOT_CLAIMABLE").getList(TypeToken.of(String.class), new ArrayList<>()));
		this.safeZoneWorldNames = new HashSet<>(this.worldsConfigNode.getNode("worlds", "SAFE_ZONE").getList(TypeToken.of(String.class), new ArrayList<>()));
		this.warZoneWorldNames = new HashSet<>(this.worldsConfigNode.getNode("worlds", "WAR_ZONE").getList(TypeToken.of(String.class), new ArrayList<>()));
	}
	catch (final ObjectMappingException e)
	{
		e.printStackTrace();
	}

	//Whitelisted items and blocks
	final Set<String> factionItemsWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "normal-faction", "items-whitelist");
	final Set<String> factionPlaceDestroyWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "normal-faction", "place-destroy-whitelist");
	final Set<String> factionInteractWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "normal-faction", "interact-whitelist");
	this.factionWhiteLists = new WhiteListsImpl(factionItemsWhiteList, factionInteractWhiteList, factionPlaceDestroyWhiteList);

	final Set<String> safeZoneItemsWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "safe-zone", "items-whitelist");
	final Set<String> safeZonePlaceDestroyWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "safe-zone", "place-destroy-whitelist");
	final Set<String> safeZoneInteractWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "safe-zone", "interact-whitelist");
	this.safeZoneWhiteLists = new WhiteListsImpl(safeZoneItemsWhiteList, safeZoneInteractWhiteList, safeZonePlaceDestroyWhiteList);

	final Set<String> warZoneItemsWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "war-zone", "items-whitelist");
	final Set<String> warZonePlaceDestroyWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "war-zone", "place-destroy-whitelist");
	final Set<String> warZoneInteractWhiteList = this.configuration.getSetOfStrings(new HashSet<>(), "allowed-items-and-blocks", "war-zone", "interact-whitelist");
	this.warZoneWhiteLists = new WhiteListsImpl(warZoneItemsWhiteList, warZoneInteractWhiteList, warZonePlaceDestroyWhiteList);
}