Skip to content

Commit

Permalink
Start work on modularizing project
Browse files Browse the repository at this point in the history
  • Loading branch information
virustotalop committed Jan 26, 2022
1 parent 4ad22f2 commit 3797e0a
Show file tree
Hide file tree
Showing 211 changed files with 166 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
hs_err_pid*

.gradle
/build/
build/

# Ignore Gradle GUI config
gradle-app.setting
Expand Down
92 changes: 16 additions & 76 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,86 +1,26 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.1.1'
id 'eclipse'
id 'idea'
}

version = '4.1.0'
subprojects {
apply plugin: 'java-library'
apply plugin: 'com.github.johnrengelman.shadow'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
group 'com.clubobsidian'
version '4.1.0'

def buildNumber = System.getenv("BUILD_NUMBER")

if(buildNumber != null) {
version += "-b" + buildNumber
}

repositories {
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"}
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url 'https://jitpack.io' }
}

processResources {
from(sourceSets.main.resources) {
include 'plugin.yml'
expand 'pluginVersion': project.version
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

shadowJar {
minimize()
relocate 'org.spongepowered.configurate', 'com.clubobsidian.dynamicgui.shaded.configurate'
relocate 'com.google.common', 'com.clubobsidian.dynamicgui.shaded.guava'
relocate 'com.google.gson', 'com.clubobsidian.dynamicgui.shaded.gson'
relocate 'org.yaml.snakeyaml', 'com.clubobsidian.dynamicgui.shaded.snakeyaml'
relocate 'com.clubobsidian.trident', 'com.clubobsidian.dynamicgui.shaded.trident'
relocate 'com.clubobsidian.wrappy', 'com.clubobsidian.dynamicgui.shaded.wrappy'
relocate 'net.kyori', 'com.clubobsidian.dynamicgui.shaded.kyori'
relocate 'com.clubobsidian.fuzzutil', 'com.clubobsidian.dynamicgui.shaded.fuzzutil'
relocate 'io.leangen', 'com.clubobsidian.dynamicgui.shaded.leangen'
relocate 'org.codehaus.mojo', 'com.clubobsidian.dynamicgui.shaded.mojo'
relocate 'org.checkerframework.framework', 'com.clubobsidian.dynamicgui.shaded.checkerframework.framework'
relocate 'org.checkerframework.common', 'com.clubobsidian.dynamicgui.shaded.checkerframework.common'
relocate 'org.checkerframework.checker', 'com.clubobsidian.dynamicgui.shaded.checkerframework.checker'
relocate 'org.apache.commons', 'com.clubobsidian.dynamicgui.shaded.apachecommons'
relocate 'org.aopalliance.intercept', 'com.clubobsidian.dynamicgui.shaded.aopalliance.intercept'
relocate 'org.aopalliance.aop', 'com.clubobsidian.dynamicgui.shaded.aopalliance.aop'
relocate 'javax.inject', 'com.clubobsidian.dynamicgui.shaded.javax.inject'
relocate 'com.udojava.evalex', 'com.clubobsidian.dynamicgui.shaded.evalex'
relocate 'com.typesafe.config', 'com.clubobsidian.dynamicgui.shaded.typesafeconfig'
relocate 'com.google.j2objc', 'com.clubobsidian.dynamicgui.shaded.j2objc'
relocate 'com.google.inject', 'com.clubobsidian.dynamicgui.shaded.guice'
relocate 'javax.annotation', 'com.clubobsidian.dynamicgui.shaded.javaxannotation'
relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone'
relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson'

archiveBaseName.set('DynamicGui')
archiveClassifier.set('')
}

dependencies {
testImplementation 'junit:junit:4.13.2'

//Server implementations

compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.8-SNAPSHOT'

//Plugins
compileOnly 'com.github.clubobsidian:foundry:2.0.1'

//Dependencies
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.github.clubobsidian:wrappy:2.3.2'
implementation 'com.github.clubobsidian:trident:3.0.0'
implementation 'com.github.clubobsidian:dynamicguiparser:2.12.0'
implementation 'com.udojava:EvalEx:2.1'
implementation 'com.github.ClubObsidian:FuzzUtil:1.1.0'
implementation 'com.google.inject:guice:5.0.1'
implementation 'net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT'
implementation 'net.kyori:adventure-text-serializer-gson:4.9.3'
repositories {
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"}
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
47 changes: 47 additions & 0 deletions bukkit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'java-library'
}

processResources {
filesMatching('plugin.yml') {
expand 'pluginVersion': project.version
}
}

shadowJar {
minimize()
relocate 'org.spongepowered.configurate', 'com.clubobsidian.dynamicgui.shaded.configurate'
relocate 'com.google.common', 'com.clubobsidian.dynamicgui.shaded.guava'
relocate 'com.google.gson', 'com.clubobsidian.dynamicgui.shaded.gson'
relocate 'org.yaml.snakeyaml', 'com.clubobsidian.dynamicgui.shaded.snakeyaml'
relocate 'com.clubobsidian.trident', 'com.clubobsidian.dynamicgui.shaded.trident'
relocate 'com.clubobsidian.wrappy', 'com.clubobsidian.dynamicgui.shaded.wrappy'
relocate 'net.kyori', 'com.clubobsidian.dynamicgui.shaded.kyori'
relocate 'com.clubobsidian.fuzzutil', 'com.clubobsidian.dynamicgui.shaded.fuzzutil'
relocate 'io.leangen', 'com.clubobsidian.dynamicgui.shaded.leangen'
relocate 'org.codehaus.mojo', 'com.clubobsidian.dynamicgui.shaded.mojo'
relocate 'org.checkerframework.framework', 'com.clubobsidian.dynamicgui.shaded.checkerframework.framework'
relocate 'org.checkerframework.common', 'com.clubobsidian.dynamicgui.shaded.checkerframework.common'
relocate 'org.checkerframework.checker', 'com.clubobsidian.dynamicgui.shaded.checkerframework.checker'
relocate 'org.apache.commons', 'com.clubobsidian.dynamicgui.shaded.apachecommons'
relocate 'org.aopalliance.intercept', 'com.clubobsidian.dynamicgui.shaded.aopalliance.intercept'
relocate 'org.aopalliance.aop', 'com.clubobsidian.dynamicgui.shaded.aopalliance.aop'
relocate 'javax.inject', 'com.clubobsidian.dynamicgui.shaded.javax.inject'
relocate 'com.udojava.evalex', 'com.clubobsidian.dynamicgui.shaded.evalex'
relocate 'com.typesafe.config', 'com.clubobsidian.dynamicgui.shaded.typesafeconfig'
relocate 'com.google.j2objc', 'com.clubobsidian.dynamicgui.shaded.j2objc'
relocate 'com.google.inject', 'com.clubobsidian.dynamicgui.shaded.guice'
relocate 'javax.annotation', 'com.clubobsidian.dynamicgui.shaded.javaxannotation'
relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone'
relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson'

archiveBaseName.set('DynamicGui')
archiveClassifier.set('')
}

dependencies {
implementation project(path: ':core')
compileOnly 'com.github.clubobsidian:foundry:2.0.1'
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.8-SNAPSHOT'
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class CustomCommandExecutor implements CommandExecutor {
private final String gui;

public CustomCommandExecutor(String gui) {

this.gui = gui;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper;
import com.clubobsidian.dynamicgui.manager.world.LocationManager;
import com.clubobsidian.dynamicgui.world.LocationWrapper;
import com.clubobsidian.dynamicgui.event.player.Action;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand All @@ -30,7 +31,7 @@ public class PlayerInteractListener implements Listener {
@EventHandler
public void interact(final PlayerInteractEvent e) {
if(e.getClickedBlock() != null) {
com.clubobsidian.dynamicgui.event.player.Action action = com.clubobsidian.dynamicgui.event.player.Action.valueOf(e.getAction().toString());
Action action = Action.valueOf(e.getAction().toString());
PlayerWrapper<?> playerWrapper = new BukkitPlayerWrapper<Player>(e.getPlayer());
LocationWrapper<?> locationWrapper = LocationManager.get().toLocationWrapper(e.getClickedBlock().getLocation());
com.clubobsidian.dynamicgui.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.clubobsidian.dynamicgui.manager;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.clubobsidian.dynamicgui;
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
import com.clubobsidian.dynamicgui.permission.bukkit.FoundryPermission;
import com.clubobsidian.dynamicgui.permission.bukkit.VaultPermission;
import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin;
import com.clubobsidian.dynamicgui.registry.model.plugin.ItemsAdderModelProvider;
import com.clubobsidian.dynamicgui.registry.model.plugin.OraxenModelProvider;
import com.clubobsidian.dynamicgui.registry.model.bukkit.ItemsAdderModelProvider;
import com.clubobsidian.dynamicgui.registry.model.bukkit.OraxenModelProvider;
import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry;
import com.clubobsidian.dynamicgui.registry.npc.citizens.CitizensRegistry;
import com.clubobsidian.dynamicgui.registry.replacer.impl.PlaceholderApiReplacerRegistry;
import com.clubobsidian.dynamicgui.registry.npc.bukkit.CitizensRegistry;
import com.clubobsidian.dynamicgui.registry.replacer.bukkit.PlaceholderApiReplacerRegistry;
import com.clubobsidian.dynamicgui.server.bukkit.FakeBukkitServer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.clubobsidian.dynamicgui.registry.model.plugin;
package com.clubobsidian.dynamicgui.registry.model.bukkit;

import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper;
import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.clubobsidian.dynamicgui.registry.model.plugin;
package com.clubobsidian.dynamicgui.registry.model.bukkit;

import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper;
import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.clubobsidian.dynamicgui.registry.npc.citizens;
package com.clubobsidian.dynamicgui.registry.npc.bukkit;

import com.clubobsidian.dynamicgui.entity.EntityWrapper;
import com.clubobsidian.dynamicgui.registry.npc.NPC;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.clubobsidian.dynamicgui.registry.npc.bukkit;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.clubobsidian.dynamicgui.registry;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.clubobsidian.dynamicgui.registry.replacer.impl;
package com.clubobsidian.dynamicgui.registry.replacer.bukkit;

import com.clubobsidian.dynamicgui.entity.PlayerWrapper;
import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry;
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id 'java-library'
}

dependencies {
testImplementation 'junit:junit:4.13.2'

//Dependencies
api 'org.apache.commons:commons-lang3:3.12.0'
api 'commons-io:commons-io:2.11.0'
api 'com.github.clubobsidian:wrappy:2.3.2'
api 'com.github.clubobsidian:trident:3.0.0'
api 'com.github.clubobsidian:dynamicguiparser:2.12.0'
api 'com.udojava:EvalEx:2.1'
api 'com.github.ClubObsidian:FuzzUtil:1.1.0'
api 'com.google.inject:guice:5.0.1'
api 'net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT'
api 'net.kyori:adventure-text-serializer-gson:4.9.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
import com.clubobsidian.dynamicgui.function.impl.meta.IsGuiMetadataSet;
import com.clubobsidian.dynamicgui.function.impl.meta.SetMetadataFunction;
import com.clubobsidian.dynamicgui.logger.LoggerWrapper;
import com.clubobsidian.dynamicgui.listener.EntityClickListener;
import com.clubobsidian.dynamicgui.listener.GuiListener;
import com.clubobsidian.dynamicgui.listener.InventoryCloseListener;
import com.clubobsidian.dynamicgui.listener.InventoryInteractListener;
import com.clubobsidian.dynamicgui.listener.InventoryOpenListener;
import com.clubobsidian.dynamicgui.listener.PlayerInteractListener;
import com.clubobsidian.dynamicgui.manager.dynamicgui.AnimationReplacerManager;
import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager;
import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager;
Expand All @@ -89,7 +95,6 @@
import com.clubobsidian.dynamicgui.util.ChatColor;
import com.clubobsidian.trident.EventBus;
import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus;
import com.clubobsidian.trident.eventbus.reflection.ReflectionEventBus;
import com.clubobsidian.wrappy.Configuration;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteArrayDataInput;
Expand Down Expand Up @@ -254,12 +259,12 @@ public void checkForProxy() {
}

private void registerListeners() {
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.EntityClickListener());
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.InventoryInteractListener());
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.InventoryCloseListener());
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.InventoryOpenListener());
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.PlayerInteractListener());
this.eventManager.registerEvents(new com.clubobsidian.dynamicgui.listener.GuiListener());
this.eventManager.registerEvents(new EntityClickListener());
this.eventManager.registerEvents(new InventoryInteractListener());
this.eventManager.registerEvents(new InventoryCloseListener());
this.eventManager.registerEvents(new InventoryOpenListener());
this.eventManager.registerEvents(new PlayerInteractListener());
this.eventManager.registerEvents(new GuiListener());
}

private void loadFunctions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.clubobsidian.dynamicgui.replacer.impl.StatisticReplacer;
import com.clubobsidian.dynamicgui.replacer.impl.UUIDReplacer;
import com.clubobsidian.dynamicgui.util.Statistic;
import com.clubobsidian.dynamicgui.util.Statistic.StatisticType;
import com.clubobsidian.trident.EventHandler;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -103,13 +102,13 @@ public void onReload(DynamicGuiReloadEvent event) {

private void generateStatisticReplacers() {
for(Statistic statistic : Statistic.values()) {
if(statistic.getStatisticType() == StatisticType.MATERIAL) {
if(statistic.getStatisticType() == Statistic.StatisticType.MATERIAL) {
for(String material : MaterialManager.get().getMaterials()) {
String lowerMaterial = material.toLowerCase();
String replacerName = "%statistic-" + statistic.name().toLowerCase() + "-" + lowerMaterial + "%";
this.addReplacer(new StatisticReplacer(replacerName, statistic, lowerMaterial));
}
} else if(statistic.getStatisticType() == StatisticType.ENTITY) {
} else if(statistic.getStatisticType() == Statistic.StatisticType.ENTITY) {
for(String entityType : EntityManager.get().getEntityTypes()) {
String lowerEntityType = entityType.toLowerCase();
String replacerName = "%statistic-" + statistic.name().toLowerCase() + "-" + lowerEntityType + "%";
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3797e0a

Please sign in to comment.