Fix whitespace [skip actions]

This commit is contained in:
github-actions
2022-07-21 07:21:22 +00:00
committed by Melledy
parent 510d564bcb
commit ae2d1fe438
166 changed files with 12928 additions and 12928 deletions

View File

@@ -17,7 +17,7 @@ import java.net.URLClassLoader;
*/
public abstract class Plugin {
private final ServerHook server = ServerHook.getInstance();
private PluginIdentifier identifier;
private URLClassLoader classLoader;
private File dataFolder;
@@ -25,22 +25,22 @@ public abstract class Plugin {
/**
* This method is reflected into.
*
*
* Set plugin variables.
* @param identifier The plugin's identifier.
*/
private void initializePlugin(PluginIdentifier identifier, URLClassLoader classLoader) {
if(this.identifier != null) {
if (this.identifier != null) {
Grasscutter.getLogger().warn(this.identifier.name + " had a reinitialization attempt.");
return;
}
this.identifier = identifier;
this.classLoader = classLoader;
this.dataFolder = new File(PLUGIN(), identifier.name);
this.logger = LoggerFactory.getLogger(identifier.name);
if(!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {
if (!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {
Grasscutter.getLogger().warn("Failed to create plugin data folder for " + this.identifier.name);
return;
}
@@ -50,7 +50,7 @@ public abstract class Plugin {
* The plugin's identifier instance.
* @return An instance of {@link PluginIdentifier}.
*/
public final PluginIdentifier getIdentifier(){
public final PluginIdentifier getIdentifier() {
return this.identifier;
}
@@ -115,7 +115,7 @@ public abstract class Plugin {
public final Logger getLogger() {
return this.logger;
}
/* Called when the plugin is first loaded. */
public void onLoad() { }
/* Called after (most of) the server enables. */

View File

@@ -72,7 +72,7 @@ public final class PluginManager {
List<PluginData> dependencies = new ArrayList<>();
// Initialize all plugins.
for(var plugin : plugins) {
for (var plugin : plugins) {
try {
URL url = plugin.toURI().toURL();
try (URLClassLoader loader = new URLClassLoader(new URL[]{url})) {
@@ -109,7 +109,7 @@ public final class PluginManager {
fileReader.close();
// Check if the plugin has alternate dependencies.
if(pluginConfig.loadAfter != null && pluginConfig.loadAfter.length > 0) {
if (pluginConfig.loadAfter != null && pluginConfig.loadAfter.length > 0) {
// Add the plugin to a "load later" list.
dependencies.add(new PluginData(
pluginInstance, PluginIdentifier.fromPluginConfig(pluginConfig),
@@ -131,9 +131,9 @@ public final class PluginManager {
// Load plugins with dependencies.
int depth = 0; final int maxDepth = 30;
while(!dependencies.isEmpty()) {
while (!dependencies.isEmpty()) {
// Check if the depth is too high.
if(depth >= maxDepth) {
if (depth >= maxDepth) {
Grasscutter.getLogger().error("Failed to load plugins with dependencies.");
break;
}
@@ -143,7 +143,7 @@ public final class PluginManager {
var pluginData = dependencies.get(0);
// Check if the plugin's dependencies are loaded.
if(!this.plugins.keySet().containsAll(List.of(pluginData.getDependencies()))) {
if (!this.plugins.keySet().containsAll(List.of(pluginData.getDependencies()))) {
depth++; // Increase depth counter.
continue; // Continue to next plugin.
}

View File

@@ -19,13 +19,13 @@ public final class PlayerHook {
private final Player player;
/**
* Hooks into the player.
* Hooks into the player.
* @param player The player to hook into.
*/
public PlayerHook(Player player) {
this.player = player;
}
/**
* Kicks a player from the server.
* TODO: Refactor to kick using a packet.
@@ -82,7 +82,7 @@ public final class PlayerHook {
*/
public void teleport(Position position) {
this.player.getPosition().set(position);
this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player,
this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player,
EnterType.ENTER_TYPE_JUMP, EnterReason.TransPoint,
this.player.getSceneId(), position
));
@@ -111,4 +111,4 @@ public final class PlayerHook {
public Avatar getCurrentAvatar() {
return this.getCurrentAvatarEntity().getAvatar();
}
}
}