Using maven and fixed encoding

Also using IDEA.
Also fixes based on code analysis.
This commit is contained in:
Norbi Peti 2018-02-18 01:47:50 +01:00
parent 6127ef829a
commit 448d8a8ce0
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
5 changed files with 117 additions and 86 deletions

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server (build)/spigot-1.9.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

2
.gitignore vendored
View file

@ -1 +1,3 @@
/bin/ /bin/
/.idea/
*.iml

37
pom.xml Normal file
View file

@ -0,0 +1,37 @@
<?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.github.NorbiPeti</groupId>
<artifactId>OneCommandHelper</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot</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.12.2-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

@ -39,7 +39,7 @@ public class Commands implements CommandExecutor
.getBlock(); .getBlock();
if (block.getType() != Material.COMMAND) if (block.getType() != Material.COMMAND)
{ {
sender.sendMessage("§cError! Block underneath must be command block! Found " sender.sendMessage("§cError! Block underneath must be command block! Found "
+ block.getType()); + block.getType());
return true; return true;
} }
@ -49,17 +49,17 @@ public class Commands implements CommandExecutor
{ {
if (args.length == 0) if (args.length == 0)
{ {
sender.sendMessage("§cUsage: /" + alias + " <onecommand>"); sender.sendMessage("§cUsage: /" + alias + " <onecommand>");
return true; //Why use the builtin usage shoing thing return true; //Why use the builtin usage shoing thing
} }
} }
String acmd = acmdb.toString(); String acmd = acmdb.toString();
StringBuilder replace = new StringBuilder("(" + replacecmds[0]); StringBuilder replace = new StringBuilder("(" + replacecmds[0]);
for (int i = 1; i < replacecmds.length; i++) for (int i = 1; i < replacecmds.length; i++)
replace.append("|" + replacecmds[i]); replace.append("|").append(replacecmds[i]);
replace.append(")"); replace.append(")");
acmd = acmd.replaceAll("([^t]|^)( |:| \\/|:\\/)" + replace + " ", acmd = acmd.replaceAll("([^t]|^)( |:| /|:/)" + replace + " ",
"$1$2minecraft:$3 ").replaceAll("\" (\\/*)minecraft:", "$1$2minecraft:$3 ").replaceAll("\" (/*)minecraft:",
"\"$1minecraft:"); //Tellraw "\"$1minecraft:"); //Tellraw
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), acmd); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), acmd);
return true; return true;

View file

@ -6,7 +6,6 @@ public class PluginMain extends JavaPlugin
{ {
@Override @Override
public void onEnable() { public void onEnable() {
//getServer().getPluginManager().registerEvents(new CommandListener(), this);
getCommand("occ").setExecutor(new Commands()); getCommand("occ").setExecutor(new Commands());
} }
} }