mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-29 03:49:08 +00:00
fix bugs
This commit is contained in:
@@ -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
42
gui-plugin/.gitignore
vendored
Normal 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
|
||||
13
gui-plugin/build.gradle.kts
Normal file
13
gui-plugin/build.gradle.kts
Normal 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")
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
0
gui-plugin/src/main/resources/config.yml
Normal file
0
gui-plugin/src/main/resources/config.yml
Normal file
9
gui-plugin/src/main/resources/plugin.yml
Normal file
9
gui-plugin/src/main/resources/plugin.yml
Normal 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
|
||||
@@ -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 "!=" -> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
rootProject.name = 'CustomCrops'
|
||||
include(":plugin")
|
||||
include(":api")
|
||||
include 'legacy-api'
|
||||
include(":legacy-api")
|
||||
include(":gui-plugin")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user