-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify Ketting.java for more clarity, add BukkitAdapter, moved some f…
…unctions to SharedConstants, add NOOP versions for some adapters
- Loading branch information
Showing
10 changed files
with
190 additions
and
15 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/java/org/kettingpowered/ketting/adapter/BukkitAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.kettingpowered.ketting.adapter; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.kettingpowered.ketting.types.Plugin; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
public interface BukkitAdapter extends SharedConstants { | ||
|
||
@Nullable Plugin getPlugin(String name); | ||
@Nullable List<Plugin> getPlugins(); | ||
@Nullable String getPluginName(String name); | ||
@Nullable String getPluginName(@NotNull Plugin plugin); | ||
|
||
void loadPlugin(@NotNull File pluginFile) throws Exception; | ||
void loadPlugins(@NotNull File pluginDirectory) throws Exception; | ||
|
||
void enablePlugin(@NotNull Plugin plugin); | ||
void disablePlugin(@NotNull Plugin plugin); | ||
void disablePlugins(); | ||
} |
3 changes: 1 addition & 2 deletions
3
src/main/java/org/kettingpowered/ketting/adapter/DimensionRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/org/kettingpowered/ketting/adapter/SharedConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.kettingpowered.ketting.adapter; | ||
|
||
interface SharedConstants { | ||
|
||
String getMcVersion(); | ||
|
||
default boolean isValidAdapter() { | ||
return getMcVersion() != null; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/org/kettingpowered/ketting/adapter/noop/NOOPBukkitAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.kettingpowered.ketting.adapter.noop; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.kettingpowered.ketting.adapter.BukkitAdapter; | ||
import org.kettingpowered.ketting.types.Plugin; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
public class NOOPBukkitAdapter implements BukkitAdapter { | ||
|
||
public static final NOOPBukkitAdapter INSTANCE = new NOOPBukkitAdapter(); | ||
|
||
public String getMcVersion() { | ||
return null; | ||
} | ||
|
||
public @Nullable Plugin getPlugin(String name) { | ||
return null; | ||
} | ||
|
||
public @Nullable List<Plugin> getPlugins() { | ||
return null; | ||
} | ||
|
||
public @Nullable String getPluginName(String name) { | ||
return null; | ||
} | ||
|
||
public @Nullable String getPluginName(@NotNull Plugin plugin) { | ||
return null; | ||
} | ||
|
||
public void loadPlugin(@NotNull File pluginFile) throws Exception {} | ||
|
||
public void loadPlugins(@NotNull File pluginDirectory) throws Exception {} | ||
|
||
public void enablePlugin(@NotNull Plugin plugin) {} | ||
|
||
public void disablePlugin(@NotNull Plugin plugin) {} | ||
|
||
public void disablePlugins() {} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/kettingpowered/ketting/adapter/noop/NOOPForgeAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.kettingpowered.ketting.adapter.noop; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.kettingpowered.ketting.adapter.ForgeAdapter; | ||
import org.kettingpowered.ketting.types.Mod; | ||
|
||
import java.util.List; | ||
|
||
public class NOOPForgeAdapter implements ForgeAdapter { | ||
|
||
public static final NOOPForgeAdapter INSTANCE = new NOOPForgeAdapter(); | ||
|
||
public String getMcVersion() { | ||
return null; | ||
} | ||
|
||
public @Nullable Mod getMod(String modID) { | ||
return null; | ||
} | ||
|
||
public @Nullable List<Mod> getMods() { | ||
return null; | ||
} | ||
|
||
public @Nullable String getModName(String modID) { | ||
return null; | ||
} | ||
|
||
public @Nullable String getModName(@NotNull Mod mod) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/org/kettingpowered/ketting/types/Plugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.kettingpowered.ketting.types; | ||
|
||
import java.io.File; | ||
import java.util.logging.Logger; | ||
|
||
public record Plugin( | ||
PluginInfo info, | ||
boolean enabled, | ||
File dataFolder, | ||
Logger logger | ||
) {} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/kettingpowered/ketting/types/PluginInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.kettingpowered.ketting.types; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public record PluginInfo( | ||
String name, | ||
List<String> provides, | ||
String main, | ||
String classLoaderOf, | ||
List<String> depends, | ||
List<String> softDepends, | ||
List<String> loadBefore, | ||
String version, | ||
Map<String, Map<String, Object>> commands, | ||
String description, | ||
List<String> authors, | ||
List<String> contributors, | ||
String website, | ||
String prefix, | ||
PluginLoadOrder order, | ||
String apiVersion, | ||
List<String> libraries | ||
) { | ||
public enum PluginLoadOrder { | ||
STARTUP, | ||
POSTWORLD | ||
} | ||
} |