Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apple authored and Apple committed May 9, 2022
0 parents commit d04f14c
Show file tree
Hide file tree
Showing 8 changed files with 569 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/
74 changes: 74 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?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.almana</groupId>
<artifactId>DamageIndicator</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>DamageIndicator</name>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
package me.almana.damageindicator.Commands;

import me.almana.damageindicator.DamageIndicator;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

public class DamageIndicatorCommand implements TabExecutor {

private Plugin plugin = DamageIndicator.getPlugin();

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

if (command.getName().equalsIgnoreCase("damageindicator")) {

if (args.length > 0) {

if (args[0].equalsIgnoreCase("disable")) {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Disabling plugin...").color(TextColor.color(243, 141, 102)));
sender.sendMessage(message);
plugin.getServer().getPluginManager().disablePlugin(plugin);
} else if (args[0].equalsIgnoreCase("setItem")) {

if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Set item indicator to ")).color(TextColor.color(197, 233, 127))
.append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
sender.sendMessage(message);

Boolean b = Boolean.parseBoolean(args[1]);
plugin.getConfig().set("ITEM", b);
plugin.getConfig().set("ARMOR_STAND", !b);
} else {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Usage: /damageindicator setitem [true/false]")).color(TextColor.color(243, 141, 102));
sender.sendMessage(message);
}
} else if (args[0].equalsIgnoreCase("setstand")) {

if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Set stand indicator to ")).color(TextColor.color(197, 233, 127))
.append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
sender.sendMessage(message);

Boolean b = Boolean.parseBoolean(args[1]);
plugin.getConfig().set("ITEM", !b);
plugin.getConfig().set("ARMOR_STAND", b);
} else {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Usage: /damageindicator setstand [true/false]")).color(TextColor.color(243, 141, 102));
sender.sendMessage(message);
}
} else if (args[0].equalsIgnoreCase("onlyplayer")) {

if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Set only player to ")).color(TextColor.color(197, 233, 127))
.append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
sender.sendMessage(message);

Boolean b = Boolean.parseBoolean(args[1]);
plugin.getConfig().set("ONLY_PLAYER", b);
} else {

TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
.append(Component.text("Usage: /damageindicator onlyplayer [true/false]")).color(TextColor.color(243, 141, 102));
sender.sendMessage(message);
}
} else if (args[0].equalsIgnoreCase("info")) {

TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
.append(Component.text("Plugin Author: AlmanaX21\n").color(TextColor.color(253, 204, 87)))
.append(Component.text("Server Version: ").color(TextColor.color(253, 204, 87)))
.append(Component.text(plugin.getServer().getVersion()).color(TextColor.color(253, 204, 87)))
.append(Component.text("\n"))
.append(Component.text("--------------------\n").color(TextColor.color(102, 119, 112)))
.append(Component.text("Config\n")).color(TextColor.color(115, 145, 226))
.append(Component.text("Only Player: ").color(TextColor.color(115, 145, 226))).append(Component.text(plugin.getConfig().getBoolean("ONLY_PLAYER")))
.append(Component.newline())
.append(Component.text("X offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(plugin.getConfig().getDouble("LOCATION.X")).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
.append(Component.text("Y offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(plugin.getConfig().getDouble("LOCATION.Y")).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
.append(Component.text("Z offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(plugin.getConfig().getDouble("LOCATION.Z")).color(TextColor.color(115, 145, 226)));
sender.sendMessage(message);
} else if (args[0].equalsIgnoreCase("setoffset")) {
if (args.length == 4) {

double x = Double.parseDouble(args[1]);
double y = Double.parseDouble(args[2]);
double z = Double.parseDouble(args[3]);

plugin.getConfig().set("LOCATION.X", x);
plugin.getConfig().set("LOCATION.Y", y);
plugin.getConfig().set("LOCATION.Z", z);

TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
.append(Component.text("X offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(x).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
.append(Component.text("Y offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(y).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
.append(Component.text("Z offset: ").color(TextColor.color(115, 145, 226)))
.append(Component.text(z).color(TextColor.color(115, 145, 226)));
sender.sendMessage(message);
}
}
}
}
return true;
}

@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {

List<String> arg1 = new ArrayList<>();
List<String> arg2 = new ArrayList<>();
if (args.length == 1) {

arg1.add("disable");
arg1.add("info");
arg1.add("onlyplayer");
arg1.add("setoffset");

return arg1;
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("onlyplayer")) {

arg2.add("true");
arg2.add("false");
return arg2;
}
}
return null;
}
}
Loading

0 comments on commit d04f14c

Please sign in to comment.