This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedWriter; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.logging.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringBlock extends StringLocation { | |
public Material material; | |
public Byte data; | |
public RegenerateType regenerateType = RegenerateType.READY; | |
public StringBlock(Block b, RegenerateType regenerateType) { | |
super(b.getLocation()); | |
material = b.getType(); | |
data = b.getData(); | |
this.regenerateType = regenerateType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sk89q.worldedit.Vector; | |
import org.bukkit.*; | |
import org.bukkit.block.Block; | |
import java.util.Objects; | |
import static org.bukkit.util.NumberConversions.square; | |
public class StringLocation { | |
public String world; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bukkit.Bukkit; | |
import org.bukkit.Chunk; | |
import java.util.Objects; | |
public class StringChunk { | |
public String world; | |
public int x, z; | |
public StringChunk(Chunk c) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bukkit.Location; | |
import org.bukkit.Particle; | |
import org.bukkit.Sound; | |
import org.bukkit.block.Block; | |
import org.bukkit.block.BlockState; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.EventPriority; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.block.BlockBreakEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.n9works.bukkit; | |
import com.google.common.collect.Iterables; | |
import com.n9works.bukkit.towns.Generator; | |
import com.n9works.bukkit.utils.StringLocation; | |
import com.n9works.bukkit.utils.blocks.StringBlock; | |
import net.md_5.bungee.api.ChatColor; | |
import org.apache.commons.configuration.PropertyConverter; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Location; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Spoof Health Packets | |
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin, ENTITY_METADATA) { | |
public void onPacketSending(PacketEvent event) { | |
try { | |
Player observer = event.getPlayer(); | |
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld()); | |
org.bukkit.entity.Entity entity = entityModifer.read(0); | |
if (entity != null && observer != entity && entity instanceof Player | |
&& (entity.getPassenger() == null || entity.getPassenger() != observer)) { | |
event.setPacket(event.getPacket().deepClone()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Supplier; | |
public class CachedObject<T> { | |
private final Supplier<T> updateFunction; | |
private T cachedValue; | |
private boolean dirty = true; | |
public CachedObject(Supplier<T> updateFunction) { | |
this.updateFunction = updateFunction; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlockQueue implements Runnable { | |
private final TheArtifact plugin; | |
private PriorityBlockingQueue<StringBlock> queue; | |
public BlockQueue(TheArtifact plugin) { | |
this.plugin = plugin; | |
queue = new PriorityBlockingQueue<>(20000, Comparator.comparing(o1 -> o1.priority)); | |
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, this, 0, 2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void getEntitiesWithinRegion(Location p1, Location p2, Consumer<List<Entity>> entitiesConsumer) { | |
int minX = Math.min(p1.getBlockX(), p2.getBlockX()) >> 4; | |
int maxX = Math.max(p1.getBlockX(), p2.getBlockX()) >> 4; | |
int minZ = Math.min(p1.getBlockZ(), p2.getBlockZ()) >> 4; | |
int maxZ = Math.max(p1.getBlockZ(), p2.getBlockZ()) >> 4; | |
List<CompletableFuture> futures = new ArrayList<>(); | |
List<Entity> entities = new ArrayList<>(); | |
for (int x = minX; x <= maxX; x++) { | |
for (int z = minZ; z <= maxZ; z++) { |
OlderNewer