9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-29 03:49:08 +00:00
This commit is contained in:
XiaoMoMi
2024-04-13 17:06:21 +08:00
parent 6d5a379ceb
commit c7c6004300
9 changed files with 125 additions and 6 deletions

View File

@@ -43,6 +43,7 @@ allprojects {
maven("https://repo.infernalsuite.com/repository/maven-releases/")
maven("https://repo.rapture.pw/repository/maven-releases/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.xenondevs.xyz/releases/")
}
}

42
gui-plugin/.gitignore vendored Normal file
View File

@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@@ -0,0 +1,13 @@
dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
compileOnly(project(":api"))
implementation("xyz.xenondevs.invui:invui:1.27") {
exclude("org.jetbrains")
}
}
tasks {
shadowJar {
relocate ("xyz.xenondevs", "net.momirealms.customcrops.libraries")
}
}

View File

@@ -0,0 +1,21 @@
package net.momirealms.customcrops.gui;
import org.bukkit.plugin.java.JavaPlugin;
public class CustomCropsGUI extends JavaPlugin {
private static CustomCropsGUI instance;
@Override
public void onEnable() {
instance = this;
}
@Override
public void onDisable() {
}
public static CustomCropsGUI getInstance() {
return instance;
}
}

View File

@@ -0,0 +1,16 @@
package net.momirealms.customcrops.gui;
import net.momirealms.customcrops.api.event.PotInteractEvent;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class GUIManager implements Listener {
@EventHandler (ignoreCancelled = true)
public void onInteractPot(PotInteractEvent event) {
if (event.getItemInHand().getType() != Material.AIR)
return;
}
}

View File

View File

@@ -0,0 +1,9 @@
name: CustomCrops
version: '${version}'
main: net.momirealms.customcrops.gui.CustomCropsGUI
api-version: 1.17
load: POSTWORLD
authors: [ XiaoMoMi ]
folia-supported: true
depend:
- CustomCrops

View File

@@ -586,6 +586,22 @@ public class RequirementManagerImpl implements RequirementManager {
}
private void registerNumberEqualRequirement() {
registerRequirement("=", (args, actions, advanced) -> {
if (args instanceof ConfigurationSection section) {
String v1 = section.getString("value1", "");
String v2 = section.getString("value2", "");
return state -> {
String p1 = v1.startsWith("%") ? ParseUtils.setPlaceholders(state.getPlayer(), v1) : v1;
String p2 = v2.startsWith("%") ? ParseUtils.setPlaceholders(state.getPlayer(), v2) : v2;
if (Double.parseDouble(p1) == Double.parseDouble(p2)) return true;
if (advanced) triggerActions(actions, state);
return false;
};
} else {
LogUtils.warn("Wrong value format found at = requirement.");
return EmptyRequirement.instance;
}
});
registerRequirement("==", (args, actions, advanced) -> {
if (args instanceof ConfigurationSection section) {
String v1 = section.getString("value1", "");
@@ -598,7 +614,7 @@ public class RequirementManagerImpl implements RequirementManager {
return false;
};
} else {
LogUtils.warn("Wrong value format found at !startsWith requirement.");
LogUtils.warn("Wrong value format found at == requirement.");
return EmptyRequirement.instance;
}
});
@@ -614,7 +630,7 @@ public class RequirementManagerImpl implements RequirementManager {
return false;
};
} else {
LogUtils.warn("Wrong value format found at !startsWith requirement.");
LogUtils.warn("Wrong value format found at != requirement.");
return EmptyRequirement.instance;
}
});
@@ -857,7 +873,7 @@ public class RequirementManagerImpl implements RequirementManager {
return false;
};
} else {
LogUtils.warn("Wrong value format found at in-list requirement.");
LogUtils.warn("Wrong value format found at !in-list requirement.");
return EmptyRequirement.instance;
}
});
@@ -946,7 +962,7 @@ public class RequirementManagerImpl implements RequirementManager {
private void registerPotionEffectRequirement() {
registerRequirement("potion-effect", (args, actions, advanced) -> {
String potions = (String) args;
String[] split = potions.split("(<=|>=|<|>|==)", 2);
String[] split = potions.split("(<=|>=|<|>|==|=)", 2);
PotionEffectType type = PotionEffectType.getByName(split[0]);
if (type == null) {
LogUtils.warn("Potion effect doesn't exist: " + split[0]);
@@ -969,7 +985,7 @@ public class RequirementManagerImpl implements RequirementManager {
case ">" -> {
if (level > required) result = true;
}
case "==" -> {
case "==", "=" -> {
if (level == required) result = true;
}
case "!=" -> {

View File

@@ -1,5 +1,6 @@
rootProject.name = 'CustomCrops'
include(":plugin")
include(":api")
include 'legacy-api'
include(":legacy-api")
include(":gui-plugin")