-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5823302
Showing
47 changed files
with
2,750 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Project exclude paths | ||
/target/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PlayerSimulator | ||
|
||
Ported to 1.8.8 Spigot from [1.7](https://github.com/GenericPNP/blplugins/blob/master/playersimulator/src/com/probablycoding/bukkit/playersimulator/) made by BadLion, with varity of improvements on the top of that | ||
|
||
PlayerSimulator could make be used in the development, for example, a pressure testing, or some fun activities | ||
|
||
Mostly won't maintain that much because I was just porting this, could probably add some configurations or extra features if requested, I don't know | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?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.allen</groupId> | ||
<artifactId>playersimulator</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.12</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.destroystokyo.paper</groupId> | ||
<artifactId>paperspigot</artifactId> | ||
<version>1.8.8</version> | ||
<scope>system</scope> | ||
<systemPath>${project.basedir}/libraries/paper.jar</systemPath> | ||
</dependency> | ||
</dependencies> | ||
</project> |
33 changes: 33 additions & 0 deletions
33
src/main/java/me/allen/playersimulator/PlayerSimulator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package me.allen.playersimulator; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import me.allen.playersimulator.tps.TPSCheck; | ||
import me.allen.playersimulator.util.command.CommandHandler; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
@Getter | ||
public class PlayerSimulator extends JavaPlugin { | ||
@Getter | ||
private static PlayerSimulator instance; | ||
|
||
private TPSCheck tpsCheck; | ||
|
||
@Setter | ||
private boolean toggle = false; | ||
|
||
@Override | ||
public void onEnable() { | ||
instance = this; | ||
CommandHandler.init(this); | ||
CommandHandler.registerAll(this); | ||
this.tpsCheck = new TPSCheck(); | ||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, this.tpsCheck, 20L, 20L); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
Bukkit.getScheduler().cancelTasks(this); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/me/allen/playersimulator/bot/BotControllerJump.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package me.allen.playersimulator.bot; | ||
|
||
import net.minecraft.server.v1_8_R3.ControllerJump; | ||
import net.minecraft.server.v1_8_R3.EntitySheep; | ||
|
||
public class BotControllerJump | ||
extends ControllerJump { | ||
private final EntityBot a; | ||
private boolean b; | ||
|
||
public BotControllerJump(EntityBot bot) { | ||
super(new EntitySheep(bot.world)); | ||
this.a = bot; | ||
} | ||
|
||
public void a() { | ||
this.b = true; | ||
} | ||
|
||
public void b() { | ||
this.a.f(this.b); | ||
this.b = false; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/main/java/me/allen/playersimulator/bot/BotControllerLook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package me.allen.playersimulator.bot; | ||
|
||
import net.minecraft.server.v1_8_R3.*; | ||
import org.bukkit.craftbukkit.v1_8_R3.TrigMath; | ||
|
||
public class BotControllerLook | ||
extends ControllerLook { | ||
private final EntityBot a; | ||
private float b; | ||
private float c; | ||
private boolean d; | ||
private double e; | ||
private double f; | ||
private double g; | ||
|
||
public BotControllerLook(EntityBot bot) { | ||
super(new EntitySheep(bot.world)); | ||
this.a = bot; | ||
} | ||
|
||
public void a(Entity entity, float f, float f1) { | ||
this.e = entity.locX; | ||
if ((entity instanceof EntityLiving)) { | ||
this.f = (entity.locY + entity.getHeadHeight()); | ||
} else { | ||
this.f = ((entity.getBoundingBox().b + entity.getBoundingBox().e) / 2.0D); | ||
} | ||
this.g = entity.locZ; | ||
this.b = f; | ||
this.c = f1; | ||
this.d = true; | ||
} | ||
|
||
public void a(double d0, double d1, double d2, float f, float f1) { | ||
this.e = d0; | ||
this.f = d1; | ||
this.g = d2; | ||
this.b = f; | ||
this.c = f1; | ||
this.d = true; | ||
} | ||
|
||
public void a() { | ||
this.a.pitch = 0.0F; | ||
if (this.d) { | ||
this.d = false; | ||
double d0 = this.e - this.a.locX; | ||
double d1 = this.f - (this.a.locY + this.a.getHeadHeight()); | ||
double d2 = this.g - this.a.locZ; | ||
double d3 = MathHelper.sqrt(d0 * d0 + d2 * d2); | ||
|
||
float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F; | ||
float f1 = (float) -(TrigMath.atan2(d1, d3) * 180.0D / 3.1415927410125732D); | ||
|
||
|
||
this.a.pitch = a(this.a.pitch, f1, this.c); | ||
this.a.aK = a(this.a.aK, f, this.b); | ||
} else { | ||
this.a.aK = a(this.a.aK, this.a.aI, 10.0F); | ||
} | ||
float f2 = MathHelper.g(this.a.aK - this.a.aI); | ||
if (!this.a.getNavigation().g()) { | ||
if (f2 < -75.0F) { | ||
this.a.aK = (this.a.aI - 75.0F); | ||
} | ||
if (f2 > 75.0F) { | ||
this.a.aK = (this.a.aI + 75.0F); | ||
} | ||
} | ||
} | ||
|
||
private float a(float f, float f1, float f2) { | ||
float f3 = MathHelper.g(f1 - f); | ||
if (f3 > f2) { | ||
f3 = f2; | ||
} | ||
if (f3 < -f2) { | ||
f3 = -f2; | ||
} | ||
return f + f3; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/me/allen/playersimulator/bot/BotControllerMove.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package me.allen.playersimulator.bot; | ||
|
||
import net.minecraft.server.v1_8_R3.ControllerMove; | ||
import net.minecraft.server.v1_8_R3.EntitySheep; | ||
import net.minecraft.server.v1_8_R3.GenericAttributes; | ||
import net.minecraft.server.v1_8_R3.MathHelper; | ||
import org.bukkit.craftbukkit.v1_8_R3.TrigMath; | ||
|
||
public class BotControllerMove | ||
extends ControllerMove { | ||
private final EntityBot a; | ||
private double b; | ||
private double c; | ||
private double d; | ||
private double e; | ||
private boolean f; | ||
|
||
public BotControllerMove(EntityBot bot) { | ||
super(new EntitySheep(bot.world)); | ||
this.a = bot; | ||
this.b = bot.locX; | ||
this.c = bot.locY; | ||
this.d = bot.locZ; | ||
} | ||
|
||
public boolean a() { | ||
return this.f; | ||
} | ||
|
||
public double b() { | ||
return this.e; | ||
} | ||
|
||
public void a(double d0, double d1, double d2, double d3) { | ||
this.b = d0; | ||
this.c = d1; | ||
this.d = d2; | ||
this.e = d3; | ||
this.f = true; | ||
} | ||
|
||
public void c() { | ||
this.a.n(0.0F); | ||
if (this.f) { | ||
this.f = false; | ||
int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D); | ||
double d0 = this.b - this.a.locX; | ||
double d1 = this.d - this.a.locZ; | ||
double d2 = this.c - i; | ||
double d3 = d0 * d0 + d2 * d2 + d1 * d1; | ||
if (d3 >= 2.500000277905201E-7D) { | ||
float f = (float) (TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; | ||
|
||
this.a.yaw = a(this.a.yaw, f, 30.0F); | ||
this.a.k((float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue())); | ||
if ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D)) { | ||
this.a.getControllerJump().a(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
protected float a(float f, float f1, float f2) { | ||
float f3 = MathHelper.g(f1 - f); | ||
if (f3 > f2) { | ||
f3 = f2; | ||
} | ||
if (f3 < -f2) { | ||
f3 = -f2; | ||
} | ||
return f + f3; | ||
} | ||
} |
Oops, something went wrong.