Skip to content

Commit

Permalink
init commit v0.1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Potrebic <[email protected]>
  • Loading branch information
Machine-Maker committed Jul 10, 2020
0 parents commit fcfee58
Show file tree
Hide file tree
Showing 62 changed files with 3,832 additions and 0 deletions.
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# VanillaTweaks

A better-performance replacement for the popular VanillaTweaks datapack collection.
137 changes: 137 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?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.machinemaker</groupId>
<artifactId>vanillatweaks</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>

<name>VanillaTweaks</name>

<description>A replacement for the VanillaTweaks datapack</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>me.machinemaker.vanillatweaks.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>me.machinemaker.vanillatweaks.locales</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>me.machinemaker.vanillatweaks.bstats</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>mojang</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.machinemaker</groupId>
<artifactId>config-manager</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.25</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId>
<version>0.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</project>
46 changes: 46 additions & 0 deletions src/main/java/me/machinemaker/vanillatweaks/BaseModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package me.machinemaker.vanillatweaks;

import co.aikar.commands.BaseCommand;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;

import java.util.function.Predicate;

public abstract class BaseModule {

public final VanillaTweaks plugin;
private final Predicate<VanillaTweaksModules> shouldEnable;
public boolean registered;

public BaseModule(VanillaTweaks plugin, Predicate<VanillaTweaksModules> shouldEnable) {
this.plugin = plugin;
this.shouldEnable = shouldEnable;
}

public boolean shouldEnable() {
return shouldEnable.test(this.plugin.modules);
}

protected void registerEvents(Listener listener) {
this.plugin.getServer().getPluginManager().registerEvents(listener, plugin);
}

protected void unregisterEvents(Listener listener) {
HandlerList.unregisterAll(listener);
}

protected void registerCommands(BaseModuleCommand<?> command) {
this.plugin.commandManager.registerCommand(command);
}

@Deprecated
protected void unregisterCommands(BaseCommand command) {
this.plugin.commandManager.unregisterCommand(command);
}

abstract public void register();

abstract public void unregister();

public void reload() { }
}
23 changes: 23 additions & 0 deletions src/main/java/me/machinemaker/vanillatweaks/BaseModuleCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.machinemaker.vanillatweaks;

import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.PreCommand;
import org.bukkit.command.CommandSender;

public abstract class BaseModuleCommand<M extends BaseModule> extends BaseCommand {

protected M module;

protected BaseModuleCommand(M module) {
this.module = module;
}

@PreCommand
public boolean checkConfig(CommandSender sender) {
if (!module.shouldEnable()) {
sender.sendMessage(Lang.NOT_ENABLED.err());
return true;
}
return false;
}
}
Loading

0 comments on commit fcfee58

Please sign in to comment.