Skip to content

Commit

Permalink
Merge branch 'release/tf43'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromSar committed Mar 7, 2015
2 parents 2fedcf8 + 8834c1e commit 136e21d
Show file tree
Hide file tree
Showing 10 changed files with 346 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ out
run

/dependency-reduced-pom.xml
*-private.sh
*-private.sh
.nb-gradle
.nb-gradle-properties
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
println """
*******************************************
You are building WorldEdit!
You are building WorldEdit!
If you encounter trouble:
1) Read COMPILING.md if you haven't yet
Expand Down Expand Up @@ -48,18 +48,18 @@ if (!project.hasProperty("gitCommitHash")) {
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'checkstyle'
//apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.jfrog.artifactory-upload'

group = 'com.sk89q.worldedit'
version = '6.0.2-SNAPSHOT'
version = '6.0.2-TF'
ext.internalVersion = version + ";" + gitCommitHash

sourceCompatibility = 1.6
targetCompatibility = 1.6

checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
//checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")

repositories {
mavenCentral()
Expand Down Expand Up @@ -91,8 +91,8 @@ subprojects {
archives javadocJar
}

build.dependsOn(checkstyleMain)
build.dependsOn(checkstyleTest)
//build.dependsOn(checkstyleMain)
//build.dependsOn(checkstyleTest)
build.dependsOn(sourcesJar)
build.dependsOn(javadocJar)

Expand All @@ -116,7 +116,7 @@ subprojects {
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true

}
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.name = 'worldedit'

include 'worldedit-core', 'worldedit-bukkit', 'worldedit-forge'
include 'worldedit-core', 'worldedit-bukkit'
2 changes: 2 additions & 0 deletions worldedit-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
compile 'com.thoughtworks.paranamer:paranamer:2.6'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.sk89q.lib:jlibnoise:1.0.0'
compile 'org.sk89q.bukkit:bukkit-classloader-check:1.7.9-R0.2'
compile 'org.bukkit:bukkit:1.7.9-R0.2'
//compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.sk89q.worldedit;

import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options;
import com.sk89q.jchronic.utils.Span;
Expand All @@ -44,16 +45,13 @@
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.snapshot.Snapshot;

import javax.annotation.Nullable;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicBoolean;

import static com.google.common.base.Preconditions.checkNotNull;
import javax.annotation.Nullable;

/**
* Stores session information.
Expand Down Expand Up @@ -703,6 +701,10 @@ public void dispatchCUIEvent(Actor actor, CUIEvent event) {
if (hasCUISupport) {
actor.dispatchCUIEvent(event);
}

if (actor instanceof com.sk89q.worldedit.entity.Player) {
me.StevenLawson.worldedit.WorldEditHandler.selectionChanged((com.sk89q.worldedit.entity.Player) actor);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@

package com.sk89q.worldedit.command;

import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.util.command.parametric.Optional;

import static com.google.common.base.Preconditions.checkNotNull;
import me.StevenLawson.worldedit.WorldEditHandler;

/**
* General WorldEdit commands.
Expand All @@ -53,11 +57,11 @@ public GeneralCommands(WorldEdit worldEdit) {
usage = "<limit>",
desc = "Modify block change limit",
min = 1,
max = 1
max = 2
)
@CommandPermissions("worldedit.limit")
public void limit(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {

LocalConfiguration config = worldEdit.getConfiguration();
boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted");

Expand All @@ -69,10 +73,27 @@ public void limit(Player player, LocalSession session, EditSession editSession,
}
}

session.setBlockChangeLimit(limit);
// TFM Start
final String targetName = (args.argsLength() == 2 ? args.getString(1) : null);
final LocalSession targetSession = (targetName == null ?
WorldEdit.getInstance().getSessionManager().get(player) :
WorldEdit.getInstance().getSessionManager().findByName(targetName));

if (targetSession == null) {
player.printError("Could not resolve player session for player: " + targetName);
return;
}

limit = WorldEditHandler.limitChanged(player, limit, targetName);
if (limit < -1) {
return;
}
// TFM End

targetSession.setBlockChangeLimit(limit);

if (limit != -1) {
player.print("Block change limit set to " + limit + ". (Use //limit -1 to go back to the default.)");
player.print("Block change limit set to " + limit + ". (Use //limit 2500 to go back to the default.)");
} else {
player.print("Block change limit set to " + limit + ".");
}
Expand Down Expand Up @@ -156,7 +177,7 @@ public void togglePlace(Player player, LocalSession session, EditSession editSes
max = 1
)
public void searchItem(Actor actor, CommandContext args) throws WorldEditException {

String query = args.getString(0).trim().toLowerCase();
boolean blocksOnly = args.hasFlag('b');
boolean itemsOnly = args.hasFlag('i');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@

package com.sk89q.worldedit.extension.factory;

import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ClothColor;
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.NoteBlock;
import com.sk89q.worldedit.blocks.SignBlock;
import com.sk89q.worldedit.blocks.SkullBlock;
import com.sk89q.worldedit.blocks.metadata.MobType;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
Expand All @@ -30,6 +40,7 @@
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.world.World;
import me.StevenLawson.worldedit.WorldEditHandler;

/**
* Parses block input strings.
Expand Down Expand Up @@ -245,6 +256,14 @@ public BaseBlock parseFromInput(String input, ParserContext context) throws Inpu
throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
}

// TFM start
if (actor instanceof Player
&& worldEdit.getConfiguration().disallowedBlocks.contains(blockId)
&& !WorldEditHandler.isSuperAdmin((Player) actor)) {
throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
}
// TFM end

if (blockType == null) {
return new BaseBlock(blockId, data);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package me.StevenLawson.worldedit;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;

public class LimitChangedEvent extends PlayerEvent implements Cancellable {

private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private final Player target;
private int limit;

public LimitChangedEvent(Player from, Player target, int limit) {
super(from);
this.target = target;
this.limit = limit;
}

public Player getTarget() {
return target;
}

public int getLimit() {
return limit;
}

public void setLimit(int limit) {
this.limit = limit;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean bln) {
this.cancelled = bln;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package me.StevenLawson.worldedit;

import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.util.Vector;

public class SelectionChangedEvent extends PlayerEvent implements Cancellable {

private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private final World world;
private final Vector minVector;
private final Vector maxVector;


public SelectionChangedEvent(Player player, World world, Vector minVector, Vector maxVector) {
super(player);

this.world = world;
this.minVector = minVector;
this.maxVector = maxVector;
}

public World getWorld() {
return world;
}

public Vector getMaxVector() {
return maxVector;
}

public Vector getMinVector() {
return minVector;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean bln) {
this.cancelled = bln;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Loading

0 comments on commit 136e21d

Please sign in to comment.