+ WorldReset and Downloader, even tought authentication is missing
+ command to test particle effects + first parts for hologram gui
This commit is contained in:
parent
1e6b3e3b6d
commit
ad9d1f9235
|
@ -1,3 +1,4 @@
|
|||
/bin/
|
||||
/target
|
||||
/server
|
||||
/build
|
||||
Core.iml
|
8
Core.iml
8
Core.iml
|
@ -31,13 +31,21 @@
|
|||
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TheHolyWaffle:TeamSpeak-3-Java-API:v1.0.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.slikey:EffectLib:5.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: co.aikar:taskchain-bukkit:3.4.3" level="project" />
|
||||
</component>
|
||||
</module>
|
22
pom.xml
22
pom.xml
|
@ -4,6 +4,10 @@
|
|||
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>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<groupId>eu.univento</groupId>
|
||||
<artifactId>Core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
@ -16,6 +20,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
|
@ -48,12 +53,12 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>univentoEU</id>
|
||||
<url>http://dev.joethei.de:8081/repository/public/</url>
|
||||
<url>http://dev.joethei.de:8081/repository/univento-repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -90,6 +95,17 @@
|
|||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.slikey</groupId>
|
||||
<artifactId>EffectLib</artifactId>
|
||||
<version>5.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>taskchain-bukkit</artifactId>
|
||||
<version>3.4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d "build" ]; then
|
||||
echo "Spigot is not downloaded, downloading and building now.."
|
||||
rm -rf build/
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
curl -O https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
|
||||
java -jar BuildTools.jar --rev 1.11
|
||||
|
||||
if [ ! -d "apache-maven-3.2.5" ]; then
|
||||
echo "Maven is not downloaded, downloading now.."
|
||||
curl -o apache-maven-3.2.5.zip http://mirror.metrocast.net/apache//maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip
|
||||
unzip apache-maven-3.2.5.zip
|
||||
rm apache-maven-3.2.5.zip
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
chmod +x ./build/apache-maven-3.2.5/bin/mvn # for some reason this isn't executable by default..
|
||||
fi
|
||||
|
||||
if [ ! -d "server/plugins" ]; then
|
||||
mkdir -p server/plugins
|
||||
fi
|
||||
|
||||
if [ ! -f "server/spigot.jar" ]; then
|
||||
cp build/spigot-1.11.jar server/spigot.jar
|
||||
fi
|
||||
|
||||
if [ ! -f "server/eula.txt" ]; then
|
||||
read -p "Do you accept the Mojang EULA? If not, then exit the program now. Otherwise, press Enter."
|
||||
echo "eula=true" > server/eula.txt
|
||||
fi
|
||||
|
||||
_term() {
|
||||
echo "stop" > /tmp/srv-input
|
||||
exit
|
||||
}
|
||||
|
||||
if [[ ! $(uname) == MING* ]]; then
|
||||
trap _term EXIT # only trap exit event if we're on unix
|
||||
fi
|
||||
|
||||
while true; do
|
||||
if [ -f "build/apache-maven-3.2.5" ]; then
|
||||
./build/apache-maven-3.2.5/bin/mvn clean install # use the maven that spigot build tools downloaded
|
||||
else
|
||||
mvn clean install
|
||||
fi
|
||||
cp target/Core-1.0-SNAPSHOT-jar-with-dependencies.jar server/plugins/Core.jar
|
||||
cd server
|
||||
|
||||
if [[ $(uname) == MING* ]]; then
|
||||
# we're running inside of git bash on windows, which doesn't support everything that unix systems do
|
||||
# so just run the jar and ask the user if they want to continue running after it's done
|
||||
java -jar spigot.jar
|
||||
|
||||
read -n 1 -p "Do you want to recompile and restart the server? (y/n) " value
|
||||
if [ "$value" == "n" ]; then
|
||||
echo "Shutting down process.."
|
||||
exit
|
||||
fi
|
||||
else
|
||||
# set up out process
|
||||
rm -f /tmp/srv-input
|
||||
|
||||
mkfifo /tmp/srv-input
|
||||
cat > /tmp/srv-input &
|
||||
tail -f /tmp/srv-input | java -jar spigot.jar &
|
||||
|
||||
running=true
|
||||
while $running; do
|
||||
read input
|
||||
if [ "$input" == "stop" ]; then
|
||||
running=false
|
||||
echo "stop" > /tmp/srv-input
|
||||
elif [ "$input" == "exit" ]; then
|
||||
running=false
|
||||
echo "stop" > /tmp/srv-input
|
||||
sleep 2
|
||||
exit
|
||||
else
|
||||
echo "$input" > /tmp/srv-input
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Rebuilding project.."
|
||||
sleep 1
|
||||
done
|
|
@ -1,5 +1,7 @@
|
|||
package eu.univento.core;
|
||||
|
||||
import de.slikey.effectlib.EffectLib;
|
||||
import de.slikey.effectlib.EffectManager;
|
||||
import eu.univento.commons.Commons;
|
||||
import eu.univento.commons.server.TPS;
|
||||
import eu.univento.core.antihack.AntiHack;
|
||||
|
@ -14,6 +16,7 @@ import eu.univento.core.api.utils.NettyInjection;
|
|||
import eu.univento.core.commands.*;
|
||||
import eu.univento.core.listeners.*;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@ -35,18 +38,15 @@ import java.util.List;
|
|||
*/
|
||||
public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||
|
||||
//TODO: rewrite database operations from sync MongoDB to async MongoDB
|
||||
@Getter
|
||||
private static EffectLib effectLib = (EffectLib) Bukkit.getPluginManager().getPlugin("EffectLib");
|
||||
|
||||
@Getter
|
||||
private static Core instance;
|
||||
|
||||
public static Core getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static Commons commons;
|
||||
public static Commons getCommons() {
|
||||
return commons;
|
||||
}
|
||||
@Getter
|
||||
private static EffectManager effectManager;
|
||||
|
||||
private ArrayList<String> registeredPlugins = new ArrayList<>();
|
||||
|
||||
|
@ -110,6 +110,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
|||
public void onEnable() {
|
||||
commons = new Commons();
|
||||
registerPlugin(this);
|
||||
effectManager = new EffectManager(this);
|
||||
commons.getLoggingHandler().getCore().info("\n" +
|
||||
"\n" +
|
||||
" \n" +
|
||||
|
@ -139,7 +140,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
|||
"\n");
|
||||
try {
|
||||
Config.writeDefault();
|
||||
} catch (IOException | ClassNotFoundException | SQLException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
instance = this;
|
||||
|
@ -159,7 +160,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
|||
}
|
||||
AntiHack.registerListeners();
|
||||
|
||||
new RunAs(this, "RunAs", "run commons as other player");
|
||||
new RunAs(this, "RunAs", "run commands as other players");
|
||||
new SystemInfo(this, "SystemInfo", "gives info about the server system");
|
||||
new Vanish(this, "vanish", "vanish/unvanish your self");
|
||||
new GameMode(this, "gamemode", "sets your gamemode", "gm");
|
||||
|
@ -167,6 +168,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
|||
new GlobalMute(this, "globalmute", "mutes the server");
|
||||
new ChatClear(this, "chatclear", "clears the chat", "cc");
|
||||
new Timeout(this, "timeout", "timeout other players");
|
||||
new ParticleEffect(this, "particleeffect", "plays particle effects", "pe");
|
||||
|
||||
PluginMessenger pluginMessenger = new PluginMessenger();
|
||||
NetworkData networkData = new NetworkData();
|
||||
|
|
|
@ -27,10 +27,10 @@ public class Config {
|
|||
* @throws SQLException SQL server not available or throwing error
|
||||
* @throws IOException I/O failed
|
||||
*/
|
||||
public static void writeDefault() throws ClassNotFoundException, SQLException, IOException {
|
||||
public static void writeDefault() throws IOException {
|
||||
//editable messages will be set here, but do not edit this messages.
|
||||
|
||||
//seting the default MySQL config.
|
||||
//setting the default MySQL config.
|
||||
cfg.addDefault("MySQL.Host", "hostname");
|
||||
cfg.addDefault("MySQL.Port", "3306");
|
||||
cfg.addDefault("MySQL.DB", "core");
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Hologram {
|
|||
}
|
||||
}
|
||||
|
||||
private void showAll() {
|
||||
public void showAll() {
|
||||
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
||||
for (EntityArmorStand armor : entitylist) {
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
|
@ -66,7 +66,7 @@ public class Hologram {
|
|||
}
|
||||
}
|
||||
|
||||
private void hideAll() {
|
||||
public void hideAll() {
|
||||
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
||||
for (EntityArmorStand armor : entitylist) {
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
|
@ -75,6 +75,12 @@ public class Hologram {
|
|||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
for(EntityArmorStand armorStand : entitylist) {
|
||||
armorStand.die();
|
||||
}
|
||||
}
|
||||
|
||||
private void create() {
|
||||
double DISTANCE = 0.25D;
|
||||
EntityArmorStand stand = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(),this.location.getX(), this.location.getY(),this.location.getZ());
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package eu.univento.core.api.game;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public class GameTimer extends BukkitRunnable{
|
||||
|
||||
private Plugin plugin;
|
||||
private int time;
|
||||
private int minPlayers;
|
||||
private GameTimer following;
|
||||
|
||||
public GameTimer(Plugin plugin, GameTimer following, int time, int minPlayers) {
|
||||
this.plugin = plugin;
|
||||
this.following = following;
|
||||
this.time = time;
|
||||
this.minPlayers = minPlayers;
|
||||
runTaskTimer(plugin, 20L, 20L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(PlayerManager.size() >= minPlayers) {
|
||||
time--;
|
||||
|
||||
}
|
||||
if(time == 0) {
|
||||
if(PlayerManager.size() > minPlayers) {
|
||||
this.cancel();
|
||||
following.run();
|
||||
}else {
|
||||
this.cancel();
|
||||
//TODO: reset timer
|
||||
this.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public int getMinPlayers() {
|
||||
return minPlayers;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram;
|
||||
|
||||
import eu.univento.core.api.gui.hologram.components.PlayerGUIPage;
|
||||
import eu.univento.core.api.gui.hologram.components.PlayerGUIPageModel;
|
||||
import eu.univento.core.api.gui.hologram.components.PlayerGUITextBoxComponent;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public class HologramData {
|
||||
|
||||
private CustomPlayer player;
|
||||
private PlayerGUIPage playerGUIPage;
|
||||
private PlayerGUIPageModel model;
|
||||
private PlayerGUIPageModel prevModel;
|
||||
private PlayerGUIPage playerPreviousGUIContainer;
|
||||
private PlayerGUIPage playerFocusedContainer;
|
||||
private PlayerGUITextBoxComponent textBoxEditor;
|
||||
//private PlayerGUIValueScrollerComponent valueScrollerEditor;
|
||||
private boolean isSneaking;
|
||||
|
||||
public HologramData(CustomPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public class HologramGUI {
|
||||
|
||||
public HologramGUI() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ComponentPosition {
|
||||
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public ComponentPosition(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ComponentProperties {
|
||||
|
||||
private String id;
|
||||
private String pageId;
|
||||
private ComponentPosition position;
|
||||
private String label;
|
||||
private double labelDistance;
|
||||
private boolean showLabel;
|
||||
private boolean hidden;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.Hologram;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public abstract class GUIComponent {
|
||||
protected String id;
|
||||
protected String pageId;
|
||||
protected ComponentPosition position;
|
||||
protected String label;
|
||||
protected double labelDistance;
|
||||
protected boolean showLabel;
|
||||
protected boolean hidden;
|
||||
protected Hologram[] holograms;
|
||||
|
||||
public abstract PlayerGUIComponent initPlayerGUIComponent(Player player);
|
||||
|
||||
public abstract void updateIncrement();
|
||||
|
||||
public abstract String[] updateComponentLine(Player player);
|
||||
|
||||
public abstract double getDisplayDistance();
|
||||
|
||||
public abstract double getLineHeight();
|
||||
|
||||
public abstract GUIComponent clone();
|
||||
|
||||
public ComponentProperties cloneProperties() {
|
||||
return new ComponentProperties(this.id, this.pageId, this.position, this.label, this.labelDistance, this.showLabel, this.hidden);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public class GUIPage {
|
||||
|
||||
private HashMap<String, GUIComponent> components;
|
||||
private String id;
|
||||
private ItemStack item;
|
||||
private String itemName;
|
||||
private boolean closeOnPlayerMove;
|
||||
private boolean closeOnPlayerItemSwitch;
|
||||
|
||||
public GUIPage(HashMap<String, GUIComponent> components, String id, ItemStack item, String itemName, boolean closeOnPlayerMove, boolean closeOnPlayerItemSwitch) {
|
||||
this.components = components;
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
this.itemName = itemName;
|
||||
this.closeOnPlayerMove = closeOnPlayerMove;
|
||||
this.closeOnPlayerItemSwitch = closeOnPlayerItemSwitch;
|
||||
}
|
||||
|
||||
public PlayerGUIPage getPlayerGUIPage(CustomPlayer player) {
|
||||
PlayerGUIPage page = player.getHologramData().getPlayerGUIPage();
|
||||
if(page.getPage().getId().equals(id)) {
|
||||
return page;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public abstract class GUIPageModel {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public abstract interface IValueHolder {
|
||||
public abstract String getValue();
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.Hologram;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Data
|
||||
public abstract class PlayerGUIComponent {
|
||||
protected CustomPlayer player;
|
||||
protected GUIComponent component;
|
||||
protected Location location;
|
||||
protected String label;
|
||||
protected boolean focused = false;
|
||||
protected String[] lines;
|
||||
protected int[] componentIds;
|
||||
protected Location[] armorStandLocations;
|
||||
protected boolean hidden;
|
||||
|
||||
public PlayerGUIComponent(CustomPlayer player, GUIComponent component) {
|
||||
this.player = player;
|
||||
this.component = component;
|
||||
this.hidden = component.isHidden();
|
||||
}
|
||||
|
||||
public abstract void updateComponentLines();
|
||||
|
||||
public abstract void spawnEntities(Location location, boolean param);
|
||||
|
||||
public abstract void updateLocation(Location location, boolean param);
|
||||
|
||||
public void destroyArmorStands() {
|
||||
for(Hologram hologram : component.getHolograms()) {
|
||||
hologram.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderLabel(Location location, Vector vector, boolean param) {
|
||||
if(component.getLabel() != null) {
|
||||
double distance = component.getLabelDistance();
|
||||
Location loc = player.getLocation();
|
||||
if(param) {
|
||||
loc = this.location;
|
||||
distance = 15.0D;
|
||||
}
|
||||
location = calculateArmorStandLocation(-1, loc, vector, distance, component.getLineHeight(), component.getPosition().getY(), component.getPosition().getX());
|
||||
if(param) {
|
||||
this.location.setX(this.location.getX() + vector.getX() * -15.0D);
|
||||
this.location.setY(this.location.getY() + vector.getY() * -15.0D);
|
||||
}
|
||||
String label = component.getLabel();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateLabelText() {
|
||||
|
||||
}
|
||||
|
||||
protected void updateLabelLocation(Location location, Vector vector, boolean param) {
|
||||
|
||||
}
|
||||
|
||||
protected Location calculateArmorStandLocation(int param, Location location, Vector vector, double double1, double double2, double double3, double double4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Vector customNormalize(Vector vector) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Vector rotateAboutYAxis(Vector vector, double param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void focusComponent(boolean param) {
|
||||
|
||||
}
|
||||
|
||||
public void unfocusComponent(boolean param) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public class PlayerGUIPage {
|
||||
protected CustomPlayer player;
|
||||
protected GUIPage page;
|
||||
protected Location location;
|
||||
protected HashMap<String, PlayerGUIComponent> components;
|
||||
protected HashMap<String, GUIComponent> guiComponents;
|
||||
|
||||
public PlayerGUIPage(CustomPlayer player, HashMap<String, PlayerGUIComponent> components, Location location, GUIPage page) {
|
||||
this.player = player;
|
||||
this.components = components;
|
||||
this.location = location;
|
||||
this.page = page;
|
||||
this.guiComponents = new HashMap<>();
|
||||
}
|
||||
|
||||
public void updateIncrement() {
|
||||
for(GUIComponent component : guiComponents.values()) {
|
||||
component.updateIncrement();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderComponent(GUIComponent component) {
|
||||
PlayerGUIComponent playerGUIComponent = this.components.get(component.getId());
|
||||
if(playerGUIComponent != null) {
|
||||
removeComponent(component.getId());
|
||||
}
|
||||
PlayerGUIComponent guiComponent = component.initPlayerGUIComponent(player);
|
||||
guiComponent.setHidden(false);
|
||||
guiComponent.spawnEntities(location, this instanceof StationaryPlayerGUIPage);
|
||||
}
|
||||
|
||||
public void removeComponent(String param) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public abstract class PlayerGUIPageModel {
|
||||
protected GUIPage page;
|
||||
protected CustomPlayer player;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public class PlayerGUITextBoxComponent extends PlayerGUIValueBoxComponent implements IValueHolder{
|
||||
|
||||
public PlayerGUITextBoxComponent(CustomPlayer player, GUIComponent component) {
|
||||
super(player, component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateComponentLines() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnEntities(Location location, boolean param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocation(Location location, boolean param) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public abstract class PlayerGUIValueBoxComponent extends PlayerGUIComponent{
|
||||
|
||||
public PlayerGUIValueBoxComponent(CustomPlayer player, GUIComponent component) {
|
||||
super(player, component);
|
||||
}
|
||||
|
||||
public void focusComponent(boolean focus) {
|
||||
if((component.getLabel() != null) && (!component.isShowLabel())) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.gui.hologram.components;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
public class StationaryPlayerGUIPage extends PlayerGUIPage{
|
||||
|
||||
@Getter
|
||||
private String stationaryDisplayID;
|
||||
|
||||
public StationaryPlayerGUIPage(CustomPlayer player, HashMap<String, PlayerGUIComponent> components, Location location, GUIPage page, String param) {
|
||||
super(player, components, location, page);
|
||||
this.stationaryDisplayID = param;
|
||||
}
|
||||
|
||||
public void renderComponents() {
|
||||
for(PlayerGUIComponent component : components.values()) {
|
||||
component.spawnEntities(location, true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if((object instanceof StationaryPlayerGUIPage)) {
|
||||
StationaryPlayerGUIPage page = (StationaryPlayerGUIPage) object;
|
||||
return page.getPage().getId().equals(this.getPage().getId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -11,11 +11,13 @@ import eu.univento.core.api.Utils;
|
|||
import eu.univento.core.api.chat.DefaultFontInfo;
|
||||
import eu.univento.core.api.effects.Blackscreen;
|
||||
import eu.univento.core.api.effects.Effects;
|
||||
import eu.univento.core.api.gui.hologram.HologramData;
|
||||
import eu.univento.core.api.languages.Messages;
|
||||
import eu.univento.core.api.server.ServerSettings;
|
||||
import eu.univento.core.api.shop.ShopItem;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.server.v1_11_R1.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Material;
|
||||
|
@ -55,12 +57,16 @@ public class CustomPlayer extends CraftPlayer {
|
|||
|
||||
private final GameProfile gameProfile;
|
||||
|
||||
@Getter
|
||||
private HologramData hologramData;
|
||||
|
||||
private CustomPlayer(Player player) {
|
||||
super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle());
|
||||
DATABASE_PLAYER = new DatabasePlayer(Core.getCommons(), player.getUniqueId());
|
||||
PLAYERS.put(player.getUniqueId(), this);
|
||||
PLAYER = player;
|
||||
gameProfile = ((CraftPlayer) player).getProfile();
|
||||
hologramData = new HologramData(this);
|
||||
}
|
||||
|
||||
public void onLeave() {
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.api.world;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public class WorldReset {
|
||||
|
||||
private String name;
|
||||
|
||||
public WorldReset(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public World reset() {
|
||||
World world = Bukkit.getWorld(name);
|
||||
if(world.getName().equals("world")) return null;
|
||||
for(Player player : world.getPlayers())
|
||||
player.teleport(Bukkit.getWorld("world").getSpawnLocation());
|
||||
|
||||
Bukkit.unloadWorld(world, true);
|
||||
try {
|
||||
File file = new File(name);
|
||||
FileUtils.deleteDirectory(file);
|
||||
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
||||
HttpGet httpGet = new HttpGet("https://download.univento.eu/world" + name);
|
||||
httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0");
|
||||
httpGet.addHeader("Referer", "https://www.google.com");
|
||||
|
||||
try {
|
||||
CloseableHttpResponse httpResponse = httpClient.execute(httpGet);
|
||||
HttpEntity fileEntity = httpResponse.getEntity();
|
||||
|
||||
if (fileEntity != null) {
|
||||
FileUtils.copyInputStreamToFile(fileEntity.getContent(), new File(name));
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
httpGet.releaseConnection();
|
||||
|
||||
//FileUtils.copyURLToFile(new URL(""), file);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Bukkit.createWorld(new WorldCreator(name));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright (c) 2016 univento.eu - All rights reserved
|
||||
* You are not allowed to use, distribute or modify this code
|
||||
*/
|
||||
|
||||
package eu.univento.core.commands;
|
||||
|
||||
import de.slikey.effectlib.effect.*;
|
||||
import eu.univento.core.Core;
|
||||
import eu.univento.core.api.AutoCommand;
|
||||
import eu.univento.core.api.languages.Messages;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @version 0.1
|
||||
*/
|
||||
public class ParticleEffect extends AutoCommand<Core> {
|
||||
|
||||
public ParticleEffect(Core plugin, String command, String description, String... aliases) {
|
||||
super(plugin, command, description, aliases);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||
if(sender instanceof Player) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
||||
if(args.length == 0) p.sendMessage("§cNot enough arguments");
|
||||
if(args.length == 1) {
|
||||
String arg = args[0];
|
||||
if(arg.equalsIgnoreCase("ball")) {
|
||||
AnimatedBallEffect effect = new AnimatedBallEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("arc")) {
|
||||
ArcEffect effect = new ArcEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("atom")) {
|
||||
AtomEffect effect = new AtomEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("bigbang")) {
|
||||
BigBangEffect effect = new BigBangEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("bleed")) {
|
||||
BleedEffect effect = new BleedEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("circle")) {
|
||||
CircleEffect effect = new CircleEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("cloud")) {
|
||||
CloudEffect effect = new CloudEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.start();
|
||||
}
|
||||
if(arg.equalsIgnoreCase("text")) {
|
||||
TextEffect effect = new TextEffect(Core.getEffectManager());
|
||||
effect.setLocation(p.getLocation());
|
||||
effect.text = "Hallo du da";
|
||||
effect.start();
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import eu.univento.core.api.server.ServerSettings;
|
|||
import eu.univento.core.api.shop.ShopItem;
|
||||
import eu.univento.core.api.shop.ShopMenu;
|
||||
import eu.univento.core.api.shop.entity.ShopVillager;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Villager;
|
||||
|
|
|
@ -75,7 +75,6 @@ public class Events implements Listener {
|
|||
final double dx = Math.abs(dir.getX());
|
||||
final double dz = Math.abs(dir.getZ());
|
||||
if ((dx == 0.0) && (dz == 0.0)) {
|
||||
// Special case probably never happens
|
||||
dir.setX(0.001);
|
||||
}
|
||||
if ((dx < 3.0) && (dz < 3.0)) {
|
||||
|
@ -84,7 +83,6 @@ public class Events implements Listener {
|
|||
newV.setY(0);
|
||||
orb.setVelocity(newV);
|
||||
if ((dx < 1.0) && (dz < 1.0)) {
|
||||
// maybe oLoc
|
||||
orb.teleport(oLoc.clone().add(nDir.multiply(1.0)), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
}
|
||||
if ((dx < 0.5) && (dz < 0.5)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class PluginMessenger implements PluginMessageListener {
|
|||
}
|
||||
assert string != null;
|
||||
if(string.endsWith("squidhq")) {
|
||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||
p.warn(WarnReason.SQUIDHQ, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||
}
|
||||
|
||||
if (channel.equals("WDL|INIT")) {
|
||||
|
@ -57,8 +57,7 @@ public class PluginMessenger implements PluginMessageListener {
|
|||
p.sendPluginMessage(Core.getInstance(), "WDL|CONTROL", output.toByteArray());
|
||||
}
|
||||
if (channel.equals("PERMISSIONSREPL") && string.contains("mod.worlddownloader")) {
|
||||
//TODO: change to real warn reason
|
||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||
p.warn(WarnReason.WDL, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||
p.sendMessage(p.getDatabasePlayer().getLanguage().getWord("Prefix") + p.getDatabasePlayer().getLanguage().getWord("Hack.WorldDownloader"));
|
||||
}
|
||||
if(channel.equals("5zig_Set")) {
|
||||
|
@ -83,7 +82,6 @@ public class PluginMessenger implements PluginMessageListener {
|
|||
ByteArrayDataOutput output5 = ByteStreams.newDataOutput();
|
||||
output5.write(0x10);
|
||||
p.sendPluginMessage(Core.getInstance(), "5zig_Set", output5.toByteArray());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue