Initial commit

This commit is contained in:
FirephoenixX02 2023-10-31 18:15:51 +01:00
commit 9ccaaca6da
9 changed files with 492 additions and 0 deletions

113
.gitignore vendored Normal file
View file

@ -0,0 +1,113 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

36
pom.xml Normal file
View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.firephoenix</groupId>
<artifactId>AnticheatManager</artifactId>
<version>1.0</version>
<name>AnticheatManager</name>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
</project>

View file

@ -0,0 +1,17 @@
package me.firephoenix.anticheatmanager;
import org.bukkit.plugin.java.JavaPlugin;
public final class AnticheatManager extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

View file

@ -0,0 +1,8 @@
package me.firephoenix.anticheatmanager.cmds;
/**
* @author NieGestorben
* Copyright© (c) 2023, All Rights Reserved.
*/
public class AnticheatManagerGUI {
}

View file

@ -0,0 +1,6 @@
package me.firephoenix.anticheatmanager.cmds;/**
* @author NieGestorben
* Copyright© (c) 2023, All Rights Reserved.
*/
public class AnticheatSelector {
}

View file

@ -0,0 +1,8 @@
package me.firephoenix.anticheatmanager.listener;
/**
* @author NieGestorben
* Copyright© (c) 2023, All Rights Reserved.
*/
public class InvClick {
}

View file

@ -0,0 +1,301 @@
package me.firephoenix.anticheatmanager.cmds.util;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* Easily create itemstacks, without messing your hands.
* <i>Note that if you do use this in one of your projects, leave this notice.</i>
* <i>Please do credit me if you do use this in one of your projects.</i>
* @author NonameSL
*/
public class ItemBuilder {
private final ItemStack is;
/**
* Create a new ItemBuilder from scratch.
* @param m The material to create the ItemBuilder with.
*/
public ItemBuilder(Material m){
this(m, 1);
}
/**
* Create a new ItemBuilder over an existing itemstack.
* @param is The itemstack to create the ItemBuilder over.
*/
public ItemBuilder(ItemStack is){
this.is=is;
}
/**
* Create a new ItemBuilder from scratch.
* @param m The material of the item.
* @param amount The amount of the item.
*/
public ItemBuilder(Material m, int amount){
is= new ItemStack(m, amount);
}
/**
* Create a new ItemBuilder from scratch.
* @param m The material of the item.
* @param amount The amount of the item.
* @param durability The durability of the item.
*/
public ItemBuilder(Material m, int amount, byte durability){
is = new ItemStack(m, amount, durability);
}
/**
* Clone the ItemBuilder into a new one.
* @return The cloned instance.
*/
public ItemBuilder clone() {
return new ItemBuilder(is);
}
/**
* Change the durability of the item.
* @param dur The durability to set it to.
*/
public ItemBuilder setDurability(short dur){
is.setDurability(dur);
return this;
}
/**
* Change the amount of the item.
* @param amount The amount to set it to.
*/
public ItemBuilder setAmount(int amount) {
is.setAmount(amount);
return this;
}
/**
* Set the displayname of the item.
* @param name The name to change it to.
*/
public ItemBuilder setName(String name){
ItemMeta im = is.getItemMeta();
im.setDisplayName(name);
is.setItemMeta(im);
return this;
}
/**
* Add an unsafe enchantment.
* @param ench The enchantment to add.
* @param level The level to put the enchant on.
*/
public ItemBuilder addUnsafeEnchantment(Enchantment ench, int level){
is.addUnsafeEnchantment(ench, level);
return this;
}
/**
* Remove a certain enchant from the item.
* @param ench The enchantment to remove
*/
public ItemBuilder removeEnchantment(Enchantment ench){
is.removeEnchantment(ench);
return this;
}
/**
* Set the skull owner for the item. Works on skulls only.
* @param owner The name of the skull's owner.
*/
public ItemBuilder setSkullOwner(String owner){
try{
SkullMeta im = (SkullMeta)is.getItemMeta();
im.setOwner(owner);
is.setItemMeta(im);
}catch(ClassCastException ignored){}
return this;
}
/**
* Add an enchant to the item.
* @param ench The enchant to add
* @param level The level
*/
public ItemBuilder addEnchant(Enchantment ench, int level){
ItemMeta im = is.getItemMeta();
im.addEnchant(ench, level, true);
is.setItemMeta(im);
return this;
}
/**
* Add multiple enchants at once.
* @param enchantments The enchants to add.
*/
public ItemBuilder addEnchantments(Map<Enchantment, Integer> enchantments){
is.addEnchantments(enchantments);
return this;
}
/**
* Sets infinity durability on the item by setting the durability to Short.MAX_VALUE.
*/
public ItemBuilder setInfinityDurability(){
is.setDurability(Short.MAX_VALUE);
return this;
}
/**
* Sets the durability to unbreakable
*/
public ItemBuilder setUnbreakable(boolean unbreakable) {
ItemMeta im = is.getItemMeta();
im.spigot().setUnbreakable(unbreakable);
is.setItemMeta(im);
return this;
}
/**
* Re-sets the lore.
* @param lore The lore to set it to.
*/
public ItemBuilder setLore(String... lore){
ItemMeta im = is.getItemMeta();
im.setLore(Arrays.asList(lore));
is.setItemMeta(im);
return this;
}
/**
* Re-sets the lore.
* @param lore The lore to set it to.
*/
public ItemBuilder setLore(List<String> lore) {
ItemMeta im = is.getItemMeta();
im.setLore(lore);
is.setItemMeta(im);
return this;
}
/**
* Remove a lore line.
* @param line The lore to remove.
*/
public ItemBuilder removeLoreLine(String line){
ItemMeta im = is.getItemMeta();
List<String> lore = new ArrayList<>(im.getLore());
if(!lore.contains(line))return this;
lore.remove(line);
im.setLore(lore);
is.setItemMeta(im);
return this;
}
/**
* Remove a lore line.
* @param index The index of the lore line to remove.
*/
public ItemBuilder removeLoreLine(int index){
ItemMeta im = is.getItemMeta();
List<String> lore = new ArrayList<>(im.getLore());
if(index<0||index>lore.size())return this;
lore.remove(index);
im.setLore(lore);
is.setItemMeta(im);
return this;
}
/**
* Add a lore line.
* @param line The lore line to add.
*/
public ItemBuilder addLoreLine(String line){
ItemMeta im = is.getItemMeta();
List<String> lore = new ArrayList<>();
if(im.hasLore())lore = new ArrayList<>(im.getLore());
lore.add(line);
im.setLore(lore);
is.setItemMeta(im);
return this;
}
/**
* Add a lore line.
* @param line The lore line to add.
* @param pos The index of where to put it.
*/
public ItemBuilder addLoreLine(String line, int pos){
ItemMeta im = is.getItemMeta();
List<String> lore = new ArrayList<>(im.getLore());
lore.set(pos, line);
im.setLore(lore);
is.setItemMeta(im);
return this;
}
/**
* Sets the dye color on an item.
* <b>* Notice that this doesn't check for item type, sets the literal data of the dyecolor as durability.</b>
* @param color The color to put.
*/
@SuppressWarnings("deprecation")
public ItemBuilder setDyeColor(DyeColor color){
this.is.setDurability(color.getDyeData());
return this;
}
/**
* Sets the dye color of a wool item. Works only on wool.
* @deprecated As of version 1.2 changed to setDyeColor.
* @see ItemBuilder@setDyeColor(DyeColor)
* @param color The DyeColor to set the wool item to.
*/
@Deprecated
public ItemBuilder setWoolColor(DyeColor color){
if(!is.getType().equals(Material.WOOL))return this;
this.is.setDurability(color.getDyeData());
return this;
}
/**
* Sets the armor color of a leather armor piece. Works only on leather armor pieces.
* @param color The color to set it to.
*/
public ItemBuilder setLeatherArmorColor(Color color){
try{
LeatherArmorMeta im = (LeatherArmorMeta)is.getItemMeta();
im.setColor(color);
is.setItemMeta(im);
}catch(ClassCastException ignored){}
return this;
}
/**
* Sets the itemflag of the item. Works on every item.
* @param flag Set a specific itemflag
*/
public ItemBuilder setItemFlags(ItemFlag flag) {
ItemMeta im = is.getItemMeta();
im.addItemFlags(flag);
is.setItemMeta(im);
return this;
}
/**
* Sets the data of the item. Works on every item.
* @param data Set a specific data
*/
public ItemBuilder setData(MaterialData data) {
is.setData(data);
return this;
}
/**
* Sets the typeId of the item. Works on every item.
* @param typeId Set a specific typeId
*/
@SuppressWarnings("deprecation")
public ItemBuilder setTypeId(int typeId) {
try {
is.setTypeId(typeId);
}catch (ClassCastException ignored) {}
return this;
}
/**
* Retrieves the itemstack from the ItemBuilder.
* @return The itemstack created/modified by the ItemBuilder instance.
*/
public ItemStack toItemStack(){
return is;
}
}

View file

View file

@ -0,0 +1,3 @@
name: AnticheatManager
version: '${project.version}'
main: me.firephoenix.anticheatmanager.AnticheatManager