mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
[UNTESTED] Plot change owner
This commit is contained in:
parent
46a00357b3
commit
c8313d6cd9
@ -25,10 +25,15 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -59,14 +64,25 @@ public class SetOwner extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.NEED_USER);
|
PlayerFunctions.sendMessage(plr, C.NEED_USER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.owner = getUUID(args[0]);
|
|
||||||
PlotMain.updatePlot(plot);
|
World world = plr.getWorld();
|
||||||
DBFunc.setOwner(plot, plot.owner);
|
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
PlayerFunctions.sendMessage(plr, C.SET_OWNER);
|
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
||||||
|
|
||||||
|
ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(world, bot, top);
|
||||||
|
|
||||||
|
for (PlotId id : plots) {
|
||||||
|
Plot current = PlotMain.getPlots(world).get(id);
|
||||||
|
current.owner = getUUID(args[0]);
|
||||||
|
PlotMain.updatePlot(current);
|
||||||
|
DBFunc.setOwner(current, current.owner);
|
||||||
|
|
||||||
if (PlotMain.worldGuardListener != null) {
|
if (PlotMain.worldGuardListener != null) {
|
||||||
PlotMain.worldGuardListener.changeOwner(plr, plot.owner, plr.getWorld(), plot);
|
PlotMain.worldGuardListener.changeOwner(plr, current.owner, plr.getWorld(), current);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerFunctions.sendMessage(plr, C.SET_OWNER);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user