Solved Not Working

Discussion in 'Plugin Development' started by HelGod, Sep 30, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    HelGod

    Does anyone know why this isn't working?
    Code:java
    1. public void deleteArena(Arena arena) {
    2. if(arenas.contains(arena)) {
    3.  
    4. List<String> list = plugin.sm.getArena().getStringList("Arenas");
    5. list.remove(arena.getName());
    6.  
    7. plugin.sm.getArena().set("Arenas", list);
    8.  
    9. plugin.sm.getArena().set(arena.getName(), null);
    10. plugin.sm.getArena().set("Arenas", list);
    11. plugin.sm.saveArena();
    12.  
    13. plugin.sm.getSign().set(arena.getName(), null);
    14. plugin.sm.saveSign();
    15.  
    16. plugin.sm.getSpawn().set("Spawns." + arena.getName(), null);
    17. plugin.sm.saveSpawn();
    18.  
    19. arenas.remove(arena);
    20. }
    21. }
    22.  


    SettingsManager
    Code:java
    1. import java.io.File;
    2. import java.io.IOException;
    3.  
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.configuration.file.FileConfiguration;
    7. import org.bukkit.configuration.file.YamlConfiguration;
    8. import org.bukkit.plugin.Plugin;
    9.  
    10. public class SettingsManager {
    11.  
    12. static SettingsManager instance = new SettingsManager();
    13.  
    14. public static SettingsManager getInstance() {
    15. return instance;
    16. }
    17.  
    18. Plugin p;
    19.  
    20. FileConfiguration spawn;
    21. File sfile;
    22.  
    23. FileConfiguration arena;
    24. File afile;
    25.  
    26. FileConfiguration sign;
    27. File snfile;
    28.  
    29. FileConfiguration data;
    30. File dfile;
    31.  
    32.  
    33.  
    34. public void setupSpawn(Plugin p) {
    35.  
    36. sfile = new File(p.getDataFolder(), "spawns.yml");
    37.  
    38. if (!sfile.exists()) {
    39. try {
    40. sfile.createNewFile();
    41. }
    42. catch (IOException e) {
    43. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create spawns.yml!");
    44. }
    45. }
    46. spawn = YamlConfiguration.loadConfiguration(sfile);
    47. }
    48.  
    49. public FileConfiguration getSpawn() {
    50. return spawn;
    51. }
    52.  
    53. public void saveSpawn() {
    54. try {
    55. spawn.save(sfile);
    56. }
    57. catch (IOException e) {
    58. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save spawns.yml!");
    59. e.printStackTrace();
    60. }
    61. }
    62.  
    63. public void reloadSpawn() {
    64. spawn = YamlConfiguration.loadConfiguration(sfile);
    65. }
    66.  
    67. public void setupArena(Plugin p) {
    68.  
    69. afile = new File(p.getDataFolder(), "arena.yml");
    70.  
    71. if (!afile.exists()) {
    72. try {
    73. afile.createNewFile();
    74. }
    75. catch (IOException e) {
    76. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create arena.yml!");
    77. e.printStackTrace();
    78. }
    79. }
    80. arena = YamlConfiguration.loadConfiguration(afile);
    81. }
    82.  
    83. public FileConfiguration getArena() {
    84. return arena;
    85. }
    86.  
    87. public void saveArena() {
    88. try {
    89. arena.save(afile);
    90. }
    91. catch (IOException e) {
    92. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save arena.yml!");
    93. }
    94. }
    95.  
    96. public void reloadArena() {
    97. arena = YamlConfiguration.loadConfiguration(afile);
    98. }
    99.  
    100. public void setupSign(Plugin p) {
    101.  
    102. snfile = new File(p.getDataFolder(), "signs.yml");
    103.  
    104. if (!snfile.exists()) {
    105. try {
    106. snfile.createNewFile();
    107. }
    108. catch (IOException e) {
    109. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create spawns.yml!");
    110. }
    111. }
    112. sign = YamlConfiguration.loadConfiguration(snfile);
    113. }
    114.  
    115. public FileConfiguration getSign() {
    116. return sign;
    117. }
    118.  
    119. public void saveSign() {
    120. try {
    121. sign.save(snfile);
    122. }
    123. catch (IOException e) {
    124. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save spawns.yml!");
    125. e.printStackTrace();
    126. }
    127. }
    128.  
    129. public void reloadSign() {
    130. sign = YamlConfiguration.loadConfiguration(snfile);
    131. }
    132.  
    133. public void setupData(Plugin p) {
    134.  
    135. dfile = new File(p.getDataFolder(), "data.yml");
    136.  
    137. if (!dfile.exists()) {
    138. try {
    139. dfile.createNewFile();
    140. }
    141. catch (IOException e) {
    142. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create data.yml!");
    143. }
    144. }
    145. data = YamlConfiguration.loadConfiguration(dfile);
    146. }
    147.  
    148. public FileConfiguration getData() {
    149. return data;
    150. }
    151.  
    152. public void saveData() {
    153. try {
    154. data.save(dfile);
    155. }
    156. catch (IOException e) {
    157. Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save data.yml!");
    158. e.printStackTrace();
    159. }
    160. }
    161.  
    162. public void reloadData() {
    163. data = YamlConfiguration.loadConfiguration(dfile);
    164. }
    165. }


    Arena.yml
    Code:java
    1. Test:
    2. Max-Players: 10
    3. Auto-Start: 1
    4. Arenas:
    5. - Test
    6.  


    Spawn.yml
    Code:java
    1. Spawns:
    2. Test:
    3. Lobby:
    4. World: world
    5. X: 0
    6. Y: 65
    7. Z: 0
    8. Pitch: 8.999989
    9. Yaw: -179.09966
    10. GameSpawn:
    11. World: world
    12. X: 0
    13. Y: 65
    14. Z: 0
    15. Pitch: 8.999989
    16. Yaw: -179.09966
    17. SpectatorSpawn:
    18. World: world
    19. X: 56
    20. Y: 70
    21. Z: -3
    22. Pitch: -0.90012527
    23. Yaw: -89.54999
     
  2. Offline

    Awesomeman2

    HelGod Whats the error?

    Tag me if you need me!
     
  3. Offline

    HelGod

    There is no error at all it just doesn't delete those. Awesomeman2
     
  4. Offline

    Awesomeman2

    HelGod Whats it supposed to do?

    Tag me if you need me.
     
Thread Status:
Not open for further replies.

Share This Page