mirror of
https://github.com/TotalFreedomMC/TotalFreedomMod.git
synced 2024-05-14 16:41:27 +00:00
Fix compile issues
This commit is contained in:
parent
cfd197b14d
commit
f4fe50fca0
27
.github/workflows/maven.yml
vendored
27
.github/workflows/maven.yml
vendored
|
@ -1,27 +0,0 @@
|
|||
name: Maven-Build
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Java 11 Builds
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
# Java 16 Builds
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 16
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
14
build.gradle
14
build.gradle
|
@ -61,13 +61,16 @@ repositories {
|
|||
maven {
|
||||
url = uri('https://repo.mattmalec.com/repository/releases')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.essentialsx.net/releases/')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation('commons-io:commons-io:2.8.0')
|
||||
implementation('org.apache.commons:commons-lang3:3.11')
|
||||
implementation('commons-codec:commons-codec:1.15')
|
||||
implementation('com.github.speedxx:Mojangson:1957eef8d6')
|
||||
implementation('io.papermc:paperlib:1.0.6')
|
||||
implementation('org.reflections:reflections:0.9.12')
|
||||
implementation('org.javassist:javassist:3.28.0-GA')
|
||||
|
@ -75,14 +78,14 @@ dependencies {
|
|||
implementation('com.mattmalec:Pterodactyl4J:2.BETA_49')
|
||||
implementation('org.junit.jupiter:junit-jupiter:5.7.2')
|
||||
implementation('org.projectlombok:lombok:1.18.20')
|
||||
compileOnly('org.spigotmc:spigot:1.17-R0.1-SNAPSHOT')
|
||||
compileOnly('org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT')
|
||||
compileOnly('com.github.TotalFreedomMC:BukkitTelnet:541e9fdb84')
|
||||
compileOnly('com.github.TotalFreedomMC:TF-LibsDisguises:48f01cf2fe')
|
||||
compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT')
|
||||
compileOnly('net.ess3:EssentialsX:2.18.2')
|
||||
compileOnly('net.essentialsx:EssentialsX:2.19.0')
|
||||
compileOnly('net.dv8tion:JDA:4.3.0_277')
|
||||
compileOnly('net.coreprotect:coreprotect:19.5')
|
||||
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.5')
|
||||
compileOnly('net.coreprotect:coreprotect:20.0')
|
||||
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.6')
|
||||
compileOnly('com.github.vexsoftware:votifier:v1.9')
|
||||
compileOnly('net.goldtreeservers:worldguardextraflags:4.0.0')
|
||||
compileOnly('com.github.AtlasMediaGroup:TFGuilds:master-SNAPSHOT')
|
||||
|
@ -151,7 +154,6 @@ shadowJar {
|
|||
include(dependency('org.javassist:javassist'))
|
||||
include(dependency('io.papermc:paperlib'))
|
||||
include(dependency('org.reflections:reflections'))
|
||||
include(dependency('com.github.speedxx:Mojangson'))
|
||||
include(dependency('org.jetbrains:annotations'))
|
||||
include(dependency('com.mattmalec:Pterodactyl4J'))
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||
import ca.momothereal.mojangson.value.MojangsonCompound;
|
||||
import ca.momothereal.mojangson.value.MojangsonValue;
|
||||
import com.google.common.collect.Multimap;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -20,9 +19,11 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
|||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class MovementValidator extends FreedomService
|
||||
{
|
||||
|
||||
public static final int MAX_XYZ_COORD = 29999998;
|
||||
public static final int MAX_DISTANCE_TRAVELED = 100;
|
||||
|
||||
|
@ -132,55 +133,49 @@ public class MovementValidator extends FreedomService
|
|||
|
||||
private Boolean exploitItem(ItemStack item)
|
||||
{
|
||||
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||
MojangsonCompound compound = new MojangsonCompound();
|
||||
boolean foundNegative = false;
|
||||
boolean foundPositive = false;
|
||||
try
|
||||
if (item == null)
|
||||
{
|
||||
String mod = modifiers.toString();
|
||||
String fancy = ("{" + (mod.substring(1, mod.length() - 1).replace("{", "").replace("}", "")) + "}");
|
||||
compound.read(fancy);
|
||||
for (String key : compound.keySet())
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null)
|
||||
{
|
||||
Multimap<Attribute, AttributeModifier> attributes = meta.getAttributeModifiers();
|
||||
if (attributes != null)
|
||||
{
|
||||
if (Objects.equals(key, "Amount")) //null-safe .equals()
|
||||
Map<Attribute, Collection<AttributeModifier>> attrMap = attributes.asMap();
|
||||
|
||||
// For every attribute...
|
||||
for (Attribute attr : attributes.keySet())
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
List<MojangsonValue> values = compound.get(key);
|
||||
for (MojangsonValue<?> val : values)
|
||||
// Default values
|
||||
boolean posInf = false;
|
||||
boolean negInf = false;
|
||||
|
||||
// For every AttributeModifier...
|
||||
for (AttributeModifier modifier : attrMap.get(attr))
|
||||
{
|
||||
if (val.getValue().toString().equals("Infinityd"))
|
||||
// Are they ∞ or -∞?
|
||||
if (modifier.getAmount() == Double.POSITIVE_INFINITY)
|
||||
{
|
||||
foundPositive = true;
|
||||
posInf = true;
|
||||
}
|
||||
if (val.getValue().toString().equals("-Infinityd"))
|
||||
else if (modifier.getAmount() == Double.NEGATIVE_INFINITY)
|
||||
{
|
||||
foundNegative = true;
|
||||
negInf = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Are both values set as true?
|
||||
if (posInf && negInf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MojangsonParseException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return foundNegative && foundPositive;
|
||||
}
|
||||
|
||||
|
||||
private NBTTagList getAttributeList(net.minecraft.world.item.ItemStack stack)
|
||||
{
|
||||
if (stack.getTag() == null)
|
||||
{
|
||||
stack.setTag(new NBTTagCompound());
|
||||
}
|
||||
NBTTagList attr = stack.getTag().getList("AttributeModifiers", 10);
|
||||
if (attr == null)
|
||||
{
|
||||
stack.getTag().set("AttributeModifiers", new NBTTagList());
|
||||
}
|
||||
return stack.getTag().getList("AttributeModifiers", 10);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
name: TotalFreedomMod
|
||||
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
||||
version: ${project.version}
|
||||
description: Plugin for the Total Freedom server.
|
||||
softdepend:
|
||||
- BukkitTelnet
|
||||
- Essentials
|
||||
- CoreProtect
|
||||
- LibsDisguises
|
||||
- WorldEdit
|
||||
- WorldGuard
|
||||
- WorldGuardExtraFlags
|
||||
- TFGuilds
|
||||
- JDA
|
||||
- Votifier
|
||||
authors: [Madgeek1450, Prozza]
|
||||
api-version: "1.16"
|
Loading…
Reference in a new issue