mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 18:46:35 +01:00
Various different updates including the warp effects
This commit is contained in:
parent
a68014c5e6
commit
08d2f60e64
@ -31,6 +31,20 @@ StopWaterFlow: true
|
||||
ShowSelectionBlockID: STAINED_GLASS
|
||||
ShowSelectionBlockData: 14
|
||||
|
||||
# WarpEffect
|
||||
# 0 = disabled(no particles)
|
||||
# 1 = Eye of ender explode efffect(loads of portal particles)
|
||||
# 2 = Explosion particles
|
||||
warpParticles: 1
|
||||
|
||||
# WarpSound generally suggested to keep the same as warpeffect but can usually be used for just the sound and no particle effects
|
||||
# 0 = disabled(no sound)
|
||||
# 1 = Enderman Warp Sound
|
||||
# 2 = Explosion
|
||||
warpSound: 1
|
||||
|
||||
|
||||
|
||||
|
||||
# This changes how long the show seletion lasts in seconds
|
||||
|
||||
|
@ -10,9 +10,11 @@ import com.sekwah.advancedportals.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.portalcontrolls.Portal;
|
||||
|
||||
public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
new Assets(this);
|
||||
|
||||
// Opens a channel that messages bungeeCord
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
|
||||
|
15
Advanced Portals/src/com/sekwah/advancedportals/Assets.java
Normal file
15
Advanced Portals/src/com/sekwah/advancedportals/Assets.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.sekwah.advancedportals;
|
||||
|
||||
public class Assets {
|
||||
|
||||
public static int currentWarpParticles = 0;
|
||||
|
||||
public static int currentWarpSound = 0;
|
||||
|
||||
public Assets(AdvancedPortalsPlugin plugin) {
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
|
||||
currentWarpParticles = config.getConfig().getInt("warpParticles");
|
||||
currentWarpSound = config.getConfig().getInt("warpSound");
|
||||
}
|
||||
|
||||
}
|
@ -115,7 +115,7 @@ public class Listeners implements Listener {
|
||||
public void run(){
|
||||
finalplayer.removeMetadata("HasWarped", plugin);
|
||||
}
|
||||
}, 20);
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import com.mysql.jdbc.Util;
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
|
||||
public class Destination {
|
||||
|
||||
@ -108,6 +109,8 @@ public class Destination {
|
||||
loc.setPitch((float) config.getConfig().getDouble(name + ".pos.pitch"));
|
||||
loc.setYaw((float) config.getConfig().getDouble(name + ".pos.yaw"));
|
||||
|
||||
WarpEffects.activateParticles(player);
|
||||
WarpEffects.activateSound(player);
|
||||
Chunk c = loc.getChunk();
|
||||
Entity riding = player.getVehicle();
|
||||
if (!c.isLoaded()) c.load();
|
||||
@ -118,15 +121,17 @@ public class Destination {
|
||||
riding.setPassenger(player);
|
||||
}
|
||||
else{
|
||||
player.teleport(loc);
|
||||
player.teleport(loc);
|
||||
}
|
||||
WarpEffects.activateParticles(player);
|
||||
WarpEffects.activateSound(player);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
if(senderror){
|
||||
player.sendMessage("§cThe destination you are trying to warp to seems to be linked to a world that doesn't exist!");
|
||||
player.sendMessage("§c[§7AdvancedPortals§c] The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' is linked to the world "
|
||||
+ config.getConfig().getString(name + ".world") + " which doesnt seem to exist any more!");
|
||||
}
|
||||
@ -135,7 +140,7 @@ public class Destination {
|
||||
}
|
||||
else{
|
||||
if(senderror){
|
||||
player.sendMessage("§cThere has been a problem warping you to the selected destination!");
|
||||
player.sendMessage("§c[§7AdvancedPortals§c] There has been a problem warping you to the selected destination!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or that destination doesn't exist!");
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package com.sekwah.advancedportals.effects;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Instrument;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Note.Tone;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sekwah.advancedportals.Assets;
|
||||
|
||||
public class WarpEffects {
|
||||
|
||||
public static void activateParticles(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
World world = player.getWorld();
|
||||
switch (Assets.currentWarpParticles){
|
||||
case 1:
|
||||
for(int i = 0; i < 10; i++){
|
||||
world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
|
||||
}
|
||||
loc.add(0D, 1D, 0D);
|
||||
for(int i = 0; i < 10; i++){
|
||||
world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void activateSound(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
World world = player.getWorld();
|
||||
switch (Assets.currentWarpParticles){
|
||||
case 1:
|
||||
world.playSound(loc, Sound.ENDERMAN_TELEPORT, 1F, 1F);
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -234,6 +234,8 @@ public class Portal {
|
||||
triggerBlockType = Material.PORTAL;
|
||||
}
|
||||
|
||||
// TODO add a for loop which scans through the addArgs and adds them to the config so that the application can use them
|
||||
|
||||
String result = create(pos1, pos2, name, destination, triggerBlockType, addArgs);
|
||||
|
||||
loadPortals();
|
||||
@ -320,7 +322,7 @@ public class Portal {
|
||||
// add other variables or filter code here, or somehow have a way to register them
|
||||
|
||||
if(config.getConfig().getString(portalName + ".bungee") != null){
|
||||
|
||||
player.sendMessage("§a[§eAdvancedPortals§a] Attempting to warp to §e" + config.getConfig().getString(portalName + ".bungee") + "§a.");
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(config.getConfig().getString(portalName + ".bungee"));
|
||||
@ -337,7 +339,7 @@ public class Portal {
|
||||
return warped;
|
||||
}
|
||||
else{
|
||||
player.sendMessage("§cThe destination you are currently attempting to warp to doesnt exist!");
|
||||
player.sendMessage("§c[§7AdvancedPortals§c] The destination you are currently attempting to warp to doesnt exist!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or that destination listed doesn't exist!");
|
||||
return false;
|
||||
@ -345,7 +347,7 @@ public class Portal {
|
||||
|
||||
}
|
||||
else{
|
||||
player.sendMessage("§cThe portal you are trying to use doesn't have a destination!");
|
||||
player.sendMessage("§c[§7AdvancedPortals§c] The portal you are trying to use doesn't have a destination!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or portal doesn't exist!");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user