This commit is contained in:
Mgazul 2020-05-30 17:15:30 +08:00
parent e76d576770
commit 0a1c740652
793 changed files with 148 additions and 440 deletions

View File

@ -1,116 +1,75 @@
buildscript {
repositories {
mavenCentral()
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://plugins.gradle.org/m2/" }
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.1.0'
classpath 'org.ajoberstar:grgit:1.7.0'
}
configurations.all {
resolutionStrategy {
force 'org.ow2.asm:asm:6.0_BETA'
}
}
plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "5.2.0"
}
task setupCIWorkspace {
// do nothing, stub method
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo.codemc.io/maven-public' }
maven {url "http://repo.dmulloy2.net/content/groups/public/"}
maven {url "https://repo.destroystokyo.com/repository/maven-public//"}
maven {url "http://ci.athion.net/job/PlotSquared-Legacy/ws/mvn/"}
maven {url "http://empcraft.com/maven2"}
maven {url "https://jitpack.io"}
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
maven {url "http://maven.sk89q.com/repo/"}
maven {url "http://repo.maven.apache.org/maven2"}
maven {url "http://ci.frostcast.net/plugin/repository/everything"}
maven {url "http://maven.sk89q.com/artifactory/repo"}
maven {url "http://repo.spongepowered.org/maven"}
maven {url "http://dl.bintray.com/tastybento/maven-repo"}
maven {url "https://repo.inventivetalent.org/content/groups/public/"}
maven {url "https://store.ttyh.ru/libraries/"}
}
apply plugin: 'java'
clean { delete "target" }
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.boydti.fawe'
def revision = ""
def buildNumber = ""
def semver = ""
def date = ""
ext {
try {
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
date = git.head().date.format("yy.MM.dd")
revision = "-${git.head().abbreviatedId}"
parents = git.head().parentIds;
index = -67; // Offset to match CI
int major, minor, patch;
major = minor = patch = 0;
for (; parents != null && !parents.isEmpty(); index++) {
int majorCount, minorCount, patchCount;
patchCount = minor == 0 && major == 0 ? 1 : 0;
commit = git.getResolve().toCommit(parents.get(0));
for (String line : commit.fullMessage.tokenize("\n")) {
switch (line.replaceAll("- ", "").split(" ")[0].toLowerCase()) {
case "minor":
case "added":
case "add":
case "change":
case "changed":
case "changes":
if (major == 0) {
minorCount = 1; patchCount = 0;
}
break;
case "refactor":
case "remove":
case "major":
patchCount = minorCount = 0;
majorCount = 1;
break;
}
}
major += majorCount;
minor += minorCount;
patch += patchCount;
parents = commit.getParentIds()
}
buildNumber = "-${index}"
semver = "-${major}.${minor}.${patch}"
} catch (Throwable ignore) {
revision = "unknown";
}
}
version = date + revision + buildNumber + semver
if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion
version = "unknown"
}
version = 'mohist'
description = """FastAsyncWorldEdit"""
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava {
options.compilerArgs += ["-parameters"]
}
repositories {
maven {url "https://mvnrepository.com/artifact/"}
mavenCentral()
maven {url "http://repo.dmulloy2.net/content/groups/public/"}
maven {url "https://repo.destroystokyo.com/repository/maven-public//"}
//maven {url "http://ci.emc.gs/nexus/content/groups/aikar/" }
maven {url "http://ci.athion.net/job/PlotSquared-Legacy/ws/mvn/"}
mavenLocal()
maven {url "http://empcraft.com/maven2"}
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
maven {url "http://maven.sk89q.com/repo/"}
maven {url "http://repo.maven.apache.org/maven2"}
maven {url "http://ci.frostcast.net/plugin/repository/everything"}
maven {url "http://maven.sk89q.com/artifactory/repo"}
maven {url "http://repo.spongepowered.org/maven"}
maven {url "http://dl.bintray.com/tastybento/maven-repo"}
maven {url "https://repo.inventivetalent.org/content/groups/public/"}
maven {url "https://store.ttyh.ru/libraries/"}
}
dependencies {
compile files('libs/mohist_srg.jar')
compile files('libs/WorldEdit-6.1.9-SNAPSHOT-all.jar')
compile files('libs/ProtocolLib.jar')
compile files('libs/MapManager_v1.7.8-SNAPSHOT.jar')
compile files('libs/GriefPrevention.jar')
compile files('libs/PlotSquared-Bukkit-18.12.12-be48507-2053.jar')
compile files('libs/worldguard-6.2.1.jar')
compile files('libs/askyblock.jar')
compile files('libs/Factions.jar')
compile files('libs/MassiveCore.jar')
compile files('libs/Towny.jar')
compile files('libs/Residence4.9.0.6.jar')
compile files('libs/PreciousStones.jar')
compile files('libs/FactionsUUID.jar')
compile files('libs/PlotMe-Core.jar')
compile 'net.milkbowl.vault:VaultAPI:1.7'
//compile 'net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT'
//compile 'net.jzx7:regios:5.9.9'
//compile 'com.bekvon.bukkit.residence:Residence:4.5._13.1'
//compile 'com.palmergames.bukkit:towny:0.84.0.9'
//compile 'com.worldcretornica:plotme_core:0.16.3'
//compile 'junit:junit:4.11'
//compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
//compile 'com.wasteofplastic:askyblock:3.0.8.2'
compile 'org.yaml:snakeyaml:1.16'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:28.0-jre'
compile 'commons-lang:commons-lang:2.6'
compile 'co.aikar:fastutil-lite:1.0'
// compile 'net.fabiozumbi12:redprotect:1.9.6'
//compile 'org.primesoft:BlocksHub:2.0'
//compile 'com.github.luben:zstd-jni:1.1.1'
}
shadowJar {
dependencies {
include(dependency('com.github.luben:zstd-jni:1.1.1'))
include(dependency('co.aikar:fastutil-lite:1.0'))
exclude 'mohist_srg.jar'
}
relocate('com.google.gson', 'com.sk89q.worldedit.internal.gson')
}

View File

@ -1,86 +0,0 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
}
}
repositories {
flatDir {dirs 'lib'}
}
dependencies {
compile project(':core')
compile 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
compile('com.destroystokyo.paper:paper-api:1.12-R0.1-SNAPSHOT') {
exclude group: 'net.md-5'
}
compile 'org.bukkit.craftbukkitv1_12_R1:Craftbukkit:1.12.1'
compile 'net.milkbowl.vault:VaultAPI:1.5.6'
compile 'com.massivecraft:factions:2.8.0'
compile 'com.drtshock:factions:1.6.9.5'
compile 'com.factionsone:FactionsOne:1.2.2'
compile 'me.ryanhamshire:GriefPrevention:11.5.2'
compile 'com.massivecraft:mcore:7.0.1'
compile 'net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT'
compile 'net.jzx7:regios:5.9.9'
compile 'com.bekvon.bukkit.residence:Residence:4.5._13.1'
compile 'com.palmergames.bukkit:towny:0.84.0.9'
compile 'com.worldcretornica:plotme_core:0.16.3'
compile 'junit:junit:4.11'
compile 'com.sk89q.worldedit:worldedit-bukkit:6.1.4-SNAPSHOT'
compile 'com.sk89q.worldedit:worldedit-core:6.1.4-SNAPSHOT'
compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'
compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'
compile 'com.wasteofplastic:askyblock:3.0.8.2'
compile('org.inventivetalent:mapmanager:1.7.2-SNAPSHOT') {
transitive = false
}
}
clean { delete "../target" }
processResources {
from('src/main/resources') {
include 'plugin.yml'
expand(
name: project.parent.name,
version: project.parent.version
)
}
}
jar.archiveName="fawe-bukkit-${project.parent.version}.jar"
jar.destinationDir = file '../mvn/com/boydti/fawe-bukkit/' + project.parent.version
task copyFiles {
doLast {
copy {
from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/"
into '../mvn/com/boydti/fawe-bukkit/latest/'
include('*.jar')
rename ("fawe-bukkit-${project.parent.version}.jar", 'fawe-bukkit-latest.jar')
}
}
}
apply plugin: 'com.github.johnrengelman.shadow'
// We only want the shadow jar produced
shadowJar {
dependencies {
include(dependency('com.github.luben:zstd-jni:1.1.1'))
include(dependency('co.aikar:fastutil-lite:1.0'))
include(dependency(':core'))
}
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
destinationDir = file '../target'
relocate('com.google.gson', 'com.sk89q.worldedit.internal.gson')
}
shadowJar.doLast {
task ->
ant.checksum file: task.archivePath
}
build.dependsOn(shadowJar);

View File

@ -1,119 +0,0 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.Perm;
import com.massivecraft.factions.FLocation;
import java.lang.reflect.Method;
import java.util.List;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
public class FactionsOneFeature extends BukkitMaskManager implements Listener {
private final Class clazzBoard;
private final Method methodGetFactionAt;
public FactionsOneFeature(final Plugin factionsPlugin, final FaweBukkit p3) throws Throwable {
super(factionsPlugin.getName());
this.clazzBoard = Class.forName("com.massivecraft.factions.Board");
this.methodGetFactionAt = clazzBoard.getDeclaredMethod("getFactionAt", FLocation.class);
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, MaskType type) {
final Player player = fp.parent;
final Chunk chunk = player.getLocation().getChunk();
final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
final World world = player.getWorld();
RegionWrapper locs = new RegionWrapper(chunk.getX(), chunk.getX(), chunk.getZ(), chunk.getZ());
int count = 32;
if (this.isAdded(locs, world, player, perm, type)) {
boolean hasPerm = true;
RegionWrapper chunkSelection;
while (hasPerm && (count > 0)) {
count--;
hasPerm = false;
chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX, locs.maxX + 1, locs.minZ, locs.maxZ);
hasPerm = true;
}
chunkSelection = new RegionWrapper(locs.minX - 1, locs.minX - 1, locs.minZ, locs.maxZ);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX - 1, locs.maxX, locs.minZ, locs.maxZ);
hasPerm = true;
}
chunkSelection = new RegionWrapper(locs.minX, locs.maxX, locs.maxZ + 1, locs.maxZ + 1);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX, locs.maxX, locs.minZ, locs.maxZ + 1);
hasPerm = true;
}
chunkSelection = new RegionWrapper(locs.minX, locs.maxX, locs.minZ - 1, locs.minZ - 1);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX, locs.maxX, locs.minZ - 1, locs.maxZ);
hasPerm = true;
}
}
final Location pos1 = new Location(world, locs.minX << 4, 1, locs.minZ << 4);
final Location pos2 = new Location(world, 15 + (locs.maxX << 4), 256, 15 + (locs.maxZ << 4));
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CHUNK:" + pos1.getChunk().getX() + "," + pos1.getChunk().getZ();
}
};
}
return null;
}
public boolean isAdded(final RegionWrapper locs, final World world, final Player player, final boolean perm, MaskType type) {
try {
for (int x = locs.minX; x <= locs.maxX; x++) {
for (int z = locs.minZ; z <= locs.maxZ; z++) {
final Object fac = methodGetFactionAt.invoke(null, new FLocation(world.getName(), x, z));
if (fac == null) {
return false;
}
if (type == MaskType.OWNER) {
Object leader = fac.getClass().getDeclaredMethod("getFPlayerLeader").invoke(fac);
return player.getName().equals(leader.getClass().getDeclaredMethod("getName").invoke(leader));
}
Method methodGetOnlinePlayers = fac.getClass().getDeclaredMethod("getOnlinePlayers");
List<Player> players = (List<Player>) methodGetOnlinePlayers.invoke(fac);
if (!players.contains(player)) {
return false;
}
Method isNone = fac.getClass().getDeclaredMethod("isNone");
if ((boolean) isNone.invoke(fac)) {
return false;
}
}
}
return true;
} catch (Throwable e) {
MainUtil.handleError(e);
return false;
}
}
}

View File

@ -1,43 +0,0 @@
repositories {
flatDir {dirs 'lib'}
maven {url "http://ci.athion.net/job/PlotSquared-Legacy/ws/mvn/"}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'org.yaml:snakeyaml:1.16'
compile 'com.google.code.gson:gson:2.2.4'
compile 'net.fabiozumbi12:redprotect:1.9.6'
compile group: "com.plotsquared", name: "plotsquared-api", version: "latest"
compile 'org.primesoft:BlocksHub:2.0'
compile 'com.github.luben:zstd-jni:1.1.1'
compile 'co.aikar:fastutil-lite:1.0'
compile(group: 'com.sk89q.worldedit', name: 'worldedit-core', version:'6.1.3-SNAPSHOT') {
exclude(module: 'bukkit-classloader-check')
}
}
processResources {
from('src/main/resources') {
include 'fawe.properties'
expand(
version: "${project.parent.version}",
name: project.parent.name,
)
}
}
jar.archiveName="fawe-api-${project.parent.version}.jar"
jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version
task copyFiles {
doLast {
copy {
from "../mvn/com/boydti/fawe-api/${project.parent.version}/"
into '../mvn/com/boydti/fawe-api/latest/'
include('*.jar')
rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar')
}
}
}
build.finalizedBy(copyFiles)

View File

@ -1,5 +1,3 @@
#org.gradle.java.home=C:/PROGRA~2/Java/jdk1.7.0_79
#org.gradle.java.home=C:/PROGRA~1/Java/jdk1.8.0_51
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true

BIN
libs/Factions.jar Normal file

Binary file not shown.

BIN
libs/FactionsUUID.jar Normal file

Binary file not shown.

BIN
libs/GriefPrevention.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/MassiveCore.jar Normal file

Binary file not shown.

BIN
libs/PlotMe-Core.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/PreciousStones.jar Normal file

Binary file not shown.

BIN
libs/ProtocolLib.jar Normal file

Binary file not shown.

BIN
libs/Residence4.9.0.6.jar Normal file

Binary file not shown.

BIN
libs/Towny.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/askyblock.jar Normal file

Binary file not shown.

BIN
libs/mohist_srg.jar Normal file

Binary file not shown.

BIN
libs/worldguard-6.2.1.jar Normal file

Binary file not shown.

View File

@ -1,3 +1 @@
rootProject.name = 'FastAsyncWorldEdit'
include 'core', 'bukkit', 'favs'
rootProject.name = 'FastAsyncWorldEdit'

View File

@ -9,7 +9,6 @@ import com.boydti.fawe.bukkit.listener.CFIPacketListener;
import com.boydti.fawe.bukkit.listener.RenderListener;
import com.boydti.fawe.bukkit.regions.ASkyBlockHook;
import com.boydti.fawe.bukkit.regions.FactionsFeature;
import com.boydti.fawe.bukkit.regions.FactionsOneFeature;
import com.boydti.fawe.bukkit.regions.FactionsUUIDFeature;
import com.boydti.fawe.bukkit.regions.FreeBuildRegion;
import com.boydti.fawe.bukkit.regions.GriefPreventionFeature;

View File

@ -10,22 +10,28 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.ReflectionUtils;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.MinecraftKey;
import com.sk89q.jnbt.*;
import com.sk89q.worldedit.internal.Constants;
import net.minecraft.server.v1_12_R1.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.chunk.BlockStateContainer;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
import org.bukkit.event.entity.CreatureSpawnEvent;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
public DataPaletteBlock[] sectionPalettes;
public BlockStateContainer[] sectionPalettes;
public static Map<String, Class<? extends Entity>> entityKeys;
@ -64,7 +70,7 @@ public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
int y = (MathMan.roundInt(ent.locY) & 0xFF);
int i = FaweCache.CACHE_I[y][z][x];
int j = FaweCache.CACHE_J[y][z][x];
String id = EntityTypes.b(ent);
String id = EntityList.func_75621_b(ent);
if (id != null) {
NBTTagCompound tag = new NBTTagCompound();
ent.save(tag); // readEntityIntoTag

View File

@ -1,5 +1,7 @@
package com.boydti.fawe.bukkit.v1_12;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.MinecraftKey;
import com.google.common.base.Preconditions;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.ByteTag;
@ -29,27 +31,22 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import net.minecraft.server.v1_12_R1.BiomeBase;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.EntityTypes;
import net.minecraft.server.v1_12_R1.MinecraftKey;
import net.minecraft.server.v1_12_R1.NBTBase;
import net.minecraft.server.v1_12_R1.NBTTagByte;
import net.minecraft.server.v1_12_R1.NBTTagByteArray;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
import net.minecraft.server.v1_12_R1.NBTTagDouble;
import net.minecraft.server.v1_12_R1.NBTTagEnd;
import net.minecraft.server.v1_12_R1.NBTTagFloat;
import net.minecraft.server.v1_12_R1.NBTTagInt;
import net.minecraft.server.v1_12_R1.NBTTagIntArray;
import net.minecraft.server.v1_12_R1.NBTTagList;
import net.minecraft.server.v1_12_R1.NBTTagLong;
import net.minecraft.server.v1_12_R1.NBTTagShort;
import net.minecraft.server.v1_12_R1.NBTTagString;
import net.minecraft.server.v1_12_R1.TileEntity;
import net.minecraft.server.v1_12_R1.World;
import net.minecraft.server.v1_12_R1.WorldServer;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagByteArray;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagEnd;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLong;
import net.minecraft.nbt.NBTTagShort;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Biome;

Some files were not shown because too many files have changed in this diff Show More