mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
remove unneeded PaperListener
This commit is contained in:
@@ -38,8 +38,6 @@ import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.bukkit.listeners.CommonListener;
|
||||
import com.dfsek.terra.bukkit.listeners.PaperListener;
|
||||
import com.dfsek.terra.bukkit.listeners.SpigotListener;
|
||||
import com.dfsek.terra.bukkit.util.PaperUtil;
|
||||
import com.dfsek.terra.bukkit.util.VersionUtil;
|
||||
import com.dfsek.terra.bukkit.world.BukkitAdapter;
|
||||
@@ -92,51 +90,6 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new CommonListener(), this); // Register master event listener
|
||||
PaperUtil.checkPaper(this);
|
||||
|
||||
try {
|
||||
Class.forName("io.papermc.paper.event.world.StructureLocateEvent"); // Check if user is on Paper version with event.
|
||||
Bukkit.getPluginManager().registerEvents(new PaperListener(platform), this); // Register Paper events.
|
||||
} catch(ClassNotFoundException e) {
|
||||
/*
|
||||
The command
|
||||
|
||||
fmt -w 72 -g 72 -u text | \
|
||||
boxes -a cmd -p a1h3 -t 4e -d jstone -s82 | \
|
||||
sed -Ee 's/\+-+\*\//|------------------------------------------------------------------------------|/g' \
|
||||
-e 's/^\s*(.*)$/"\1\\n"/g' -e 's/\///g' -e 's/\*|\+/./g' -e 's/$/ +/g' -e '/^"\| {3}-{72} {3}\|\\n" \+$/d'
|
||||
|
||||
was used to create these boxes. Leaving this here for if we want to create more/modify them.
|
||||
*/
|
||||
if(VersionUtil.getSpigotVersionInfo().isPaper()) { // logging with stack trace to be annoying.
|
||||
logger.warn("""
|
||||
.------------------------------------------------------------------------------.
|
||||
| |
|
||||
| You are using an outdated version of Paper. This version does not |
|
||||
| contain StructureLocateEvent. Terra will now fall back to Spigot |
|
||||
| events. This will prevent cartographer villagers from spawning, |
|
||||
| and cause structure location to not function. If you want these |
|
||||
| functionalities, update to the latest build of Paper. If you use a |
|
||||
| fork, update to the latest version, then if you still receive this |
|
||||
| message, ask the fork developer to update upstream. |
|
||||
| |
|
||||
|------------------------------------------------------------------------------|
|
||||
""".strip(), e);
|
||||
} else {
|
||||
logger.warn("""
|
||||
.------------------------------------------------------------------------------.
|
||||
| |
|
||||
| Paper is not in use. Falling back to Spigot events. This will prevent |
|
||||
| cartographer villagers from spawning, and cause structure location to |
|
||||
| not function. If you want these functionalities (and all the other |
|
||||
| benefits that Paper offers), upgrade your server to Paper. Find out |
|
||||
| more at https://papermc.io/ |
|
||||
| |
|
||||
|------------------------------------------------------------------------------|
|
||||
""".strip(), e);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new SpigotListener(platform), this); // Register Spigot event listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "deprecation", "AccessOfSystemProperties" })
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Terra is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.bukkit.listeners;
|
||||
|
||||
import io.papermc.paper.event.world.StructureLocateEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
|
||||
|
||||
public class PaperListener implements Listener {
|
||||
private final Platform platform;
|
||||
|
||||
public PaperListener(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onStructureLocate(StructureLocateEvent e) {
|
||||
/*String name = "minecraft:" + e.getType().getName();
|
||||
main.getDebugLogger().info("Overriding structure location for \"" + name + "\"");
|
||||
World w = BukkitAdapter.adapt(e.getWorld());
|
||||
ConfiguredStructure config = tw.getConfig().getRegistry(TerraStructure.class).get(tw.getConfig().getLocatable().get(name));
|
||||
if(config != null) {
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(w.getBiomeProvider(), config, BukkitAdapter.adapt(e.getOrigin()
|
||||
.toVector()), tw.getWorld(), 0, 500, location -> {
|
||||
if(location != null)
|
||||
e.setResult(BukkitAdapter.adapt(location).toLocation(e.getWorld()));
|
||||
main.getDebugLogger().info("Location: " + location);
|
||||
}, main);
|
||||
finder.run(); // Do this synchronously.
|
||||
} else {
|
||||
e.setResult(e.getOrigin());
|
||||
main.logger().warning("No overrides are defined for \"" + name + "\". Locating this structure will NOT work properly!");
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user