My current build
This commit is contained in:
parent
f1034a986f
commit
137f394830
11 changed files with 229 additions and 1 deletions
20
.classpath
Normal file
20
.classpath
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@
|
|||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
/target/
|
||||
|
|
23
.project
Normal file
23
.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>unconflicted-Hardcore</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
3
.settings/org.eclipse.core.resources.prefs
Normal file
3
.settings/org.eclipse.core.resources.prefs
Normal file
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
encoding/src=UTF-8
|
5
.settings/org.eclipse.jdt.core.prefs
Normal file
5
.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
54
pom.xml
Normal file
54
pom.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<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.TBMCPlugins</groupId>
|
||||
<artifactId>Hardcore</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository> <!-- This repo fixes issues with transitive dependencies -->
|
||||
<id>jcenter</id>
|
||||
<url>http://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
87
src/iie/BoundaryListener.java
Normal file
87
src/iie/BoundaryListener.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package iie;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class BoundaryListener implements Listener {
|
||||
|
||||
HelloWorldPlugin plugin;
|
||||
public BoundaryListener(HelloWorldPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
int minX = 666; // MAP BORDER COORDS HERE
|
||||
int maxX = 2366;
|
||||
int minZ = -1520;
|
||||
int maxZ = 280;
|
||||
|
||||
public boolean OutOfBounds (Player player, int x, int z){
|
||||
boolean isOutOfBounds = false;
|
||||
x = player.getLocation().getBlockX();
|
||||
z = player.getLocation().getBlockZ();
|
||||
if (x < minX || x > maxX || z < minZ || z > maxZ) isOutOfBounds = true;
|
||||
return isOutOfBounds;
|
||||
}
|
||||
|
||||
public boolean FurtherOut (Player player, int x, int z){
|
||||
boolean isFurtherOut = false;
|
||||
x = player.getLocation().getBlockX();
|
||||
z = player.getLocation().getBlockZ();
|
||||
if (x < minX - 50 || x > maxX + 50 || z < minZ - 50 || z > maxZ + 50) isFurtherOut = true;
|
||||
return isFurtherOut;
|
||||
}
|
||||
|
||||
public static AbstractMap<String, Integer> moveDelay = new HashMap<String, Integer>();
|
||||
public static AbstractMap<String, Boolean> boundaryWarning = new HashMap<String, Boolean>();
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerMove(PlayerMoveEvent event){
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
String playername = player.getName();
|
||||
World world = player.getWorld();
|
||||
String worldname = world.getName();
|
||||
if (playername == "iie") world.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP,1F,1F);
|
||||
|
||||
new Thread(() -> {
|
||||
|
||||
|
||||
|
||||
if (worldname != "hardcore") return;
|
||||
|
||||
int currentTime = (int) (System.currentTimeMillis()/1000);
|
||||
int playerTime = moveDelay.get(playername);
|
||||
boolean playerWarning = boundaryWarning.get(playername);
|
||||
int x = player.getLocation().getBlockX();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
boolean OutOfBounds = OutOfBounds(player, x, z);
|
||||
|
||||
|
||||
if (playerWarning && currentTime > playerTime + 1 && OutOfBounds){
|
||||
world.playSound(player.getLocation(), Sound.AMBIENT_CAVE,1F,1F);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ("tellraw " + playername + " {\"text\":\"...out of bounds...\",\"color\":\"dark_red\"}"));
|
||||
boundaryWarning.put(playername, false);
|
||||
} else if (playerWarning && currentTime > playerTime && FurtherOut(player, x, z)){
|
||||
world.playSound(player.getLocation(), Sound.AMBIENT_CAVE,1F,1F);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ("tellraw " + playername + " {\"text\":\"...out of bounds...\",\"color\":\"dark_red\"}"));
|
||||
boundaryWarning.put(playername, false);
|
||||
if (playername == "iie") ;
|
||||
} else if (!playerWarning && !OutOfBounds) boundaryWarning.put(playername, true);
|
||||
|
||||
|
||||
moveDelay.put(playername, currentTime);
|
||||
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
}
|
14
src/iie/ChatFormattingListener.java
Normal file
14
src/iie/ChatFormattingListener.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package iie;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class ChatFormattingListener implements Listener{
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void AsyncPlayerChatEvent (){
|
||||
|
||||
}
|
||||
|
||||
}
|
5
src/iie/EnderchestListener.java
Normal file
5
src/iie/EnderchestListener.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package iie;
|
||||
|
||||
public class EnderchestListener {
|
||||
|
||||
}
|
|
@ -2,8 +2,10 @@ package iie;
|
|||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
@ -11,13 +13,18 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||
|
||||
public class HelloWorldPlugin extends JavaPlugin {
|
||||
|
||||
public static Player iie;
|
||||
|
||||
public static Scoreboard board;
|
||||
public static Objective hardcoreTimeDead;
|
||||
public static Objective hardcoreInvite;
|
||||
public static Objective hardcoreOutBound;
|
||||
public static AbstractMap<String,String> deathMap = new HashMap<String,String>();
|
||||
|
||||
public void onEnable(){
|
||||
|
||||
iie = Bukkit.getServer().getOfflinePlayer((UUID) UUID.fromString("633d0de1-4a67-46ff-bd8a-004fa8ce4858")).getPlayer();
|
||||
|
||||
board = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
|
||||
if (board.getObjective("hardcoreTimeDead") != null){ //null check hardcoreTimeDead
|
||||
hardcoreTimeDead = board.getObjective("hardcoreTimeDead");
|
||||
|
@ -29,10 +36,16 @@ public class HelloWorldPlugin extends JavaPlugin {
|
|||
}else{
|
||||
hardcoreInvite = board.registerNewObjective("hardcoreInvite", "dummy");
|
||||
}
|
||||
if (board.getObjective("hardcoreOutBound") != null){ //null check hardcoreOutBound
|
||||
hardcoreOutBound = board.getObjective("hardcoreOutBound");
|
||||
}else{
|
||||
hardcoreOutBound = board.registerNewObjective("hardcoreOutBound", "dummy");
|
||||
}
|
||||
|
||||
registerCommands();
|
||||
getServer().getPluginManager().registerEvents(new JoinListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new DeathListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new BoundaryListener(this), this);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ public class JoinListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
BoundaryListener.moveDelay.put(playername, currentTime);
|
||||
BoundaryListener.boundaryWarning.put(playername, true);
|
||||
|
||||
|
||||
//HelloWorldPlugin.deathMap.put(playername, String.valueOf(HelloWorldPlugin.hardcoreTimeDead.getScore(playername).getScore()));
|
||||
|
||||
|
|
Loading…
Reference in a new issue