Skip to content

Commit

Permalink
Remove packet specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
LadyCailin committed Mar 21, 2024
1 parent 95d0f51 commit 7d52dd7
Show file tree
Hide file tree
Showing 23 changed files with 34 additions and 2,034 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import com.laytonsmith.core.apps.AppsApiUtil;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.extensions.ExtensionManager;
import com.laytonsmith.core.packetjumper.PacketJumper;
import com.laytonsmith.core.telemetry.DefaultTelemetry;
import com.laytonsmith.core.telemetry.Telemetry;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -96,7 +95,6 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.entity.minecart.CommandMinecart;

public class CommandHelperPlugin extends JavaPlugin {
Expand All @@ -111,7 +109,6 @@ public class CommandHelperPlugin extends JavaPlugin {
private boolean firstLoad = true;
private long interpreterUnlockedUntil = 0;
private Thread loadingThread;
private Thread protocolThread;

/**
* Listener for the plugin system.
Expand Down Expand Up @@ -305,17 +302,7 @@ public void run() {
};
loadingThread.start();

protocolThread = new Thread("PacketJumperLoader") {
@Override
public void run() {
try {
PacketJumper.Startup();
} catch(IOException ex) {
Logger.getLogger(CommandHelperPlugin.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
protocolThread.start();
ExtensionManager.OnLoad();

myServer = BukkitMCServer.Get();

Expand Down Expand Up @@ -347,14 +334,6 @@ public void onEnable() {
getLogger().log(Level.SEVERE, null, ex);
}
}
if(protocolThread.isAlive()) {
getLogger().log(Level.INFO, "Waiting for protocol mapping to complete...");
try {
protocolThread.join();
} catch (InterruptedException ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}

if(firstLoad) {
// Suppress warnings from the PluginClassLoader when extensions load classes from another plugin.
Expand Down Expand Up @@ -443,8 +422,6 @@ public void onDisable() {
}

ExtensionManager.Cleanup();
PacketJumper.Shutdown();

ac = null;
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/laytonsmith/core/AliasCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import com.laytonsmith.core.functions.Scheduling;
import com.laytonsmith.core.natives.interfaces.MEnumType;
import com.laytonsmith.core.natives.interfaces.Mixed;
import com.laytonsmith.core.packetjumper.PacketJumper;
import com.laytonsmith.core.profiler.ProfilePoint;
import com.laytonsmith.core.profiler.Profiler;
import com.laytonsmith.core.taskmanager.TaskManagerImpl;
Expand Down Expand Up @@ -262,8 +261,6 @@ public final void reload(MCPlayer player, String[] settings, final boolean first
}
}

PacketJumper.Shutdown();

MSLog.initialize(fileLocations.getConfigDirectory());

Profiler profiler;
Expand Down
27 changes: 1 addition & 26 deletions src/main/java/com/laytonsmith/core/Prefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public static enum PNames {
TELEMETRY_ON("telemetry-on", Preferences.Type.STRING),
TELEMETRY_PREF_DEFAULT_COLLECT("telemetry-pref-default-collect", Preferences.Type.BOOLEAN),
TELEMETRY_AUDIT("telemetry-audit", Preferences.Type.BOOLEAN),
CHECK_FOR_UPDATES("check-for-updates", Preferences.Type.BOOLEAN),
USE_PROTOCOL_LIB("use-protocol-lib", Preferences.Type.BOOLEAN),
TAKENAKA_MAPPING("takenaka-mapping", Preferences.Type.STRING);
CHECK_FOR_UPDATES("check-for-updates", Preferences.Type.BOOLEAN);
private final String name;
private final Preferences.Type type;

Expand Down Expand Up @@ -120,8 +118,6 @@ public Preferences.Type type() {
.setDescription("Help make MethodScript better! These settings control the telemetry mechanism."
+ " Your privacy is extremely important, see the telemetry.ini config file for more information.");
private static final GroupData UPDATE_GROUP = new GroupData("Update settings");
private static final GroupData PROTOCOL_LIB_GROUP = new GroupData("Protocol Lib Settings")
.setDescription("Enabling this group allows for use of the raw packet functions/events.");
/**
* Initializes the global Prefs to this file.
*
Expand Down Expand Up @@ -243,19 +239,6 @@ public static void init(final File f) throws IOException {
+ " execution context, so in all cases, you can check for updates manually with the check-update"
+ " command.",
UPDATE_GROUP));
a.add(new Preference(PNames.USE_PROTOCOL_LIB.config(), "off", PNames.USE_PROTOCOL_LIB.type(),
"If enabled, allows for use of the Packet functions and events. When enabled, has an additional"
+ " startup cost of first run, which downloads additional information needed to run. You also"
+ " need to install ProtocolLib into your server.",
PROTOCOL_LIB_GROUP));
a.add(new Preference(PNames.TAKENAKA_MAPPING.config(), "", PNames.TAKENAKA_MAPPING.type(),
"Internally, CommandHelper downloads the appropriate version of the mapping jar, if it has"
+ " been updated. You can anyways override this url here, to support newer versions without"
+ " strictly having to wait for CommandHelper to update the internal listing. If you have"
+ " a value here, it is always used, even if the mapping would otherwise be available. Should"
+ " be something like https://repo.screamingsandals.org/releases/me/kcra/takenaka/mappings/1.8.8+1.20.4/mappings-1.8.8+1.20.4.jar,"
+ " which can be found via https://repo.screamingsandals.org/#/releases/me/kcra/takenaka/mappings/",
PROTOCOL_LIB_GROUP));
prefs = new Preferences("CommandHelper", Static.getLogger(), a);
prefs.init(f);
}
Expand Down Expand Up @@ -398,12 +381,4 @@ public static Boolean TelemetryAudit() {
public static Boolean CheckForUpdates() {
return prefB(Prefs.PNames.CHECK_FOR_UPDATES);
}

public static Boolean UseProtocolLib() {
return prefB(Prefs.PNames.USE_PROTOCOL_LIB);
}

public static String TakenakaMapping() {
return prefS(Prefs.PNames.TAKENAKA_MAPPING);
}
}
188 changes: 0 additions & 188 deletions src/main/java/com/laytonsmith/core/constructs/CPacket.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum ConstructType {
TOKEN, COMMAND, FUNCTION, VARIABLE, LITERAL, ARRAY, MAP, ENTRY, INT,
DOUBLE, BOOLEAN, NULL, STRING, VOID, IVARIABLE, CLOSURE, LABEL, SLICE,
SYMBOL, IDENTIFIER, BRACE, BRACKET, BYTE_ARRAY, RESOURCE, LOCK, MUTABLE_PRIMITIVE,
CLASS_TYPE, FULLY_QUALIFIED_CLASS_NAME, PACKET;
CLASS_TYPE, FULLY_QUALIFIED_CLASS_NAME;
}

private final ConstructType ctype;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/laytonsmith/core/events/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ public enum Driver {
*/
CMDLINE_PROMPT_INPUT,
SHUTDOWN,
/**
* Packet events
*/
PACKET_RECEIVED,
PACKET_SENT,
/**
* Extension events, used by events fired from the extension system.
*/
Expand Down
Loading

0 comments on commit 7d52dd7

Please sign in to comment.