mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-23 16:08:18 -05:00
Latest changes
This commit is contained in:
parent
d5772a103b
commit
38f6a4565a
5 changed files with 63 additions and 258 deletions
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# extras
|
||||||
|
|
||||||
|
Source code for the Extras plugin on the Kaboom.pw server
|
|
@ -137,15 +137,6 @@ class CommandEnd implements CommandExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommandHub implements CommandExecutor {
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
Player player = (Player)sender;
|
|
||||||
player.teleport(new Location(Bukkit.getWorld("world"), 0, 85, 0));
|
|
||||||
player.sendMessage("Successfully moved to the Hub");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CommandJumpscare implements CommandExecutor {
|
class CommandJumpscare implements CommandExecutor {
|
||||||
private void createJumpscare(Player player) {
|
private void createJumpscare(Player player) {
|
||||||
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
|
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
|
||||||
|
@ -190,7 +181,7 @@ class CommandNether implements CommandExecutor {
|
||||||
class CommandOverworld implements CommandExecutor {
|
class CommandOverworld implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
player.teleport(Bukkit.getWorld("world").getSpawnLocation());
|
player.teleport(new Location(Bukkit.getWorld("world"), 0.5, 100, 0.5));
|
||||||
player.sendMessage("Successfully moved to the Overworld");
|
player.sendMessage("Successfully moved to the Overworld");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -222,12 +213,8 @@ class CommandPrefix implements CommandExecutor {
|
||||||
class CommandSpawn implements CommandExecutor {
|
class CommandSpawn implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
World world = player.getLocation().getWorld();
|
World world = Bukkit.getWorld("world");
|
||||||
if (world.getName().equals("world")) {
|
player.teleport(new Location(world, 0.5, 100, 0.5));
|
||||||
player.teleport(new Location(world, 0, 85, 0));
|
|
||||||
} else {
|
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
|
||||||
}
|
|
||||||
player.sendMessage("Successfully moved to the spawn");
|
player.sendMessage("Successfully moved to the spawn");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package pw.kaboom.extras;
|
package pw.kaboom.extras;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent;
|
import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent;
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
|
import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
||||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||||
|
@ -100,9 +102,9 @@ class Update extends BukkitRunnable {
|
||||||
File file = new File("spawn.schematic");
|
File file = new File("spawn.schematic");
|
||||||
boolean allowUndo = false;
|
boolean allowUndo = false;
|
||||||
boolean noAir = false;
|
boolean noAir = false;
|
||||||
Vector position = new Vector(0, 85, 0);
|
Vector position = new Vector(0, 100, 0);
|
||||||
try {
|
try {
|
||||||
EditSession editSession = ClipboardFormat.SCHEMATIC.load(file).paste(FaweAPI.getWorld("world"), position, allowUndo, noAir, (Transform) null);
|
EditSession editSession = ClipboardFormat.SCHEMATIC.load(file).paste(FaweAPI.getWorld("world"), position, allowUndo, !noAir, (Transform) null);
|
||||||
} catch(Exception exception) {
|
} catch(Exception exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -123,14 +125,12 @@ class Events implements Listener {
|
||||||
if (main.getConfig().getString(player.getUniqueId().toString()) != null) {
|
if (main.getConfig().getString(player.getUniqueId().toString()) != null) {
|
||||||
String prefix = ChatColor.translateAlternateColorCodes('&', main.getConfig().getString(player.getUniqueId().toString()));
|
String prefix = ChatColor.translateAlternateColorCodes('&', main.getConfig().getString(player.getUniqueId().toString()));
|
||||||
event.setFormat(prefix + ChatColor.RESET + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
event.setFormat(prefix + ChatColor.RESET + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
||||||
|
} else if (event.getPlayer().isOp()) {
|
||||||
|
String prefix = ChatColor.translateAlternateColorCodes('&', "&4&l[&c&lOP&4&l]");
|
||||||
|
event.setFormat(prefix + ChatColor.RED + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
||||||
} else {
|
} else {
|
||||||
if (event.getPlayer().isOp()) {
|
String prefix = ChatColor.translateAlternateColorCodes('&', "&8&l[&7&lDeOP&8&l]");
|
||||||
String prefix = ChatColor.translateAlternateColorCodes('&', "&4&l[&c&lOP&4&l]");
|
event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
||||||
event.setFormat(prefix + ChatColor.RED + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
|
||||||
} else {
|
|
||||||
String prefix = ChatColor.translateAlternateColorCodes('&', "&8&l[&7&lDeOP&8&l]");
|
|
||||||
event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + ChatColor.translateAlternateColorCodes('&', message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,10 +138,9 @@ class Events implements Listener {
|
||||||
void onBlockBreakEvent(BlockBreakEvent event) {
|
void onBlockBreakEvent(BlockBreakEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -153,10 +152,9 @@ class Events implements Listener {
|
||||||
void onBlockBurnEvent(BlockBurnEvent event) {
|
void onBlockBurnEvent(BlockBurnEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -167,10 +165,9 @@ class Events implements Listener {
|
||||||
void onBlockDamage(BlockDamageEvent event) {
|
void onBlockDamage(BlockDamageEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -181,11 +178,10 @@ class Events implements Listener {
|
||||||
void onBlockExplode(BlockExplodeEvent event) {
|
void onBlockExplode(BlockExplodeEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
double tps = Bukkit.getServer().getTPS()[0];
|
double tps = Bukkit.getServer().getTPS()[0];
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.blockList().clear();
|
event.blockList().clear();
|
||||||
}
|
}
|
||||||
|
@ -202,10 +198,9 @@ class Events implements Listener {
|
||||||
void onBlockFade(BlockFadeEvent event) {
|
void onBlockFade(BlockFadeEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -216,10 +211,9 @@ class Events implements Listener {
|
||||||
void onBlockFromTo(BlockFromToEvent event) {
|
void onBlockFromTo(BlockFromToEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -230,10 +224,9 @@ class Events implements Listener {
|
||||||
void onBlockGrow(BlockGrowEvent event) {
|
void onBlockGrow(BlockGrowEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -244,14 +237,14 @@ class Events implements Listener {
|
||||||
void onBlockPhysics(BlockPhysicsEvent event) {
|
void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.getType() == Material.LAVA ||
|
if (block.getType() == Material.LAVA ||
|
||||||
block.getType() == Material.SOIL ||
|
block.getType() == Material.SOIL ||
|
||||||
block.getType() == Material.STATIONARY_LAVA ||
|
block.getType() == Material.STATIONARY_LAVA ||
|
||||||
|
@ -265,10 +258,9 @@ class Events implements Listener {
|
||||||
void onBlockPlaceEvent(BlockPlaceEvent event) {
|
void onBlockPlaceEvent(BlockPlaceEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -279,11 +271,10 @@ class Events implements Listener {
|
||||||
void onBlockRedstone(BlockRedstoneEvent event) {
|
void onBlockRedstone(BlockRedstoneEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
double tps = Bukkit.getServer().getTPS()[0];
|
double tps = Bukkit.getServer().getTPS()[0];
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world" && (x > -20 && x < 20) && (z > -20 && z < 20) ||
|
if (block.getWorld().getName().equals("world") && (x > -20 && x < 20) && (z > -20 && z < 20) ||
|
||||||
tps < 14) {
|
tps < 14) {
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
}
|
}
|
||||||
|
@ -303,12 +294,16 @@ class Events implements Listener {
|
||||||
|
|
||||||
if (onChunk >= 50) {
|
if (onChunk >= 50) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
} else if (entity.getType() == EntityType.MAGMA_CUBE) {
|
}
|
||||||
|
|
||||||
|
if (entity.getType() == EntityType.MAGMA_CUBE) {
|
||||||
MagmaCube magmacube = (MagmaCube) event.getEntity();
|
MagmaCube magmacube = (MagmaCube) event.getEntity();
|
||||||
if (magmacube.getSize() > 100) {
|
if (magmacube.getSize() > 100) {
|
||||||
magmacube.setSize(100);
|
magmacube.setSize(100);
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.SLIME) {
|
}
|
||||||
|
|
||||||
|
if (entity.getType() == EntityType.SLIME) {
|
||||||
Slime slime = (Slime) event.getEntity();
|
Slime slime = (Slime) event.getEntity();
|
||||||
if (slime.getSize() > 100) {
|
if (slime.getSize() > 100) {
|
||||||
slime.setSize(100);
|
slime.setSize(100);
|
||||||
|
@ -320,10 +315,9 @@ class Events implements Listener {
|
||||||
void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
|
void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
double x = block.getLocation().getX();
|
double x = block.getLocation().getX();
|
||||||
double y = block.getLocation().getY();
|
|
||||||
double z = block.getLocation().getZ();
|
double z = block.getLocation().getZ();
|
||||||
|
|
||||||
if (block.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -344,23 +338,26 @@ class Events implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onEntityExplode(EntityExplodeEvent event) {
|
void onEntityExplode(EntityExplodeEvent event) {
|
||||||
Entity entity = event.getEntity();
|
|
||||||
double x = entity.getLocation().getX();
|
|
||||||
double y = entity.getLocation().getY();
|
|
||||||
double z = entity.getLocation().getZ();
|
|
||||||
double tps = Bukkit.getServer().getTPS()[0];
|
double tps = Bukkit.getServer().getTPS()[0];
|
||||||
|
|
||||||
event.setYield(0);
|
Iterator<Block> iter = event.blockList().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Block block = iter.next();
|
||||||
|
double x = block.getX();
|
||||||
|
double z = block.getZ();
|
||||||
|
|
||||||
if (entity.getWorld().getName() == "world") {
|
if (block.getWorld().getName().equals("world")) {
|
||||||
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
if ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
event.blockList().clear();
|
iter.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tps < 14) {
|
if (tps < 14) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.setYield(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -387,7 +384,9 @@ class Events implements Listener {
|
||||||
|
|
||||||
if (tps < 14) {
|
if (tps < 14) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (event.getRadius() > 20) {
|
}
|
||||||
|
|
||||||
|
if (event.getRadius() > 20) {
|
||||||
event.setRadius(20);
|
event.setRadius(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +395,6 @@ class Events implements Listener {
|
||||||
void onLingeringPotionSplash(LingeringPotionSplashEvent event) {
|
void onLingeringPotionSplash(LingeringPotionSplashEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
double x = entity.getLocation().getX();
|
double x = entity.getLocation().getX();
|
||||||
double y = entity.getLocation().getY();
|
|
||||||
double z = entity.getLocation().getZ();
|
double z = entity.getLocation().getZ();
|
||||||
|
|
||||||
if (entity.getWorld().getName() == "world") {
|
if (entity.getWorld().getName() == "world") {
|
||||||
|
@ -410,7 +408,6 @@ class Events implements Listener {
|
||||||
void onPotionSplash(PotionSplashEvent event) {
|
void onPotionSplash(PotionSplashEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
double x = entity.getLocation().getX();
|
double x = entity.getLocation().getX();
|
||||||
double y = entity.getLocation().getY();
|
|
||||||
double z = entity.getLocation().getZ();
|
double z = entity.getLocation().getZ();
|
||||||
|
|
||||||
if (entity.getWorld().getName() == "world") {
|
if (entity.getWorld().getName() == "world") {
|
||||||
|
@ -424,7 +421,6 @@ class Events implements Listener {
|
||||||
void onHangingPlace(HangingPlaceEvent event) {
|
void onHangingPlace(HangingPlaceEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
double x = entity.getLocation().getX();
|
double x = entity.getLocation().getX();
|
||||||
double y = entity.getLocation().getY();
|
|
||||||
double z = entity.getLocation().getZ();
|
double z = entity.getLocation().getZ();
|
||||||
|
|
||||||
if (entity.getWorld().getName() == "world") {
|
if (entity.getWorld().getName() == "world") {
|
||||||
|
@ -438,7 +434,6 @@ class Events implements Listener {
|
||||||
void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
double x = player.getLocation().getX();
|
double x = player.getLocation().getX();
|
||||||
double y = player.getLocation().getY();
|
|
||||||
double z = player.getLocation().getZ();
|
double z = player.getLocation().getZ();
|
||||||
|
|
||||||
if (player.getWorld().getName() == "world") {
|
if (player.getWorld().getName() == "world") {
|
||||||
|
@ -448,39 +443,6 @@ class Events implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String world = player.getLocation().getWorld().getName();
|
|
||||||
/*PermissionAttachment p = main.permissionList.get(player.getUniqueId());*/
|
|
||||||
|
|
||||||
if (world == "world_the_end") {
|
|
||||||
player.sendTitle(ChatColor.GRAY + "The End", "Return to the hub by typing /hub in chat", 10, 160, 5);
|
|
||||||
} else if (world == "world_nether") {
|
|
||||||
player.sendTitle(ChatColor.RED + "Nether", "Return to the hub by typing /hub in chat", 10, 160, 5);
|
|
||||||
} else if (world == "world_overworld") {
|
|
||||||
player.sendTitle(ChatColor.DARK_GREEN + "Overworld", "Return to the hub by typing /hub in chat", 10, 160, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if (world == "world") {
|
|
||||||
p.unsetPermission("DoBlockImage.doblockimage");
|
|
||||||
p.unsetPermission("essentials.bigtree");
|
|
||||||
p.unsetPermission("essentials.tree");
|
|
||||||
p.unsetPermission("minecraft.command.blockdata");
|
|
||||||
p.unsetPermission("minecraft.command.clone");
|
|
||||||
p.unsetPermission("minecraft.command.fill");
|
|
||||||
p.unsetPermission("minecraft.command.setblock");
|
|
||||||
} else {
|
|
||||||
p.setPermission("DoBlockImage.doblockimage", true);
|
|
||||||
p.setPermission("essentials.bigtree", true);
|
|
||||||
p.setPermission("essentials.tree", true);
|
|
||||||
p.setPermission("minecraft.command.blockdata", true);
|
|
||||||
p.setPermission("minecraft.command.clone", true);
|
|
||||||
p.setPermission("minecraft.command.fill", true);
|
|
||||||
p.setPermission("minecraft.command.setblock", true);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
String arr[] = event.getMessage().split(" ");
|
String arr[] = event.getMessage().split(" ");
|
||||||
|
@ -506,47 +468,10 @@ class Events implements Listener {
|
||||||
event.setMessage(event.getMessage().substring(0, Math.min(256, event.getMessage().length())));
|
event.setMessage(event.getMessage().substring(0, Math.min(256, event.getMessage().length())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@EventHandler
|
|
||||||
void onPlayerHandshake(PlayerHandshakeEvent event) {
|
|
||||||
event.setFailed(true);
|
|
||||||
event.setServerHostname("0.0.0.0");
|
|
||||||
event.setSocketAddressHostname("0.0.0.0");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerJoin(PlayerJoinEvent event) {
|
void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
/*UUID uuid = "069a79f4-44e9-4726-a5be-fca90e38aaf5";*/
|
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
|
|
||||||
/*try {
|
|
||||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", UUIDTypeAdapter.fromUUID(uuid))).openConnection();
|
|
||||||
if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
|
||||||
String reply = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
|
|
||||||
String skin = reply.split("\"value\":\"")[1].split("\"")[0];
|
|
||||||
String signature = reply.split("\"signature\":\"")[1].split("\"")[0];
|
|
||||||
((CraftPlayer)player).getProfile().getProperties().put("textures", new Property("textures", skin, signature));
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
System.out.println("Connection could not be opened (Response code " + connection.getResponseCode() + ", " + connection.getResponseMessage() + ")");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*PermissionAttachment attachment = player.addAttachment(main);
|
|
||||||
main.permissionList.put(player.getUniqueId(), attachment);
|
|
||||||
if (!player.getWorld().getName() == "world")) {
|
|
||||||
PermissionAttachment p = main.permissionList.get(player.getUniqueId());
|
|
||||||
p.setPermission("DoBlockImage.doblockimage", true);
|
|
||||||
p.setPermission("essentials.bigtree", true);
|
|
||||||
p.setPermission("essentials.tree", true);
|
|
||||||
p.setPermission("minecraft.command.blockdata", true);
|
|
||||||
p.setPermission("minecraft.command.clone", true);
|
|
||||||
p.setPermission("minecraft.command.fill", true);
|
|
||||||
p.setPermission("minecraft.command.setblock", true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
player.sendTitle(ChatColor.GRAY + "Kaboom.pw", "Free OP • Anarchy • Creative", 10, 160, 5);
|
player.sendTitle(ChatColor.GRAY + "Kaboom.pw", "Free OP • Anarchy • Creative", 10, 160, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,106 +485,12 @@ class Events implements Listener {
|
||||||
event.allow();
|
event.allow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@EventHandler
|
|
||||||
void onPlayerMove(PlayerMoveEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
double x = player.getLocation().getX();
|
|
||||||
double y = player.getLocation().getY();
|
|
||||||
double z = player.getLocation().getZ();
|
|
||||||
|
|
||||||
if (player.getWorld().getName() == "world")) {
|
|
||||||
if ((x > -19 && x < -13) && (y > 62 && y < 72) && (z > -1 && z < 2)) {
|
|
||||||
if (!main.enteredPortal.containsKey(player.getUniqueId())) {
|
|
||||||
player.teleport(Bukkit.getWorld("world_the_end").getSpawnLocation());
|
|
||||||
main.enteredPortal.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > 14 && x < 20) && (y > 62 && y < 72) && (z > -1 && z < 2)) {
|
|
||||||
if (!main.enteredPortal.containsKey(player.getUniqueId())) {
|
|
||||||
player.teleport(Bukkit.getWorld("world_flatlands").getSpawnLocation());
|
|
||||||
main.enteredPortal.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > -8 && x < -2) && (y > 62 && y < 72) && (z > -1 && z < 2)) {
|
|
||||||
if (!main.enteredPortal.containsKey(player.getUniqueId())) {
|
|
||||||
player.teleport(Bukkit.getWorld("world_nether").getSpawnLocation());
|
|
||||||
main.enteredPortal.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > 3 && x < 9) && (y > 62 && y < 72) && (z > -1 && z < 2)) {
|
|
||||||
if (!main.enteredPortal.containsKey(player.getUniqueId())) {
|
|
||||||
player.teleport(Bukkit.getWorld("world_overworld").getSpawnLocation());
|
|
||||||
main.enteredPortal.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
main.enteredPortal.remove(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((x > -21 && x < -11) && (y > 62 && y < 84) && (z > -17 && z < 0)) {
|
|
||||||
if (!main.enteredTitle.containsKey(player.getUniqueId())) {
|
|
||||||
player.sendTitle("", ChatColor.GRAY + "" + ChatColor.BOLD + "The End", 10, 160, 5);
|
|
||||||
main.enteredTitle.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > 12 && x < 22) && (y > 62 && y < 84) && (z > -17 && z < 0)) {
|
|
||||||
if (!main.enteredTitle.containsKey(player.getUniqueId())) {
|
|
||||||
player.sendTitle("", ChatColor.GREEN + "" + ChatColor.BOLD + "Flatlands", 10, 160, 5);
|
|
||||||
main.enteredTitle.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > -10 && x < 0) && (y > 62 && y < 84) && (z > -17 && z < 0)) {
|
|
||||||
if (!main.enteredTitle.containsKey(player.getUniqueId())) {
|
|
||||||
player.sendTitle("", ChatColor.RED + "" + ChatColor.BOLD + "Nether", 10, 160, 5);
|
|
||||||
main.enteredTitle.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else if ((x > 1 && x < 11) && (y > 62 && y < 84) && (z > -17 && z < 0)) {
|
|
||||||
if (!main.enteredTitle.containsKey(player.getUniqueId())) {
|
|
||||||
player.sendTitle("", ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "Overworld", 10, 160, 5);
|
|
||||||
main.enteredTitle.put(player.getUniqueId(), true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
main.enteredTitle.remove(player.getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*@EventHandler
|
|
||||||
void onPlayerPortal(PlayerPortalEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (player.getWorld().getName().equals("world_overworld")) {
|
|
||||||
if (event.getCause() == TeleportCause.NETHER_PORTAL) {
|
|
||||||
Location netherloc = player.getLocation().clone();
|
|
||||||
netherloc.multiply(1d / 8d);
|
|
||||||
event.setTo(new Location(Bukkit.getWorld("world_nether"), netherloc.getX(), netherloc.getY(), netherloc.getZ()));
|
|
||||||
event.getPortalTravelAgent().createPortal(netherloc);
|
|
||||||
} else if (event.getCause() == TeleportCause.END_PORTAL) {
|
|
||||||
World w = Bukkit.getWorld("world_the_end");
|
|
||||||
event.setTo(new Location(w, w.getSpawnLocation().getX(), w.getSpawnLocation().getY(), w.getSpawnLocation().getZ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = event.getTo().getX();
|
|
||||||
double y = event.getTo().getY();
|
|
||||||
double z = event.getTo().getZ();
|
|
||||||
|
|
||||||
if (event.getTo().getWorld().getName() == "world")) {
|
|
||||||
event.setTo(new Location(Bukkit.getWorld("world_overworld"), x, y, z));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
void onPlayerQuit(PlayerQuitEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
main.enteredPortal.remove(player.getUniqueId());
|
|
||||||
main.enteredTitle.remove(player.getUniqueId());
|
|
||||||
/*player.removeAttachment(main.permissionList.get(player.getUniqueId()));*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerRespawn(PlayerRespawnEvent event) {
|
void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
World world = event.getRespawnLocation().getWorld();
|
World world = event.getRespawnLocation().getWorld();
|
||||||
if (world.getName() == "world") {
|
if (world.getName().equals("world") && player.getBedSpawnLocation() == null) {
|
||||||
if (player.getBedSpawnLocation() != null) {
|
event.setRespawnLocation(new Location(world, 0.5, 100, 0.5));
|
||||||
event.setRespawnLocation(player.getBedSpawnLocation());
|
|
||||||
} else {
|
|
||||||
event.setRespawnLocation(new Location(world, 0, 85, 0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +499,7 @@ class Events implements Listener {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
World world = event.getSpawnLocation().getWorld();
|
World world = event.getSpawnLocation().getWorld();
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
event.setSpawnLocation(new Location(world, 0, 85, 0));
|
event.setSpawnLocation(new Location(world, 0.5, 100, 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,10 +535,16 @@ class Events implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorldEditEvent {
|
class WorldEditEvent {
|
||||||
/*@Subscribe(priority = Priority.VERY_EARLY)
|
@Subscribe(priority = Priority.VERY_EARLY)
|
||||||
public void onEditSessionEvent(EditSessionEvent event) {
|
public void onEditSessionEvent(final EditSessionEvent event) {
|
||||||
if (event.getWorld().getName() == "world") && ((x > -20 && x < 20) && (z > -20 && z < 20)) {
|
event.setExtent(new AbstractLoggingExtent(event.getExtent()) {
|
||||||
event.setCancelled(true);
|
private void onBlockChange(Vector position) {
|
||||||
}
|
double x = position.getBlockX();
|
||||||
}*/
|
double z = position.getBlockZ();
|
||||||
|
if (event.getWorld().getName().equals("world") && (x > -20 && x < 20) && (z > -20 && z < 20)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,10 +342,6 @@ public class Main extends JavaPlugin {
|
||||||
"warps",
|
"warps",
|
||||||
"whisper",
|
"whisper",
|
||||||
}));
|
}));
|
||||||
HashMap<UUID, Boolean> enteredPortal = new HashMap<UUID, Boolean>();
|
|
||||||
HashMap<UUID, Boolean> enteredTitle = new HashMap<UUID, Boolean>();
|
|
||||||
HashMap<UUID, PermissionAttachment> permissionList = new HashMap<UUID, PermissionAttachment>();
|
|
||||||
int physicscount = 0;
|
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.getCommand("clearchat").setExecutor(new CommandClearChat());
|
this.getCommand("clearchat").setExecutor(new CommandClearChat());
|
||||||
|
@ -354,7 +350,6 @@ public class Main extends JavaPlugin {
|
||||||
this.getCommand("discord").setExecutor(new CommandDiscord());
|
this.getCommand("discord").setExecutor(new CommandDiscord());
|
||||||
this.getCommand("enchantall").setExecutor(new CommandEnchantAll());
|
this.getCommand("enchantall").setExecutor(new CommandEnchantAll());
|
||||||
this.getCommand("end").setExecutor(new CommandEnd());
|
this.getCommand("end").setExecutor(new CommandEnd());
|
||||||
this.getCommand("hub").setExecutor(new CommandHub());
|
|
||||||
this.getCommand("jumpscare").setExecutor(new CommandJumpscare());
|
this.getCommand("jumpscare").setExecutor(new CommandJumpscare());
|
||||||
this.getCommand("nether").setExecutor(new CommandNether());
|
this.getCommand("nether").setExecutor(new CommandNether());
|
||||||
this.getCommand("overworld").setExecutor(new CommandOverworld());
|
this.getCommand("overworld").setExecutor(new CommandOverworld());
|
||||||
|
@ -369,16 +364,5 @@ public class Main extends JavaPlugin {
|
||||||
new Update().runTaskTimer(this, 0, 200);
|
new Update().runTaskTimer(this, 0, 200);
|
||||||
this.getServer().getPluginManager().registerEvents(new Events(this), this);
|
this.getServer().getPluginManager().registerEvents(new Events(this), this);
|
||||||
WorldEdit.getInstance().getEventBus().register(new WorldEditEvent());
|
WorldEdit.getInstance().getEventBus().register(new WorldEditEvent());
|
||||||
|
|
||||||
/*ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
|
||||||
manager.addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Server.BLOCK_CHANGE) {
|
|
||||||
@Override
|
|
||||||
public void onPacketSending(PacketEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (player.getWorld().getName().equals("world")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: Extras
|
name: Extras
|
||||||
main: pw.kaboom.extras.Main
|
main: pw.kaboom.extras.Main
|
||||||
description: Plugin that adds extra functionality to the Kaboom.pw server.
|
description: Plugin that adds extra functionality to the Kaboom.pw server.
|
||||||
depend: [ProtocolLib, WorldEdit]
|
depend: [WorldEdit]
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
@ -24,12 +24,6 @@ commands:
|
||||||
end:
|
end:
|
||||||
description: Moves you to the End
|
description: Moves you to the End
|
||||||
permission: extras.end
|
permission: extras.end
|
||||||
flatlands:
|
|
||||||
description: Moves you to the Flatlands
|
|
||||||
permission: extras.flatlands
|
|
||||||
hub:
|
|
||||||
description: Moves you to the Hub
|
|
||||||
permission: extras.hub
|
|
||||||
jumpscare:
|
jumpscare:
|
||||||
aliases: scare
|
aliases: scare
|
||||||
description: Scares a player
|
description: Scares a player
|
||||||
|
|
Loading…
Reference in a new issue