Remove ChunkArchiveComponent

This commit is contained in:
Alisolarflare 2020-09-04 17:31:58 -04:00 committed by NorbiPeti
parent 97928aff30
commit 230da410c8
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 14 additions and 79 deletions

18
pom.xml
View file

@ -32,7 +32,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -47,7 +47,7 @@
</repository>
<repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
@ -55,7 +55,11 @@
</repository>
<repository>
<id>Factions</id>
<url>http://ci.ender.zone/plugin/repository/everything/</url>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
<repository>
<id>TownyAdvanced</id>
<url>https://github.com/TownyAdvanced/Towny/</url>
</repository>
</repositories>
<dependencies>
@ -67,8 +71,9 @@
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<artifactId>spigot-api</artifactId>
<version>1.16.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ChromaCore</groupId>
@ -86,8 +91,9 @@
<version>1.6.9.5-U0.5.16</version>
</dependency>
<dependency>
<groupId>com.palmergames.bukkit.towny</groupId>
<groupId>com.github.TownyAdvanced</groupId>
<artifactId>Towny</artifactId>
<!-- <version>8d3b6b6</version> ButtonCore repo -->
<version>0.96.2.0</version>
<scope>provided</scope>
</dependency>

View file

@ -1,7 +1,6 @@
package buttondevteam.presents;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.components.chunkarchive.ChunkArchiveComponent;
import buttondevteam.presents.components.magic.MagicComponent;
import buttondevteam.presents.components.portals.PortalLimitComponent;
import buttondevteam.presents.components.research.ResearchComponent;
@ -14,7 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public class ButtonPresents extends JavaPlugin{
//Hello Norbs
public void onEnable(){
PluginDescriptionFile pdfFile = getDescription();
@ -26,11 +25,6 @@ public class ButtonPresents extends JavaPlugin{
Component.registerComponent(this, new SpawnComponent());
Component.registerComponent(this, new MagicComponent());
Component.registerComponent(this, new ResearchComponent());
try {
Component.registerComponent(this, new ChunkArchiveComponent());
} catch (NoClassDefFoundError e) {
getLogger().warning("ChunkArchive compatibility error, not registering it.");
}
Component.registerComponent(this, new TownyFactionsComponent());
Component.registerComponent(this, new PortalLimitComponent());

View file

@ -1,65 +0,0 @@
package buttondevteam.presents.components.chunkarchive;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
import buttondevteam.presents.ButtonPresents;
import net.minecraft.server.v1_12_R1.ChunkRegionLoader;
import net.minecraft.server.v1_12_R1.ExceptionWorldConflict;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkPopulateEvent;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
// @formatter:off
@ComponentMetadata(enabledByDefault = false)
public class ChunkArchiveComponent extends Component<ButtonPresents> implements Listener {
private final File dataFolder = new File("plugins", "ChunkArchive");
@Override
public void enable() {
try {
this.registerListener(this);
File testFolder = new File(dataFolder, "test");
testFolder.mkdirs();
Logger logger = getPlugin().getLogger();
logger.info("Starting chunk save test...");
ChunkRegionLoader testcrl = new ChunkRegionLoader(testFolder,
((CraftServer) Bukkit.getServer()).getServer().dataConverterManager);
CraftWorld mainWorld=(CraftWorld) Bukkit.getWorlds().get(0);
testcrl.saveChunk(mainWorld.getHandle(),
((CraftChunk) mainWorld.getLoadedChunks()[0]).getHandle(), false);
logger.info("Test complete");
}
catch(Exception e) {
TBMCCoreAPI.SendException("ChunkArchive loading/testing failed!", e);
}
}
@Override
protected void disable() {
}
/*------------------------------------------------------------*/
private final ChunkRegionLoader chunkRegionLoader =
new ChunkRegionLoader(dataFolder,
((CraftServer) Bukkit.getServer()).getServer().dataConverterManager);
/*------------------------------------------------------------*/
@EventHandler
public void onChunkPopulate(ChunkPopulateEvent event) throws IOException, ExceptionWorldConflict
{
if (event.getWorld().getName().equals("world"))
chunkRegionLoader.saveChunk(((CraftWorld) event.getWorld()).getHandle(),
((CraftChunk) event.getChunk()).getHandle(), false);
}
}

View file

@ -14,7 +14,7 @@ public class SetBlock extends UniversalCommand {
public boolean def(Player player) {
Block blockAtPlayer = player.getWorld().getBlockAt(player.getLocation());
blockAtPlayer.setType(Material.CAKE_BLOCK);
blockAtPlayer.setType(Material.CAKE);
return true;
}