mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-01 00:10:12 +01:00
- Fixed Factions Hook trying to get a leader for WarZone, SafeZone and Wilderness - Errors no longer thrown when changing db version on mysql
This commit is contained in:
parent
964954c674
commit
0a9f994049
@ -31,18 +31,21 @@ public class FactionsHook extends Hook {
|
||||
super("com.massivecraft.factions.Factions");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
public FactionsHook() {
|
||||
super();
|
||||
plugin = null;
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return List of Faction names sorted by power
|
||||
*/
|
||||
public List<String> getTopFactions() {
|
||||
List<Faction> topFactions = new ArrayList<>();
|
||||
topFactions.addAll(FactionColl.get().getAll());
|
||||
topFactions.remove(FactionColl.get().getWarzone());
|
||||
topFactions.remove(FactionColl.get().getSafezone());
|
||||
topFactions.remove(FactionColl.get().getNone());
|
||||
Collections.sort(topFactions, new FactionComparator());
|
||||
List<String> factionNames = topFactions.stream()
|
||||
.map(faction -> faction.getName())
|
||||
@ -61,9 +64,20 @@ public class FactionsHook extends Hook {
|
||||
public HashMap<String, Serializable> getFactionInfo(String factionName) {
|
||||
HashMap<String, Serializable> info = new HashMap<>();
|
||||
Faction faction = FactionColl.get().getByName(factionName);
|
||||
info.put("LEADER", faction.getLeader().getNameAndSomething("", ""));
|
||||
info.put("POWER", faction.getPower());
|
||||
info.put("LAND", faction.getPower());
|
||||
if (faction != null) {
|
||||
MPlayer leader = faction.getLeader();
|
||||
if (leader != null) {
|
||||
info.put("LEADER", leader.getNameAndSomething("", ""));
|
||||
} else {
|
||||
info.put("LEADER", "No leader");
|
||||
}
|
||||
info.put("POWER", faction.getPower());
|
||||
info.put("LAND", faction.getPower());
|
||||
} else {
|
||||
info.put("LEADER", "Faction not found");
|
||||
info.put("POWER", "Faction not found");
|
||||
info.put("LAND", "Faction not found");
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -87,7 +101,7 @@ public class FactionsHook extends Hook {
|
||||
info.put("FACTION", "Not in faction");
|
||||
}
|
||||
} else {
|
||||
info.put("POWER",0);
|
||||
info.put("POWER", 0);
|
||||
info.put("MAXPOWER", 0);
|
||||
info.put("FACTION", "Not in faction");
|
||||
}
|
||||
|
@ -292,11 +292,13 @@ public abstract class SQLDB extends Database {
|
||||
try {
|
||||
query(query);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (usingMySQL) {
|
||||
query("ALTER TABLE " + userName + " DROP INDEX " + userColumnPlayerKills);
|
||||
try {
|
||||
if (usingMySQL) {
|
||||
query("ALTER TABLE " + userName + " DROP INDEX " + userColumnPlayerKills);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
setVersion(3);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: main.java.com.djrapitops.plan.Plan
|
||||
version: 2.6.1
|
||||
version: 2.6.2
|
||||
|
||||
softdepend:
|
||||
- OnTime
|
||||
|
Loading…
Reference in New Issue
Block a user