public void editResetTempAddCache(Region r) { YamlConfiguration c = r.getConfigFile(); Map<String, Object> all = c.getValues(true); all.remove("Region.Permissions.TemporaryCache.AddNodes"); for (Entry<String, Object> entry : all.entrySet()) { c.set(entry.getKey(), entry.getValue()); } c.set("Region.Permissions.TemporaryCache.AddNodes", ""); r.setTemporaryNodesCacheAdd(("").split(",")); try { c.save(r.getRawConfigFile()); } catch (IOException e) { } }
public void editAddToPermAddCache(Region r, String message) { YamlConfiguration c = r.getConfigFile(); Map<String, Object> all = c.getValues(true); String current = (String) all.get("Region.Permissions.PermanentCache.AddNodes"); all.remove("Region.Permissions.PermanentCache.AddNodes"); for (Entry<String, Object> entry : all.entrySet()) { c.set(entry.getKey(), entry.getValue()); } c.set("Region.Permissions.PermanentCache.AddNodes", current.trim() + message.trim() + ","); r.setPermanentNodesCacheAdd((current.trim() + "," + message.trim()).split(",")); try { c.save(r.getRawConfigFile()); } catch (IOException e) { } }
public void editRemoveFromTempAddCache(Region r, String message) { YamlConfiguration c = r.getConfigFile(); Map<String, Object> all = c.getValues(true); String current = (String) all.get("Region.Permissions.TemporaryCache.AddNodes"); current = current.replaceAll(" ", ""); current = current.replaceAll(message + ",", ""); current = current.replaceAll(",,", ","); all.remove("Region.Permissions.TemporaryCache.AddNodes"); for (Entry<String, Object> entry : all.entrySet()) { c.set(entry.getKey(), entry.getValue()); } c.set("Region.Permissions.TemporaryCache.AddNodes", current.trim()); r.setTemporaryNodesCacheAdd((current.trim()).split(",")); try { c.save(r.getRawConfigFile()); } catch (IOException e) { } }