mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-12-05 19:01:04 +00:00
Remove EverythingRS API integration and related dependencies
This commit is contained in:
1 parent
e1efbb0fdf
commit
0790eaf4a3
6 files changed
-77
No files matched your search
Binary file not shown.
@@ -123,13 +123,6 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.everythingrs</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>3.0.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/everythingrs-api.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
||||
@@ -90,30 +90,4 @@ public class ConfigLoader {
|
||||
bindBoolean(core, "cycle_logging", val -> Constants.CYCLE_LOGGING = val);
|
||||
bindInt(core, "cycle_logging_tick", val -> Constants.CYCLE_LOGGING_TICK = val);
|
||||
}
|
||||
|
||||
private static void initialize() {
|
||||
JSONObject main = new JSONObject();
|
||||
main.put("erssecret", "");
|
||||
try (BufferedWriter br = new BufferedWriter(new FileWriter("data/secrets.json"))) {
|
||||
br.write(main.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadSecrets() throws IOException {
|
||||
if (!new File("data/secrets.json").exists()) {
|
||||
initialize();
|
||||
} else {
|
||||
String out = new String(Files.readAllBytes(Paths.get("data/secrets.json")), StandardCharsets.UTF_8);
|
||||
JSONObject obj = new JSONObject(out);
|
||||
|
||||
/*
|
||||
* Sets External Services Vars
|
||||
*/
|
||||
if (obj.has("erssecret"))
|
||||
GameEngine.ersSecret = obj.getString("erssecret");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,6 @@ public class GameEngine {
|
||||
return d;
|
||||
}
|
||||
|
||||
public static String ersSecret;
|
||||
public static int[] cannonsX = new int[50];
|
||||
public static int[] cannonsY = new int[50];
|
||||
public static String[] cannonsO = new String[50];
|
||||
@@ -180,11 +179,6 @@ public class GameEngine {
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> Player.postGlobal(new ServerShutdownEvent())));
|
||||
|
||||
/**
|
||||
* Start Integration Services
|
||||
**/
|
||||
ConfigLoader.loadSecrets();
|
||||
|
||||
/**
|
||||
* Accepting Connections
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.rs2.game.players;
|
||||
|
||||
import com.everythingrs.hiscores.Hiscores;
|
||||
import com.rs2.Constants;
|
||||
import com.rs2.GameEngine;
|
||||
import com.rs2.event.*;
|
||||
@@ -625,14 +624,6 @@ public abstract class Player {
|
||||
getSummon().pickUpPet(this, summonId);
|
||||
}
|
||||
|
||||
if(GameEngine.ersSecret != null && !GameEngine.ersSecret.equals("") && this.playerRights < 2) {
|
||||
boolean debugMessage = false;
|
||||
System.out.println("Updating highscores for " + this.playerName + "!");
|
||||
Hiscores.update(GameEngine.ersSecret, "Normal Mode", this.playerName, this.playerRights, this.playerXP, debugMessage);
|
||||
} else {
|
||||
System.out.println("EverythingRS API Disabled, highscores not saved!");
|
||||
}
|
||||
|
||||
System.out.println("[DEREGISTERED]: " + playerName + "");
|
||||
// HostList.getHostList().remove(session);
|
||||
CycleEventHandler.getSingleton().stopEvents(this);
|
||||
|
||||
@@ -145,35 +145,6 @@ public class Commands implements PacketType {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "claimvote":
|
||||
if (!GameEngine.ersSecret.equals("")) {
|
||||
final String playerName = player.playerName;
|
||||
|
||||
com.everythingrs.vote.Vote.service.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
int currentPoints = player.votePoints;
|
||||
com.everythingrs.vote.Vote[] reward = com.everythingrs.vote.Vote.reward(GameEngine.ersSecret, playerName, "1", "all");
|
||||
if (reward[0].message != null) {
|
||||
player.getPacketSender().sendMessage(reward[0].message);
|
||||
return;
|
||||
}
|
||||
player.votePoints = (currentPoints + reward[0].give_amount);
|
||||
//player.getActionSender().sendMessage("Thank you for voting! You now have " + reward[0].vote_points + " vote points.");
|
||||
player.getPacketSender().sendMessage(
|
||||
"Thank you for voting! You now have " + player.votePoints + " vote points.");
|
||||
} catch (Exception e) {
|
||||
player.getPacketSender().sendMessage("Api Services are currently offline. Please check back shortly");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
player.getPacketSender().sendMessage("Voting Is Not Enabled");
|
||||
}
|
||||
break;
|
||||
case "coords":
|
||||
case "coord":
|
||||
case "pos":
|
||||
|
||||
Reference in new issue
Block a user