Fixed some shit
This commit is contained in:
parent
98c787afb0
commit
f86d574b5d
1 changed files with 18 additions and 8 deletions
|
@ -1,18 +1,13 @@
|
||||||
package nl.iobyte.themeparkconnector.listeners;
|
package nl.iobyte.themeparkconnector.listeners;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import nl.iobyte.themepark.ThemePark;
|
import nl.iobyte.themepark.ThemePark;
|
||||||
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
||||||
import nl.iobyte.themepark.api.message.MessageKey;
|
|
||||||
import nl.iobyte.themepark.utils.LocationUtil;
|
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
|
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
||||||
import nl.iobyte.themeparkconnector.api.config.enums.StorageKey;
|
import nl.iobyte.themeparkconnector.api.config.enums.StorageKey;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -68,12 +63,27 @@ public class RideOperatorListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if(!ThemePark.getInstance().getAPI().getAttractionService().hasAttraction(id)) {
|
Attraction attraction = ThemePark.getInstance().getAPI().getAttractionService().getAttractionByName(id);
|
||||||
|
if(attraction == null) {
|
||||||
player.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4No attraction with ID: &f"+id));
|
player.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4No attraction with ID: &f"+id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.dispatchCommand(player, "tpc connect "+id);
|
AttractionOperator operator = ThemeParkConnector.getInstance().getAPI().getOperatorService().getOperator(attraction.getID());
|
||||||
|
if(operator == null) {
|
||||||
|
player.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4There is no operator for this attraction"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientConnection client = ThemeParkConnector.getInstance().getAPI().getNetworkingService().getClient(
|
||||||
|
player.getUniqueId()
|
||||||
|
);
|
||||||
|
if(!operator.canClientConnect(client)) {
|
||||||
|
player.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4You can't connect to the operator of this attraction"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.publishURL(attraction.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue