Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMrEngMan committed Jan 18, 2021
0 parents commit 5a7fb22
Show file tree
Hide file tree
Showing 9 changed files with 508 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# 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/

.DS_Store.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## ExplodeMe
A very simple Minecraft Spigot plugin to prevent other players from being damaged when players explode end crystals, beds, or respawn anchors. Damage will still be applied to the player who caused the explosion (as well as the surrounding blocks and entities).

Use the `/emreload` command to reload config file.
62 changes: 62 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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>com.MrEngMan.ExplodeMe</groupId>
<artifactId>ExplodeMe</artifactId>
<version>1.0</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<finalName>${project.name}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
<version>3.8.1</version>
</plugin>
</plugins>

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<targetPath>.</targetPath>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
</includes>
</resource>
</resources>
</build>

</project>
95 changes: 95 additions & 0 deletions src/main/java/com/MrEngMan/ExplodeMe/ExplodeMe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.MrEngMan.ExplodeMe;

import com.MrEngMan.ExplodeMe.listeners.Listeners;
import com.MrEngMan.ExplodeMe.util.Utils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;

import java.io.File;

public class ExplodeMe extends JavaPlugin implements Listener {

private static ExplodeMe plugin;

private boolean debug;
private float blockExplodeCheckRadius;

// When plugin is first enabled
@SuppressWarnings("static-access")
@Override
public void onEnable() {
this.plugin = this;
reloadTheConfig();

// Register stuff
getCommand("emreload").setExecutor(new ReloadCommandHandler());
Bukkit.getPluginManager().registerEvents(new Listeners(), this);

}

public void reloadTheConfig() {

// Generate the config file if it was deleted
if (!(new File(this.getDataFolder(), "config.yml").exists())) {
this.saveDefaultConfig();
}

// Load new config values
reloadConfig();
debug = getConfig().getBoolean("debug", false);
blockExplodeCheckRadius = getConfig().getInt("block-explode-check-radius", 10);

}

public class ReloadCommandHandler implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

// Player issued command
if (sender instanceof Player) {
Player player = (Player) sender;

// Make sure they have permission
if (player.hasPermission("emreload.reload")) {
plugin.reloadTheConfig();
player.sendMessage(Utils.SendChatMessage(plugin.getConfig().getString("reloaded-message")));
} else {
player.sendMessage(Utils.SendChatMessage(plugin.getConfig().getString("no-permission-message")));
}

}

// Console issued command
else if (sender instanceof ConsoleCommandSender) {
plugin.reloadTheConfig();
ConsoleCommandSender console = getServer().getConsoleSender();
console.sendMessage(Utils.SendChatMessage(plugin.getConfig().getString("reloaded-message")));
}

return true;
}

}

// Getters
public static ExplodeMe getPlugin() {
return plugin;
}

public float getBlockExplodeCheckRadius() {
return blockExplodeCheckRadius;
}

public boolean isDebugEnabled() {
return debug;
}


}
Loading

0 comments on commit 5a7fb22

Please sign in to comment.