mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Added /plot weanywhere
This commit is contained in:
parent
997b6e44b3
commit
e876a93ef6
@ -21,8 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import com.intellectualcrafters.plot.api.PlotAPI;
|
||||
import com.intellectualcrafters.plot.commands.Auto;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.commands.WE_Anywhere;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -1477,6 +1479,7 @@ import java.util.concurrent.TimeUnit;
|
||||
PlotMain.sendConsoleSenderMessage("&c - http://builds.enginehub.org/job/worldedit");
|
||||
} else {
|
||||
getServer().getPluginManager().registerEvents(new WorldEditListener(), this);
|
||||
MainCommand.subCommands.add(new WE_Anywhere());
|
||||
}
|
||||
}
|
||||
if (Settings.WORLDGUARD) {
|
||||
|
@ -163,7 +163,7 @@ import org.bukkit.entity.Player;
|
||||
if ((size_x == 1) && (size_z == 1)) {
|
||||
while (!br) {
|
||||
final Plot plot = PlotHelper.getPlot(world, Auto.lastPlot);
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
if ((plot.owner == null)) {
|
||||
Claim.claimPlot(plr, plot, true, true);
|
||||
br = true;
|
||||
final PlotWorld pw = PlotMain.getWorldSettings(world);
|
||||
@ -212,6 +212,7 @@ import org.bukkit.entity.Player;
|
||||
}
|
||||
}
|
||||
}
|
||||
Auto.lastPlot = new PlotId(0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
||||
// /
|
||||
// This program is free software; you can redistribute it and/or modify /
|
||||
// it under the terms of the GNU General Public License as published by /
|
||||
// the Free Software Foundation; either version 3 of the License, or /
|
||||
// (at your option) any later version. /
|
||||
// /
|
||||
// This program is distributed in the hope that it will be useful, /
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
||||
// GNU General Public License for more details. /
|
||||
// /
|
||||
// You should have received a copy of the GNU General Public License /
|
||||
// along with this program; if not, write to the Free Software Foundation, /
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.util.PWE;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WE_Anywhere extends SubCommand {
|
||||
|
||||
public WE_Anywhere() {
|
||||
super("weanywhere", "plots.worldedit.bypass", "Force bypass of WorldEdit", "weanywhere", "wea", CommandCategory.DEBUG, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
if (PlotMain.worldEdit == null) {
|
||||
PlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
||||
return false;
|
||||
}
|
||||
PWE.removeMask(plr);
|
||||
PlayerFunctions.sendMessage(plr, "&6Removed your WorldEdit mask");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -34,6 +34,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -51,7 +52,7 @@ public class HybridGen extends PlotGenerator {
|
||||
/**
|
||||
* Set to static to re-use the same managet for all Default World Generators
|
||||
*/
|
||||
private PlotManager manager = null;
|
||||
private static PlotManager manager = null;
|
||||
|
||||
/**
|
||||
* Some generator specific variables (implementation dependent)
|
||||
@ -146,10 +147,10 @@ public class HybridGen extends PlotGenerator {
|
||||
*/
|
||||
@Override
|
||||
public PlotManager getPlotManager() {
|
||||
if (manager == null) {
|
||||
manager = new HybridPlotManager();
|
||||
if (this.manager == null) {
|
||||
this.manager = new HybridPlotManager();
|
||||
}
|
||||
return manager;
|
||||
return this.manager;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,7 +221,8 @@ public class HybridGen extends PlotGenerator {
|
||||
}
|
||||
// You can have as many populators as you would like, e.g. tree
|
||||
// populator, ore populator
|
||||
return Arrays.asList((BlockPopulator) new HybridPop(this.plotworld));
|
||||
// return Arrays.asList((BlockPopulator) new HybridPop(this.plotworld));
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,8 +260,8 @@ public class HybridGen extends PlotGenerator {
|
||||
int X = cx << 4;
|
||||
int Z = cz << 4;
|
||||
|
||||
short sx = (short) ((X) % this.size);
|
||||
short sz = (short) ((Z) % this.size);
|
||||
int sx = ((X) % this.size);
|
||||
int sz = ((Z) % this.size);
|
||||
|
||||
if (sx < 0) {
|
||||
sx += this.size;
|
||||
@ -293,8 +295,8 @@ public class HybridGen extends PlotGenerator {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
short sx = (short) ((cx << 4) % this.size);
|
||||
short sz = (short) ((cz << 4) % this.size);
|
||||
int sx = ((cx << 4) % this.size);
|
||||
int sz = ((cz << 4) % this.size);
|
||||
|
||||
if (sx < 0) {
|
||||
sx += this.size;
|
||||
@ -310,8 +312,8 @@ public class HybridGen extends PlotGenerator {
|
||||
|
||||
biomes.setBiome(x, z, this.biome);
|
||||
|
||||
short absX = (short) ((sx + x) % this.size);
|
||||
short absZ = (short) ((sz + z) % this.size);
|
||||
int absX = ((sx + x) % this.size);
|
||||
int absZ = ((sz + z) % this.size);
|
||||
|
||||
boolean gx = absX > pathWidthLower;
|
||||
boolean gz = absZ > pathWidthLower;
|
||||
@ -348,7 +350,7 @@ public class HybridGen extends PlotGenerator {
|
||||
if (blocks != null) {
|
||||
for (short y : blocks.keySet()) {
|
||||
setBlock(this.result, x, this.roadheight + y, z, blocks.get(y));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ import java.util.HashSet;
|
||||
|
||||
@SuppressWarnings("deprecation") public class HybridPlotManager extends PlotManager {
|
||||
|
||||
public RegionWrapper CURRENT_PLOT_CLEAR;
|
||||
public RegionWrapper CURRENT_PLOT_CLEAR = null;
|
||||
public HashMap<ChunkLoc, HashMap<Short, Short>> GENERATE_BLOCKS = new HashMap<>();
|
||||
public HashMap<ChunkLoc, HashMap<Short, Byte>> GENERATE_DATA = new HashMap<>();
|
||||
private int task;
|
||||
|
@ -185,10 +185,13 @@ import java.util.Set;
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerJoin(final PlayerJoinEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
final Location l = p.getLocation();
|
||||
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) {
|
||||
if (isPlotWorld(l)) {
|
||||
PWE.removeMask(p);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final Location l = p.getLocation();
|
||||
if (isPlotWorld(l)) {
|
||||
PWE.setMask(p, l);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user