Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Hall of Fame, added Delete Wall command #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions src/main/java/org/mcsg/survivalgames/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,7 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.mcsg.survivalgames.MessageManager.PrefixType;
import org.mcsg.survivalgames.commands.AddWall;
import org.mcsg.survivalgames.commands.CreateArena;
import org.mcsg.survivalgames.commands.DelArena;
import org.mcsg.survivalgames.commands.Disable;
import org.mcsg.survivalgames.commands.Enable;
import org.mcsg.survivalgames.commands.Flag;
import org.mcsg.survivalgames.commands.ForceStart;
import org.mcsg.survivalgames.commands.Join;
import org.mcsg.survivalgames.commands.Leave;
import org.mcsg.survivalgames.commands.LeaveQueue;
import org.mcsg.survivalgames.commands.ListArenas;
import org.mcsg.survivalgames.commands.ListPlayers;
import org.mcsg.survivalgames.commands.ResetSpawns;
import org.mcsg.survivalgames.commands.SetLobbySpawn;
import org.mcsg.survivalgames.commands.SetLobbyWall;
import org.mcsg.survivalgames.commands.SetSpawn;
import org.mcsg.survivalgames.commands.Spectate;
import org.mcsg.survivalgames.commands.SubCommand;
import org.mcsg.survivalgames.commands.Teleport;
import org.mcsg.survivalgames.commands.Vote;
import org.mcsg.survivalgames.commands.*;



Expand Down Expand Up @@ -69,6 +50,13 @@ private void loadCommands() {
commands.put("leavequeue", new LeaveQueue());
commands.put("list", new ListPlayers());
commands.put("tp", new Teleport());
commands.put("delwall", new DelWall());
if(SurvivalGames.dbcon2){
commands.put("addsign", new AddSign());
commands.put("addhead", new AddHead());
commands.put("delsign", new DelSign());
commands.put("delhead", new DelHead());
}

// commands.put("sponsor", new Sponsor());
}
Expand All @@ -94,6 +82,15 @@ private void loadHelpInfo() {
helpinfo.put("lq", 1);
helpinfo.put("leavequeue", 1);
helpinfo.put("list", 1);
helpinfo.put("tp", 2);
helpinfo.put("delwall", 3);
if(SurvivalGames.dbcon2){
helpinfo.put("addsign", 3);
helpinfo.put("addhead", 3);
helpinfo.put("delsign", 3);
helpinfo.put("delhead", 3);
}

//helpinfo.put("sponsor", 1);
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/mcsg/survivalgames/LobbyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public void loadSign(int a) {
try{
SurvivalGames.debug("sg-system.lobby.signs." + a + ".world");
World w = Bukkit.getWorld(s.getString("sg-system.lobby.signs." + a + ".world"));
if(!s.getBoolean("sg-system.lobby.signs." + a+ ".enabled", true)){
return;
}
int x1 = s.getInt("sg-system.lobby.signs." + a + ".x1");
int y1 = s.getInt("sg-system.lobby.signs." + a + ".y1");
int z1 = s.getInt("sg-system.lobby.signs." + a + ".z1");
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/org/mcsg/survivalgames/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand Down Expand Up @@ -369,4 +370,29 @@ public void loadFile(String file){
}

}

public boolean modifyList(String type, Location loc, int pos) {
FileConfiguration cfg = SettingsManager.getInstance().getSystemConfig();
List<String> objs = cfg.getStringList(type);
String conStr = loc.getWorld().getName() + ";" + loc.getX() + ";" + loc.getY() + ";" + loc.getZ();
for (String str : objs) {
if (str.startsWith(conStr)) {
if (pos == 0) {
objs.remove(str);
cfg.set(type, objs);
getInstance().saveConfig();
return true;
} else {
return false;
}
}
}
if (pos == 0) {
return false;
}
objs.add(conStr + ";" + pos);
cfg.set(type, objs);
getInstance().saveConfig();
return true;
}
}
Loading