Teleporteurs finis !
This commit is contained in:
parent
1e50db4365
commit
e7c8a990d5
1
Menoria/bin/.gitignore
vendored
Normal file
1
Menoria/bin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/net/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
8
Menoria/config.yml
Normal file
8
Menoria/config.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
teleporteurs:
|
||||||
|
default:
|
||||||
|
world: world
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: 0
|
||||||
|
list:
|
||||||
|
- default
|
@ -1,4 +1,4 @@
|
|||||||
name: Nemoria-Plugin
|
name: Menoria-Plugin
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
main: net.DeltaWings.Nemoria.Main
|
main: net.DeltaWings.Nemoria.Main
|
||||||
author: Aviortheking
|
author: Aviortheking
|
||||||
@ -6,6 +6,10 @@ depend: [Vault, Jobs]
|
|||||||
commands:
|
commands:
|
||||||
playerinfos:
|
playerinfos:
|
||||||
aliases: [pi, pinfos]
|
aliases: [pi, pinfos]
|
||||||
|
settp:
|
||||||
|
aliases: [sttp]
|
||||||
|
deltp:
|
||||||
|
aliases: [dltp]
|
||||||
permissions:
|
permissions:
|
||||||
delta.pi.prefix.color.black:
|
delta.pi.prefix.color.black:
|
||||||
default: false
|
default: false
|
||||||
|
21
Menoria/src/net/DeltaWings/Nemoria/API/Files.java
Normal file
21
Menoria/src/net/DeltaWings/Nemoria/API/Files.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package net.DeltaWings.Nemoria.API;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import net.DeltaWings.Nemoria.Main;
|
||||||
|
|
||||||
|
public class Files {
|
||||||
|
|
||||||
|
public static FileConfiguration getConfig(){
|
||||||
|
return Main.getInstance().getConfig();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveFiles(){
|
||||||
|
Main.getInstance().saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void yolo(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -75,7 +75,7 @@ public class MinecraftToJSON {
|
|||||||
if( yolo == true){
|
if( yolo == true){
|
||||||
if(special(parts[a]) != "none" || colors(parts[a]) != "none"){
|
if(special(parts[a]) != "none" || colors(parts[a]) != "none"){
|
||||||
result.add("{\"text\":\""+one+"\""+color+special[0]+special[1]+special[2]+special[3]+special[4]+"}");
|
result.add("{\"text\":\""+one+"\""+color+special[0]+special[1]+special[2]+special[3]+special[4]+"}");
|
||||||
if(special(parts[a]) != "none" && player.hasPermission("delta.pi.color")){
|
if(special(parts[a]) != "none" && player.hasPermission("menoria.color")){
|
||||||
if(special(parts[a]) == "bold") special[0] = ",\"bold\":true";
|
if(special(parts[a]) == "bold") special[0] = ",\"bold\":true";
|
||||||
if(special(parts[a]) == "italic") special[1] = ",\"italic\":true";
|
if(special(parts[a]) == "italic") special[1] = ",\"italic\":true";
|
||||||
if(special(parts[a]) == "strikethrough") special[2] = ",\"strikethrough\":true";
|
if(special(parts[a]) == "strikethrough") special[2] = ",\"strikethrough\":true";
|
||||||
@ -111,7 +111,7 @@ public class MinecraftToJSON {
|
|||||||
one = "";
|
one = "";
|
||||||
}
|
}
|
||||||
String pcolor = "white";
|
String pcolor = "white";
|
||||||
String perm = "delta.pi.prefix.color.";
|
String perm = "menoria.prefix.color.";
|
||||||
if(player.hasPermission(perm+"black")) pcolor = "black";
|
if(player.hasPermission(perm+"black")) pcolor = "black";
|
||||||
else if(player.hasPermission(perm+"dark_blue")) pcolor = "dark_blue";
|
else if(player.hasPermission(perm+"dark_blue")) pcolor = "dark_blue";
|
||||||
else if(player.hasPermission(perm+"dark_green")) pcolor = "dark_green";
|
else if(player.hasPermission(perm+"dark_green")) pcolor = "dark_green";
|
||||||
|
41
Menoria/src/net/DeltaWings/Nemoria/Commands/DelTP.java
Normal file
41
Menoria/src/net/DeltaWings/Nemoria/Commands/DelTP.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package net.DeltaWings.Nemoria.Commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.DeltaWings.Nemoria.Main;
|
||||||
|
import net.DeltaWings.Nemoria.API.Files;
|
||||||
|
|
||||||
|
public class DelTP implements CommandExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
if(sender instanceof Player){
|
||||||
|
Player p = (Player)sender;
|
||||||
|
if(p.hasPermission("menoria.cmd.deltp")){
|
||||||
|
if(args.length==1){
|
||||||
|
List<String> list = Files.getConfig().getStringList("list");
|
||||||
|
for( int a = 0;a<list.size();a++){
|
||||||
|
if(list.get(a).equalsIgnoreCase(args[0])){
|
||||||
|
list.remove(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Files.getConfig().set("list", list);
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".world", "");
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".x", "");
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".y", "");
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".z", "");
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0], "");
|
||||||
|
p.sendMessage("teleporteur detruis !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Main.getInstance().saveConfig();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,7 +13,6 @@ import com.gamingmesh.jobs.container.JobProgression;
|
|||||||
|
|
||||||
import net.DeltaWings.Nemoria.Main;
|
import net.DeltaWings.Nemoria.Main;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerInfos implements CommandExecutor {
|
public class PlayerInfos implements CommandExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
36
Menoria/src/net/DeltaWings/Nemoria/Commands/SetTP.java
Normal file
36
Menoria/src/net/DeltaWings/Nemoria/Commands/SetTP.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package net.DeltaWings.Nemoria.Commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.DeltaWings.Nemoria.Main;
|
||||||
|
import net.DeltaWings.Nemoria.API.Files;
|
||||||
|
|
||||||
|
public class SetTP implements CommandExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
if(sender instanceof Player){
|
||||||
|
Player p = (Player)sender;
|
||||||
|
if(p.hasPermission("menoria.cmd.settp")){
|
||||||
|
if(args.length==1){
|
||||||
|
List<String> list = Files.getConfig().getStringList("list");
|
||||||
|
list.add(args[0]);
|
||||||
|
Files.getConfig().set("list", list);
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".world", p.getLocation().getWorld().getName());
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".x", p.getLocation().getBlockX());
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".y", p.getLocation().getBlockY());
|
||||||
|
Files.getConfig().set("teleporteurs."+args[0]+".z", p.getLocation().getBlockZ());
|
||||||
|
p.sendMessage("Teleporteur crée");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Main.getInstance().saveConfig();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package net.DeltaWings.Nemoria.Listeners;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import net.DeltaWings.Nemoria.Main;
|
||||||
|
import net.DeltaWings.Nemoria.API.Files;
|
||||||
|
|
||||||
|
public class PlayerPositionListener extends BukkitRunnable {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for(int a = 0; a<Files.getConfig() .getStringList("list").size(); a++){
|
||||||
|
int x = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getStringList("list").get(a)+".x");
|
||||||
|
int y = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getStringList("list").get(a)+".y");
|
||||||
|
int z = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getStringList("list").get(a)+".z");
|
||||||
|
String world = Files.getConfig() .getString("teleporteurs."+Files.getConfig() .getStringList("list").get(a)+".world");
|
||||||
|
for(Player player : Bukkit.getServer().getOnlinePlayers()){
|
||||||
|
Boolean on;
|
||||||
|
if(Files.getConfig() .isSet("players."+player.getName()+".on") == false){
|
||||||
|
Files.getConfig() .set("players."+player.getName()+".on", false);
|
||||||
|
}
|
||||||
|
if(player.getLocation().getWorld().getName().equalsIgnoreCase(world)){
|
||||||
|
if(player.getLocation().getBlockX() == x){
|
||||||
|
if(player.getLocation().getBlockY() == y){
|
||||||
|
if(player.getLocation().getBlockZ() == z){
|
||||||
|
on = true;
|
||||||
|
Main.getInstance().saveConfig();
|
||||||
|
}else{
|
||||||
|
on = false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
on = false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
on = false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
on = false;
|
||||||
|
}
|
||||||
|
if(Files.getConfig().getBoolean("players."+player.getName()+".on") == false){
|
||||||
|
if(on){
|
||||||
|
//make player execute command //bs open Téléportation player
|
||||||
|
Bukkit.dispatchCommand(player, "bs téléportation");
|
||||||
|
Files.getConfig().set("players."+player.getName()+".on", true);
|
||||||
|
Files.getConfig().set("players."+player.getName()+".latest", Files.getConfig() .getStringList("list").get(a));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
int lx = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getString("players."+player.getName()+".latest")+".x");
|
||||||
|
int ly = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getString("players."+player.getName()+".latest")+".y");
|
||||||
|
int lz = Files.getConfig() .getInt("teleporteurs."+Files.getConfig() .getString("players."+player.getName()+".latest")+".z");
|
||||||
|
String lworld = Files.getConfig() .getString("teleporteurs."+Files.getConfig() .getString("players."+player.getName()+".latest")+".world");
|
||||||
|
if(player.getLocation().getWorld().getName().equalsIgnoreCase(lworld)){
|
||||||
|
if(player.getLocation().getBlockX() == lx){
|
||||||
|
if(player.getLocation().getBlockY() == ly){
|
||||||
|
if(player.getLocation().getBlockZ() == lz){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
Files.getConfig().set("players."+player.getName()+".on", false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Files.getConfig().set("players."+player.getName()+".on", false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Files.getConfig().set("players."+player.getName()+".on", false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Files.getConfig().set("players."+player.getName()+".on", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Main.getInstance().saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,15 @@
|
|||||||
package net.DeltaWings.Nemoria;
|
package net.DeltaWings.Nemoria;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.DeltaWings.Nemoria.Commands.DelTP;
|
||||||
import net.DeltaWings.Nemoria.Commands.PlayerInfos;
|
import net.DeltaWings.Nemoria.Commands.PlayerInfos;
|
||||||
|
import net.DeltaWings.Nemoria.Commands.SetTP;
|
||||||
import net.DeltaWings.Nemoria.Listeners.ChatListener;
|
import net.DeltaWings.Nemoria.Listeners.ChatListener;
|
||||||
|
import net.DeltaWings.Nemoria.Listeners.PlayerPositionListener;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
public class Main extends JavaPlugin implements Listener{
|
public class Main extends JavaPlugin implements Listener{
|
||||||
@ -14,25 +18,31 @@ public class Main extends JavaPlugin implements Listener{
|
|||||||
public static Main getInstance() {
|
public static Main getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Main main;
|
||||||
public static Economy eco = null;
|
public static Economy eco = null;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onEnable(){
|
public void onEnable(){
|
||||||
//creation de l'instance
|
//creation de l'instance
|
||||||
instance = this;
|
instance = this;
|
||||||
|
main = Main.getInstance();
|
||||||
setupEconomy();
|
setupEconomy();
|
||||||
//create chatlistener
|
//create chatlistener
|
||||||
getServer().getPluginManager().registerEvents(new ChatListener(), this);
|
getServer().getPluginManager().registerEvents(new ChatListener(), this);
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new PlayerPositionListener(),20,20);
|
||||||
getCommand("PlayerInfos").setExecutor(new PlayerInfos());
|
getCommand("PlayerInfos").setExecutor(new PlayerInfos());
|
||||||
|
getCommand("SetTP").setExecutor(new SetTP());
|
||||||
|
getCommand("DelTP").setExecutor(new DelTP());
|
||||||
|
saveDefaultConfig();
|
||||||
//plugin enabled
|
//plugin enabled
|
||||||
System.out.println("[Player Imformation]Plugin enabled");
|
System.out.println("[Menoria]Plugin enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable(){
|
public void onDisable(){
|
||||||
|
|
||||||
|
|
||||||
//plugin disabled
|
//plugin disabled
|
||||||
System.out.println("[Player Imformation]Plugin disabled");
|
System.out.println("[Menoria]Plugin disabled");
|
||||||
}
|
}
|
||||||
private boolean setupEconomy()
|
private boolean setupEconomy()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user