mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-03 01:10:17 +01:00
Removed Kingdoms support
I'm guessing the plugin moved to Songonda at some point and Songonda is now off Spigot, so a free version is not available to use the API from. Since I am not able to obtain a copy anymore, the bridge can not be built - I need to build it to fix a bug, so the support was removed.
This commit is contained in:
parent
9eb16e39df
commit
a3e426088d
@ -145,7 +145,7 @@
|
||||
<dependency>
|
||||
<groupId>me.konsolas</groupId>
|
||||
<artifactId>AAC</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<version>4.0.0-b1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -163,19 +163,13 @@
|
||||
<dependency>
|
||||
<groupId>com.gamingmesh</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>4.7.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kingdoms</groupId>
|
||||
<artifactId>kingdoms_demo</artifactId>
|
||||
<version>13.3.40</version>
|
||||
<version>4.13.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>litebans</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.3</version>
|
||||
<version>0.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -187,7 +181,7 @@
|
||||
<dependency>
|
||||
<groupId>com.volmit</groupId>
|
||||
<artifactId>react</artifactId>
|
||||
<version>6.573</version>
|
||||
<version>6.612</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -22,7 +22,6 @@ import com.djrapitops.pluginbridge.plan.aac.AdvancedAntiCheatHook;
|
||||
import com.djrapitops.pluginbridge.plan.buycraft.BuyCraftHook;
|
||||
import com.djrapitops.pluginbridge.plan.factions.FactionsHook;
|
||||
import com.djrapitops.pluginbridge.plan.jobs.JobsHook;
|
||||
import com.djrapitops.pluginbridge.plan.kingdoms.KingdomsHook;
|
||||
import com.djrapitops.pluginbridge.plan.litebans.LiteBansBukkitHook;
|
||||
import com.djrapitops.pluginbridge.plan.luckperms.LuckPermsHook;
|
||||
import com.djrapitops.pluginbridge.plan.protocolsupport.ProtocolSupportHook;
|
||||
@ -45,10 +44,9 @@ public class BukkitBridge extends AbstractBridge {
|
||||
private final BuyCraftHook buyCraftHook;
|
||||
private final FactionsHook factionsHook;
|
||||
private final JobsHook jobsHook;
|
||||
private final KingdomsHook kingdomsHook;
|
||||
private final LiteBansBukkitHook liteBansHook;
|
||||
private final LuckPermsHook luckPermsHook;
|
||||
private final ProtocolSupportHook protocolSupportHook;
|
||||
private final ProtocolSupportHook protocolSupportHook;
|
||||
private final SuperbVoteHook superbVoteHook;
|
||||
private final TownyHook townyHook;
|
||||
private final ViaVersionBukkitHook viaVersionHook;
|
||||
@ -62,7 +60,6 @@ private final ProtocolSupportHook protocolSupportHook;
|
||||
BuyCraftHook buyCraftHook,
|
||||
FactionsHook factionsHook,
|
||||
JobsHook jobsHook,
|
||||
KingdomsHook kingdomsHook,
|
||||
LiteBansBukkitHook liteBansHook,
|
||||
LuckPermsHook luckPermsHook,
|
||||
ProtocolSupportHook protocolSupportHook,
|
||||
@ -75,7 +72,6 @@ private final ProtocolSupportHook protocolSupportHook;
|
||||
this.buyCraftHook = buyCraftHook;
|
||||
this.factionsHook = factionsHook;
|
||||
this.jobsHook = jobsHook;
|
||||
this.kingdomsHook = kingdomsHook;
|
||||
this.liteBansHook = liteBansHook;
|
||||
this.luckPermsHook = luckPermsHook;
|
||||
this.protocolSupportHook = protocolSupportHook;
|
||||
@ -91,7 +87,6 @@ private final ProtocolSupportHook protocolSupportHook;
|
||||
buyCraftHook,
|
||||
factionsHook,
|
||||
jobsHook,
|
||||
kingdomsHook,
|
||||
liteBansHook,
|
||||
luckPermsHook,
|
||||
protocolSupportHook,
|
||||
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.pluginbridge.plan.kingdoms;
|
||||
|
||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
||||
import com.djrapitops.plan.data.store.mutators.SessionsMutator;
|
||||
import com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icons;
|
||||
import com.djrapitops.plan.utilities.html.structure.Accordion;
|
||||
import com.djrapitops.plan.utilities.html.structure.AccordionElement;
|
||||
import com.djrapitops.plan.utilities.html.structure.AccordionElementContentBuilder;
|
||||
import org.kingdoms.constants.kingdom.OfflineKingdom;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Utility for creating Kingdoms Accordion Html.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
class KingdomsAccordion extends Accordion {
|
||||
|
||||
private final Map<String, OfflineKingdom> kingdoms;
|
||||
private final PlayersMutator playersMutator;
|
||||
|
||||
KingdomsAccordion(Map<String, OfflineKingdom> kingdoms, PlayersMutator playersMutator) {
|
||||
super("kingdoms_accordion");
|
||||
this.kingdoms = kingdoms;
|
||||
this.playersMutator = playersMutator;
|
||||
|
||||
addElements();
|
||||
}
|
||||
|
||||
private void addElements() {
|
||||
for (Map.Entry<String, OfflineKingdom> entry : kingdoms.entrySet()) {
|
||||
String kingdomName = entry.getKey();
|
||||
|
||||
OfflineKingdom kingdom = entry.getValue();
|
||||
String kingName = kingdom.getKingName();
|
||||
String kingdomLore = kingdom.getKingdomLore();
|
||||
|
||||
int might = kingdom.getMight();
|
||||
int resourcePoints = kingdom.getResourcepoints();
|
||||
|
||||
List<UUID> members = kingdom.getMembersList();
|
||||
int memberCount = members.size();
|
||||
|
||||
PlayersMutator memberMutator = this.playersMutator.filterBy(
|
||||
player -> player.getValue(PlayerKeys.UUID)
|
||||
.map(members::contains).orElse(false)
|
||||
);
|
||||
|
||||
SessionsMutator memberSessionsMutator = new SessionsMutator(memberMutator.getSessions());
|
||||
|
||||
long playerKills = memberSessionsMutator.toPlayerKillCount();
|
||||
long mobKills = memberSessionsMutator.toMobKillCount();
|
||||
long deaths = memberSessionsMutator.toDeathCount();
|
||||
|
||||
String separated = HtmlStructure.separateWithDots(("Members: " + memberCount), kingName);
|
||||
|
||||
String htmlID = "kingdom_" + kingdomName.replace(" ", "-");
|
||||
|
||||
String leftSide = new AccordionElementContentBuilder()
|
||||
.addHtml(kingdomLore != null ? "<p>" + kingdomLore + "</p>" : "")
|
||||
.addRowBold(Icon.called("chess-king").of(Color.AMBER), "King", kingName)
|
||||
.addRowBold(Icon.called("users").of(Color.AMBER), "Members", memberCount)
|
||||
.addRowBold(Icon.called("bolt").of(Color.AMBER), "Might", might)
|
||||
.addRowBold(Icon.called("cubes").of(Color.AMBER), "Resources", resourcePoints)
|
||||
.toHtml();
|
||||
|
||||
String rightSide = new AccordionElementContentBuilder()
|
||||
.addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKills)
|
||||
.addRowBold(Icons.MOB_KILLS, "Mob Kills", mobKills)
|
||||
.addRowBold(Icons.DEATHS, "Deaths", deaths)
|
||||
.toHtml();
|
||||
|
||||
addElement(new AccordionElement(htmlID, kingdomName + "<span class=\"pull-right\">" + separated + "</span>")
|
||||
.setColor("amber")
|
||||
.setLeftSide(leftSide)
|
||||
.setRightSide(rightSide));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.pluginbridge.plan.kingdoms;
|
||||
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.data.element.AnalysisContainer;
|
||||
import com.djrapitops.plan.data.element.InspectContainer;
|
||||
import com.djrapitops.plan.data.plugin.ContainerSize;
|
||||
import com.djrapitops.plan.data.plugin.PluginData;
|
||||
import com.djrapitops.plan.data.store.keys.AnalysisKeys;
|
||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Family;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import org.kingdoms.constants.kingdom.OfflineKingdom;
|
||||
import org.kingdoms.constants.player.OfflineKingdomPlayer;
|
||||
import org.kingdoms.manager.game.GameManagement;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* PluginData for Kingdoms and Kingdoms+ plugins.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
class KingdomsData extends PluginData {
|
||||
|
||||
KingdomsData() {
|
||||
super(ContainerSize.TAB, "Kingdoms");
|
||||
setPluginIcon(Icon.called("crown").of(Color.AMBER).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
|
||||
OfflineKingdomPlayer kingdomPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(uuid);
|
||||
String kingdomName = kingdomPlayer.getKingdomName();
|
||||
|
||||
if (kingdomName == null) {
|
||||
inspectContainer.addValue(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), "No Kingdom");
|
||||
} else {
|
||||
OfflineKingdom kingdom = GameManagement.getKingdomManager().getOfflineKingdom(kingdomName);
|
||||
if (kingdom != null) {
|
||||
String king = kingdom.getKingName();
|
||||
String link = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(king), king);
|
||||
inspectContainer.addValue(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), kingdomName);
|
||||
inspectContainer.addValue(getWithIcon("King", Icon.called("chess-king").of(Color.AMBER)), link);
|
||||
}
|
||||
}
|
||||
|
||||
return inspectContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnalysisContainer getServerData(Collection<UUID> collection, AnalysisContainer analysisContainer) {
|
||||
Map<String, OfflineKingdom> kingdoms = GameManagement.getKingdomManager().getKingdomList();
|
||||
|
||||
analysisContainer.addValue(getWithIcon("Number of Kingdoms", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), kingdoms.size());
|
||||
|
||||
if (!kingdoms.isEmpty()) {
|
||||
KingdomsAccordion kingdomsAccordion = new KingdomsAccordion(
|
||||
kingdoms,
|
||||
Optional.ofNullable(analysisData).flatMap(c -> c.getValue(AnalysisKeys.PLAYERS_MUTATOR))
|
||||
.orElse(new PlayersMutator(new ArrayList<>()))
|
||||
);
|
||||
|
||||
analysisContainer.addHtml("kingdomsAccordion", kingdomsAccordion.toHtml());
|
||||
|
||||
Map<UUID, String> userKingDoms = new HashMap<>();
|
||||
for (Map.Entry<String, OfflineKingdom> entry : kingdoms.entrySet()) {
|
||||
String kingdomName = entry.getKey();
|
||||
OfflineKingdom kingdom = entry.getValue();
|
||||
UUID king = kingdom.getKing();
|
||||
for (UUID member : kingdom.getMembersList()) {
|
||||
if (member.equals(king)) {
|
||||
userKingDoms.put(member, "<b>" + kingdomName + "</b>");
|
||||
|
||||
} else {
|
||||
userKingDoms.put(member, kingdomName);
|
||||
}
|
||||
}
|
||||
}
|
||||
analysisContainer.addPlayerTableValues(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND)), userKingDoms);
|
||||
}
|
||||
|
||||
return analysisContainer;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.pluginbridge.plan.kingdoms;
|
||||
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.pluginbridge.plan.Hook;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Hook for Kingdoms and Kingdoms+ plugins.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
public class KingdomsHook extends Hook {
|
||||
|
||||
@Inject
|
||||
public KingdomsHook() {
|
||||
super("org.kingdoms.main.Kingdoms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hook(HookHandler handler) throws NoClassDefFoundError {
|
||||
if (enabled) {
|
||||
handler.addPluginDataSource(new KingdomsData());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user